PIbd-22.-Stroev-V.M.-Intern.../Lab2/node_modules/es-abstract/2022/ToString.js
2023-10-28 00:49:09 +03:00

16 lines
391 B
JavaScript

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $String = GetIntrinsic('%String%');
var $TypeError = GetIntrinsic('%TypeError%');
// https://262.ecma-international.org/6.0/#sec-tostring
module.exports = function ToString(argument) {
if (typeof argument === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a string');
}
return $String(argument);
};