@grandlinex/react-components
Version:
42 lines (41 loc) • 1.24 kB
TypeScript
/**
* Map extension
*/
export default class CMap<K, V> implements Map<K, V> {
private readonly store;
constructor(arr?: [K, V][]);
private updateSize;
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): this;
size: number;
entries(): IterableIterator<[K, V]>;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
[Symbol.iterator](): IterableIterator<[K, V]>;
[Symbol.toStringTag]: string;
/**
* Return a array based on each element in storage
* @param mapper mapping function
*/
map<T>(mapper: (value: V, key: K) => T): T[];
/**
* Return an array with the values only
*/
toValueArray(): V[];
/**
* Return an array with the keys only
*/
toKeyArray(): K[];
/**
* Delete selected elements from the storage
*/
deleteSelected(selector: (value: V, key: K) => boolean): void;
/**
* Merge another core-map in the existing, duplicated keys in the executing map will be overwritten
*/
merge(map: CMap<K, V>, skipOverwrite?: boolean): this;
}