igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
25 lines • 652 B
JavaScript
class DefaultMap extends Map {
get [Symbol.toStringTag]() {
return 'DefaultMap';
}
constructor(entries, factoryFn) {
super(entries);
this._factoryFn = factoryFn ?? (() => new Map());
}
getOrCreate(key) {
if (!this.has(key)) {
this.set(key, this._factoryFn());
}
return this.get(key);
}
toPlainMap() {
return new Map(this.entries());
}
}
export function createDefaultMap(entries, factoryFn) {
return new DefaultMap(entries, factoryFn);
}
export function createIconDefaultMap() {
return new DefaultMap();
}
//# sourceMappingURL=default-map.js.map