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:
758 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var hasOwn = require('../internals/has-own-property');
|
---|
4 | var isSymbol = require('../internals/is-symbol');
|
---|
5 | var tryToString = require('../internals/try-to-string');
|
---|
6 | var shared = require('../internals/shared');
|
---|
7 | var NATIVE_SYMBOL_REGISTRY = require('../internals/symbol-registry-detection');
|
---|
8 |
|
---|
9 | var SymbolToStringRegistry = shared('symbol-to-string-registry');
|
---|
10 |
|
---|
11 | // `Symbol.keyFor` method
|
---|
12 | // https://tc39.es/ecma262/#sec-symbol.keyfor
|
---|
13 | $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
|
---|
14 | keyFor: function keyFor(sym) {
|
---|
15 | if (!isSymbol(sym)) throw new TypeError(tryToString(sym) + ' is not a symbol');
|
---|
16 | if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
|
---|
17 | }
|
---|
18 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.