PIbd-22.-Stroev-V.M.-Intern.../Lab2/node_modules/es-abstract/2023/KeyForSymbol.js
2023-10-28 00:49:09 +03:00

21 lines
472 B
JavaScript

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var $keyFor = callBound('Symbol.keyFor', true);
var Type = require('./Type');
// https://262.ecma-international.org/14.0/#sec-keyforsymbol
module.exports = function KeyForSymbol(sym) {
if (Type(sym) !== 'Symbol') {
throw new $TypeError('Assertion failed: `sym` must be a Symbol');
}
return $keyFor(sym);
};