UnorderedMap
Last updated
Last updated
• Docs
/ / UnorderedMap
An unordered map that stores data in NEAR storage.
<DataType
>
• DataType
new UnorderedMap<
DataType
>(prefix
): <DataType
>
Parameters
• prefix: string
The byte prefix to use when storing elements inside this collection.
Returns
Overrides
Defined in
Defined in
readonly
prefix:string
The byte prefix to use when storing elements inside this collection.
Defined in
Defined in
get
length():number
The number of elements stored in the collection.
Returns
number
Defined in
[iterator]():
UnorderedMapIterator
<DataType
>
Returns
UnorderedMapIterator
<DataType
>
Defined in
clear():
void
Remove all of the elements stored within the collection.
Returns
void
Defined in
extend(
keyValuePairs
):void
Extends the current collection with the passed in array of key-value pairs.
Parameters
• keyValuePairs: [string
, DataType
][]
The key-value pairs to extend the collection with.
Returns
void
Defined in
get(
key
,options
?):DataType
Get the data stored at the provided key.
Parameters
• key: string
The key at which to look for the data.
Options for retrieving the data.
Returns
DataType
Defined in
isEmpty():
boolean
Checks whether the collection is empty.
Returns
boolean
Defined in
keys(
__namedParameters
):string
[]
Parameters
• __namedParameters
• __namedParameters.limit: any
• __namedParameters.start: any
Returns
string
[]
Defined in
remove(
key
,options
?):DataType
Removes and retrieves the element with the provided key.
Parameters
• key: string
The key at which to remove data.
Options for retrieving the data.
Returns
DataType
Defined in
serialize(
options
?):Uint8Array
Serialize the collection.
Parameters
Options for storing the data.
Returns
Uint8Array
Defined in
set(
key
,value
,options
?):DataType
Store a new value at the provided key.
Parameters
• key: string
The key at which to store in the collection.
• value: DataType
The value to store in the collection.
Options for retrieving and storing the data.
Returns
DataType
Defined in
Parameters
Returns
Inherited from
Defined in
subtype():
any
Returns
any
Inherited from
Defined in
toArray(
options
?): [string
,DataType
][]
Return a JavaScript array of the data stored within the collection.
Parameters
Options for retrieving and storing the data.
Returns
[string
, DataType
][]
Defined in
Converts the deserialized data from storage to a JavaScript instance of the collection.
Type Parameters
• DataType
Parameters
The deserialized data to create an instance from.
Returns
Defined in
<DataType
>
.
readonly
_keys: <string
>
readonly
values: <ValueAndIndex
>
• options?: Omit
<<DataType
>, "serializer"
>
• options?: Omit
<<DataType
>, "serializer"
>
• options?: Pick
<<DataType
>, "serializer"
>
• options?: <DataType
>
set_reconstructor(options
?): Omit
<<DataType
>, "serializer"
>
• options?: Omit
<<DataType
>, "serializer"
>
Omit
<<DataType
>, "serializer"
>
.
.
• options?: <DataType
>
static
reconstruct<DataType
>(data
): <DataType
>
• data: <DataType
>
<DataType
>