wrangler-action/node_modules/es-abstract/2023/KeyForSymbol.js
2023-08-07 15:11:15 -05:00

20 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);
};