webpack-5-chain
Version:
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![CI Status][ci-image]][ci-url]
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;
}
};
};