Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 821 Bytes

readme.md

File metadata and controls

39 lines (26 loc) · 821 Bytes

deep-weak-map

WeakMap with an array of keys

npm Coverage Status

Example

import DeepWeakMap from 'deep-weak-map';

const [ a, b, c, d ] = [
	randomObject(),
	randomObject(),
	randomObject(),
	randomObject(),
];

const value = randomObject();

const map = new DeepWeakMap();

map.set([ a, b, c ], value);

map.has([ a, b, c ]); // → true
map.has([ a, b, d ]); // → false

map.get([ a, b, c ]); // → value
map.get([ a, b, d ]); // → undefined

map.delete([ a, b, c ]);
map.has([ a, b, c ]); // → false

Install

yarn add deep-weak-map