dope2/lib/util/defaultmap.js

18 lines
445 B
JavaScript

// export class DefaultMap {
// constructor(defaultValue, ...rest) {
// this.defaultValue = defaultValue;
// this.m = new Map(rest);
// }
// getdefault(key, addToMapping = false) {
// return this.m.get(key) || (() => {
// const val = this.defaultValue(key);
// if (addToMapping)
// this.m.set(key, val);
// return val;
// })();
// }
// entries() {
// return this.m.entries();
// }
// }