@glimmer/util
Version:
Common utilities used in Glimmer
21 lines (16 loc) • 1.64 kB
JavaScript
export default typeof WeakSet === 'function' ? WeakSet : class WeakSetPolyFill {
constructor() {
this._map = new WeakMap();
}
add(val) {
this._map.set(val, true);
return this;
}
delete(val) {
return this._map.delete(val);
}
has(val) {
return this._map.has(val);
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3V0aWwvbGliL3dlYWstc2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQWdCLE9BQU8sT0FBUCxLQUFtQixVQUFuQixHQUNaLE9BRFksR0FFWixNQUFNLGVBQU4sQ0FBcUI7QUFBckIsRUFBQSxXQUFBLEdBQUE7QUFDVSxTQUFBLElBQUEsR0FBTyxJQUFJLE9BQUosRUFBUDtBQWNUOztBQVpDLEVBQUEsR0FBRyxDQUFDLEdBQUQsRUFBTztBQUNSLFNBQUssSUFBTCxDQUFVLEdBQVYsQ0FBYyxHQUFkLEVBQW1CLElBQW5COztBQUNBLFdBQU8sSUFBUDtBQUNEOztBQUVELEVBQUEsTUFBTSxDQUFDLEdBQUQsRUFBTztBQUNYLFdBQU8sS0FBSyxJQUFMLENBQVUsTUFBVixDQUFpQixHQUFqQixDQUFQO0FBQ0Q7O0FBRUQsRUFBQSxHQUFHLENBQUMsR0FBRCxFQUFPO0FBQ1IsV0FBTyxLQUFLLElBQUwsQ0FBVSxHQUFWLENBQWMsR0FBZCxDQUFQO0FBQ0Q7O0FBZGtCLENBRnpCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgKHR5cGVvZiBXZWFrU2V0ID09PSAnZnVuY3Rpb24nXG4gID8gV2Vha1NldFxuICA6IGNsYXNzIFdlYWtTZXRQb2x5RmlsbDxUIGV4dGVuZHMgb2JqZWN0PiB7XG4gICAgICBwcml2YXRl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