You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SymbolDescriptiveString.js 533B

1234567891011121314151617181920
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var callBound = require('../helpers/callBound');
  5. var $SymbolToString = callBound('Symbol.prototype.toString', true);
  6. var Type = require('./Type');
  7. // https://www.ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring
  8. module.exports = function SymbolDescriptiveString(sym) {
  9. if (Type(sym) !== 'Symbol') {
  10. throw new $TypeError('Assertion failed: `sym` must be a Symbol');
  11. }
  12. return $SymbolToString(sym);
  13. };