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.

ToString.js 402B

123456789101112131415
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var $String = GetIntrinsic('%String%');
  4. var $TypeError = GetIntrinsic('%TypeError%');
  5. // https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
  6. module.exports = function ToString(argument) {
  7. if (typeof argument === 'symbol') {
  8. throw new $TypeError('Cannot convert a Symbol value to a string');
  9. }
  10. return $String(argument);
  11. };