SymbolDescriptiveString.js 443 B

12345678910111213141516
  1. 'use strict';
  2. var $TypeError = require('es-errors/type');
  3. var callBound = require('call-bind/callBound');
  4. var $SymbolToString = callBound('Symbol.prototype.toString', true);
  5. // https://262.ecma-international.org/6.0/#sec-symboldescriptivestring
  6. module.exports = function SymbolDescriptiveString(sym) {
  7. if (typeof sym !== 'symbol') {
  8. throw new $TypeError('Assertion failed: `sym` must be a Symbol');
  9. }
  10. return $SymbolToString(sym);
  11. };