diff --git a/index.html b/index.html new file mode 100644 index 0000000..17270ac --- /dev/null +++ b/index.html @@ -0,0 +1,46 @@ + + +
+ +[[ 1, 'one' ],[ 2, 'two' ]]
). Each key-value pair is added\n * to the new CborMap; null values are treated as undefined.\n */\n constructor(iterable) {\n super(iterable)\n }\n\n /**\n * @ignore\n */\n static _encode(key) {\n return encoder.encodeCanonical(key).toString('base64')\n }\n\n /**\n * @ignore\n */\n static _decode(key) {\n return decoder.decodeFirstSync(key, 'base64')\n }\n\n /**\n * Retrieve a specified element.\n *\n * @param {any} key The key identifying the element to retrieve.\n * Can be any type, which will be serialized into CBOR and compared by\n * value.\n * @returns {any} The element if it exists, or undefined
.\n */\n get(key) {\n return super.get(CborMap._encode(key))\n }\n\n /**\n * Adds or updates an element with a specified key and value.\n *\n * @param {any} key The key identifying the element to store.\n * Can be any type, which will be serialized into CBOR and compared by\n * value.\n * @param {any} val The element to store.\n * @returns {this} This object.\n */\n set(key, val) {\n return super.set(CborMap._encode(key), val)\n }\n\n /**\n * Removes the specified element.\n *\n * @param {any} key The key identifying the element to delete. Can be any\n * type, which will be serialized into CBOR and compared by value.\n * @returns {boolean} True if an element in the Map object existed and has\n * been removed, or false if the element does not exist.\n */\n delete(key) {\n return super.delete(CborMap._encode(key))\n }\n\n /**\n * Does an element with the specified key exist?\n *\n * @param {any} key The key identifying the element to check.\n * Can be any type, which will be serialized into CBOR and compared by\n * value.\n * @returns {boolean} True if an element with the specified key exists in\n * the Map object; otherwise false.\n */\n has(key) {\n return super.has(CborMap._encode(key))\n }\n\n /**\n * Returns a new Iterator object that contains the keys for each element\n * in the Map object in insertion order. The keys are decoded into their\n * original format.\n *\n * @yields {any} The keys of the map.\n */\n *keys() {\n for (const k of super.keys()) {\n yield CborMap._decode(k)\n }\n }\n\n /* eslint-disable jsdoc/require-returns-check */\n /**\n * Returns a new Iterator object that contains the [key, value] pairs for\n * each element in the Map object in insertion order.\n *\n * @yields {any[]} Key value pairs.\n * @returns {IterableIterator