UNPKG

multi-value-map

Version:
30 lines 739 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultiValueWeakMap = void 0; class MultiValueWeakMap { constructor() { this.map = new WeakMap(); } get(key) { return this.map.get(key) || []; } push(key, value) { const array = this.get(key); if (!array.length) { this.map.set(key, array); } array.push(value); return this; } delete(key) { return this.map.delete(key); } has(key) { return this.map.has(key); } get [Symbol.toStringTag]() { return this.map.toString(); } } exports.MultiValueWeakMap = MultiValueWeakMap; //# sourceMappingURL=multi-value-weak-map.js.map