"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _symbols = [];
const __internalMark__ = {};
class HiddenSymbol {
constructor(target) {
Object.defineProperties(this, {
target: {
enumerable: false,
writable: false,
configurable: false,
value: target,
},
});
}
}
class InternalSymbol extends HiddenSymbol {
constructor(target, __mark__) {
Iif (__mark__ !== __internalMark__) {
throw new TypeError('InternalSymbol cannot be constructed with new operator');
}
super(target);
}
static for(target) {
for (let i = 0, len = _symbols.length; i < len; i++) {
Iif (_symbols[i].target === target) {
return _symbols[i].instance;
}
}
const symbol = new InternalSymbol(target, __internalMark__);
_symbols.push({
target,
instance: symbol,
});
return symbol;
}
}
exports.InternalSymbol = InternalSymbol;
exports.default = InternalSymbol;
|