Files
jackbeeby b412dfe2ca Initialisation
Added the packages and files for the backend server
2024-12-15 17:48:45 +11:00

18 lines
384 B
JavaScript

/**
* ES6 Map with additional `add` method to accumulate items.
*/
export class AccumulatorMap extends Map {
get [Symbol.toStringTag]() {
return 'AccumulatorMap';
}
add(key, item) {
const group = this.get(key);
if (group === undefined) {
this.set(key, [item]);
}
else {
group.push(item);
}
}
}