UNPKG

@ayonli/jsext

Version:

A JavaScript extension package for building strong and modern applications.

30 lines (29 loc) 880 B
/** * Case-insensitive map, keys are case-insensitive. * * @example * ```ts * import { CiMap } from "@ayonli/jsext/collections"; * * const map = new CiMap<string, string>(); * * map.set("foo", "hello"); * map.set("bar", "world"); * * console.log(map.get("FOO")); // hello * console.log(map.has("BAR")); // true * ``` */ export default class CiMap<K extends string, V> extends Map<K, any> { get [Symbol.toStringTag](): "CiMap"; constructor(iterable?: Iterable<readonly [K, V]> | null); set(key: K, value: V): this; get(key: K): V | undefined; has(key: K): boolean; delete(key: K): boolean; entries(): IterableIterator<[K, V]>; keys(): IterableIterator<K>; values(): IterableIterator<V>; forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void; [Symbol.iterator](): IterableIterator<[K, V]>; }