rspack-chain
Version:
<p> <a href="https://npmjs.com/package/rspack-chain?activeTab=readme"> <img src="https://img.shields.io/npm/v/rspack-chain?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" /> </a> <a href="https://nodejs.org/en/about/previous-rele
42 lines (36 loc) • 754 B
JavaScript
module.exports = function createValue(superClass) {
return class extends superClass {
constructor(...args) {
super(...args);
this.value = undefined;
this.useMap = true;
}
set(...args) {
this.useMap = true;
this.value = undefined;
return super.set(...args);
}
clear() {
this.value = undefined;
return super.clear();
}
classCall(value) {
this.clear();
this.useMap = false;
this.value = value;
return this.parent;
}
entries() {
if (this.useMap) {
return super.entries();
}
return this.value;
}
values() {
if (this.useMap) {
return super.values();
}
return this.value;
}
};
};