blob: 16b4ccf893640ee9162ff07ad484038311e6210d [file] [log] [blame]
Tim van der Lippefdbd42e2020-04-07 14:14:361'use strict';
2
Tim van der Lippe2c891972021-07-29 15:22:503var GetIntrinsic = require('get-intrinsic');
Tim van der Lippefdbd42e2020-04-07 14:14:364
5var $String = GetIntrinsic('%String%');
Nikolay Vitkovd76576c2024-12-02 14:10:156var $TypeError = require('es-errors/type');
Tim van der Lippefdbd42e2020-04-07 14:14:367
Nikolay Vitkovd76576c2024-12-02 14:10:158// https://262.ecma-international.org/6.0/#sec-tostring
Tim van der Lippefdbd42e2020-04-07 14:14:369
10module.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};