new CborMap(args)
Creates an instance of CborMap.
Parameters:
Name | Type | Description |
---|---|---|
args |
Iterable.<Array.<any, any>>
|
An Array or other iterable object
whose elements are key-value pairs (arrays with two elements, e.g.
[[ 1, 'one' ],[ 2, 'two' ]] ). Each key-value pair is added
to the new CborMap; null values are treated as undefined.
|
Methods
delete(key) → {boolean}
Removes the specified element.
Parameters:
Name | Type | Description |
---|---|---|
key |
any
|
The key identifying the element to delete. Can be any type, which will be serialized into CBOR and compared by value. |
Returns:
- Type:
-
boolean
encodeCBOR(gen) → {boolean}
Push the simple value onto the CBOR stream
Parameters:
Name | Type | Description |
---|---|---|
gen |
cbor.Encoder
|
The generator to push onto |
Returns:
- Type:
-
boolean
true on success
(generator) entries() → {Iterator.<Array.<any, any>>}
Returns a new Iterator object that contains the [key, value] pairs for
each element in the Map object in insertion order.
Returns:
- Type:
-
Iterator.<Array.<any, any>>
forEach(fun, thisArg)
Executes a provided function once per each key/value pair in the Map
object, in insertion order.
Parameters:
Name | Type | Description |
---|---|---|
fun |
function
|
Function to execute for each element, which takes a value, a key, and the Map being traversed. |
thisArg |
any
|
Value to use as this when executing callback |
get(key) → {any}
Retrieve a specified element.
Parameters:
Name | Type | Description |
---|---|---|
key |
any
|
The key identifying the element to retrieve. Can be any type, which will be serialized into CBOR and compared by value. |
Returns:
- Type:
-
any
The element if it exists, or
undefined
.
has(key) → {boolean}
Does an element with the specified key exist?
Parameters:
Name | Type | Description |
---|---|---|
key |
any
|
The key identifying the element to check. Can be any type, which will be serialized into CBOR and compared by value. |
Returns:
- Type:
-
boolean
(generator) keys() → {Iterator.<any>}
Returns a new Iterator object that contains the keys for each element
in the Map object in insertion order. The keys are decoded into their
original format.
Returns:
- Type:
-
Iterator.<any>