main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
919 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var getBuiltIn = require('../internals/get-built-in');
|
---|
4 | var hasOwn = require('../internals/has-own-property');
|
---|
5 | var toString = require('../internals/to-string');
|
---|
6 | var shared = require('../internals/shared');
|
---|
7 | var NATIVE_SYMBOL_REGISTRY = require('../internals/symbol-registry-detection');
|
---|
8 |
|
---|
9 | var StringToSymbolRegistry = shared('string-to-symbol-registry');
|
---|
10 | var SymbolToStringRegistry = shared('symbol-to-string-registry');
|
---|
11 |
|
---|
12 | // `Symbol.for` method
|
---|
13 | // https://tc39.es/ecma262/#sec-symbol.for
|
---|
14 | $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
|
---|
15 | 'for': function (key) {
|
---|
16 | var string = toString(key);
|
---|
17 | if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
|
---|
18 | var symbol = getBuiltIn('Symbol')(string);
|
---|
19 | StringToSymbolRegistry[string] = symbol;
|
---|
20 | SymbolToStringRegistry[symbol] = string;
|
---|
21 | return symbol;
|
---|
22 | }
|
---|
23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.