@webreflection/dsm
v0.1.0
Published
Map, WeakMap, Set, and WeakSet extends with either `set(key, value)` or `add(value)` that returns the value
Downloads
7
Maintainers
Readme
Direct Set / Map
This module simply exports Map, WeakMap, Set, and WeakSet extends with either set(key, value)
or add(value)
that returns the value itself, instead of the map or set.
import {Map, WeakMap, Set, WeakSet} from '@webreflection/dsm';
const obj = {};
console.assert((new Map).set('key', 1) === 1);
console.assert((new WeakMap).set(obj, 2) === 2);
console.assert((new Set).add(3) === 3);
console.assert((new WeakSet).add(obj) === obj);