You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
804 B
20 lines
804 B
4 weeks ago
|
'use strict';
|
||
|
var globalThis = require('../internals/global-this');
|
||
|
var shared = require('../internals/shared');
|
||
|
var hasOwn = require('../internals/has-own-property');
|
||
|
var uid = require('../internals/uid');
|
||
|
var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');
|
||
|
var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
||
|
|
||
|
var Symbol = globalThis.Symbol;
|
||
|
var WellKnownSymbolsStore = shared('wks');
|
||
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
|
||
|
|
||
|
module.exports = function (name) {
|
||
|
if (!hasOwn(WellKnownSymbolsStore, name)) {
|
||
|
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
|
||
|
? Symbol[name]
|
||
|
: createWellKnownSymbol('Symbol.' + name);
|
||
|
} return WellKnownSymbolsStore[name];
|
||
|
};
|