@webreflection/dsm

0.1.0 • Public • Published

Direct Set / Map

build status Coverage Status

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);

Package Sidebar

Install

npm i @webreflection/dsm

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

4.41 kB

Total Files

7

Last publish

Collaborators

  • webreflection