@naturalcycles/js-lib
Version:
Standard library for universal (browser + Node.js) javascript
16 lines (15 loc) • 403 B
TypeScript
/**
* 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>;
toObject(): Record<string, V>;
toJSON(): Record<string, V>;
}