aswi2020vldc-gitlab/templetes/node_modules/es-abstract/2017/ToString.js @ 4605a44b
1 | 3a515b92 | cagy | 'use strict'; |
---|---|---|---|
2 | |||
3 | var GetIntrinsic = require('../GetIntrinsic'); |
||
4 | |||
5 | var $String = GetIntrinsic('%String%'); |
||
6 | var $TypeError = GetIntrinsic('%TypeError%'); |
||
7 | |||
8 | // https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
|
||
9 | |||
10 | module.exports = function ToString(argument) { |
||
11 | if (typeof argument === 'symbol') { |
||
12 | throw new $TypeError('Cannot convert a Symbol value to a string'); |
||
13 | }
|
||
14 | return $String(argument); |
||
15 | };
|