2020-08-26 01:57:08 +02:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var callBound = require('call-bind/callBound');
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
var $SymbolToString = callBound('Symbol.prototype.toString', true);
|
|
|
|
|
|
|
|
var Type = require('./Type');
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
// https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
module.exports = function SymbolDescriptiveString(sym) {
|
|
|
|
if (Type(sym) !== 'Symbol') {
|
|
|
|
throw new $TypeError('Assertion failed: `sym` must be a Symbol');
|
|
|
|
}
|
|
|
|
return $SymbolToString(sym);
|
|
|
|
};
|