| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | 'use strict'; |
| 2 | |
| 3 | var GetIntrinsic = require('get-intrinsic'); |
| 4 | |
| 5 | var $TypeError = GetIntrinsic('%TypeError%'); |
| 6 | |
| 7 | var callBound = require('call-bind/callBound'); |
| 8 | |
| 9 | var $SymbolToString = callBound('Symbol.prototype.toString', true); |
| 10 | |
| 11 | var Type = require('./Type'); |
| 12 | |
| 13 | // https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring |
| 14 | |
| 15 | module.exports = function SymbolDescriptiveString(sym) { |
| 16 | if (Type(sym) !== 'Symbol') { |
| 17 | throw new $TypeError('Assertion failed: `sym` must be a Symbol'); |
| 18 | } |
| 19 | return $SymbolToString(sym); |
| 20 | }; |