UNPKG

@itwin/core-bentley

Version:

Bentley JavaScript core components

37 lines 1.48 kB
/** @packageDocumentation * @module Collections */ /** A map similar to the standard JavaScript Map collection except that the keys must be a tuple * (javascript array), and two keys are considered equal if their elements in order are strict-equal, * and the tuples have the same amount of elements * * This means you can use array literals to key data in Maps that would otherwise be reference-compared * if using JavaScript's built in Map * * Note that JavaScript's Map type, unlike this one that uses strict equality, uses instead * SameValueZero equality comparison * @see https://262.ecma-international.org/6.0/#sec-samevaluezero * * ```js * const map = new TupleKeyedMap([[1,"y"], "value"]); * const value = map.get([1, "y"]); // a normal map would identify these keys as different because they are independent objects * ``` * * It is implemented by each index of the tuple key being used as a singular key into a submap * @note this only implements a subset of the Map interface * @public */ export declare class TupleKeyedMap<K extends readonly any[], V> { private _map; constructor(entries?: readonly (readonly [K, V])[] | null); clear(): void; private makeKeyError; get(key: K): V | undefined; has(key: K): boolean; set(key: K, value: V): this; [Symbol.iterator](): IterableIterator<[K, V]>; private _size; get size(): number; get [Symbol.toStringTag](): string; } //# sourceMappingURL=TupleKeyedMap.d.ts.map