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.
19 lines
791 B
19 lines
791 B
'use strict';
|
|
var global = require('../internals/global');
|
|
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 = global.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];
|
|
};
|
|
|