amis-rpc-design/node_modules/core-js/modules/es.symbol.key-for.js

19 lines
754 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
'use strict';
var $ = require('../internals/export');
var hasOwn = require('../internals/has-own-property');
var isSymbol = require('../internals/is-symbol');
var tryToString = require('../internals/try-to-string');
var shared = require('../internals/shared');
var NATIVE_SYMBOL_REGISTRY = require('../internals/symbol-registry-detection');
var SymbolToStringRegistry = shared('symbol-to-string-registry');
// `Symbol.keyFor` method
// https://tc39.es/ecma262/#sec-symbol.keyfor
$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
keyFor: function keyFor(sym) {
if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
}
});