Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
846 bytes
|
Line | |
---|
1 | var global = require('../internals/global');
|
---|
2 | var shared = require('../internals/shared');
|
---|
3 | var has = require('../internals/has');
|
---|
4 | var uid = require('../internals/uid');
|
---|
5 | var NATIVE_SYMBOL = require('../internals/native-symbol');
|
---|
6 | var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
---|
7 |
|
---|
8 | var WellKnownSymbolsStore = shared('wks');
|
---|
9 | var Symbol = global.Symbol;
|
---|
10 | var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
|
---|
11 |
|
---|
12 | module.exports = function (name) {
|
---|
13 | if (!has(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
|
---|
14 | if (NATIVE_SYMBOL && has(Symbol, name)) {
|
---|
15 | WellKnownSymbolsStore[name] = Symbol[name];
|
---|
16 | } else {
|
---|
17 | WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
|
---|
18 | }
|
---|
19 | } return WellKnownSymbolsStore[name];
|
---|
20 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.