UNPKG

528 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.AccumulatorMap = void 0;
4/**
5 * ES6 Map with additional `add` method to accumulate items.
6 */
7class AccumulatorMap extends Map {
8 get [Symbol.toStringTag]() {
9 return 'AccumulatorMap';
10 }
11 add(key, item) {
12 const group = this.get(key);
13 if (group === undefined) {
14 this.set(key, [item]);
15 }
16 else {
17 group.push(item);
18 }
19 }
20}
21exports.AccumulatorMap = AccumulatorMap;