my-idlers/node_modules/es6-symbol/lib/private/setup/symbol-registry.js
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

24 lines
556 B
JavaScript
Vendored

"use strict";
var d = require("d")
, validateSymbol = require("../../../validate-symbol");
var registry = Object.create(null);
module.exports = function (SymbolPolyfill) {
return Object.defineProperties(SymbolPolyfill, {
for: d(function (key) {
if (registry[key]) return registry[key];
return (registry[key] = SymbolPolyfill(String(key)));
}),
keyFor: d(function (symbol) {
var key;
validateSymbol(symbol);
for (key in registry) {
if (registry[key] === symbol) return key;
}
return undefined;
})
});
};