UNPKG

@naturalcycles/js-lib

Version:

Standard library for universal (browser + Node.js) javascript

21 lines (20 loc) 538 B
/** * Like Map, but serializes to JSON as an object. * * Fixes the "issue" of stock Map being json-serialized as `{}`. * * @experimental */ export declare class Map2<K = any, V = any> extends Map<K, V> { /** * Convenience way to create Map2 from object. */ static of<V>(obj: Record<any, V>): Map2<string, V>; /** * Allows to set multiple key-value pairs at once. */ setMany(obj: Record<any, V>): this; toObject(): Record<string, V>; toJSON(): Record<string, V>; toString(): string; }