MCPcopy Index your code
hub / github.com/nodejs/node / toString

Function toString

lib/internal/webidl.js:294–310  ·  view source on GitHub ↗

* Returns ToString(V). * @see https://tc39.es/ecma262/#sec-tostring * @param {any} V JavaScript value. * @param {ConversionOptions} [options] Conversion options. * @returns {string}

(V, options = kEmptyObject)

Source from the content-addressed store, hash-verified

292 * @returns {string}
293 */
294function toString(V, options = kEmptyObject) {
295 if (typeof V === 'symbol') {
296 // ECMA-262 ToString step 2: Symbol values throw.
297 throw makeException(
298 'is a Symbol and cannot be converted to a string.',
299 options);
300 }
301
302 // The String function performs ToString for all non-Symbol primitives and
303 // objects, including ToPrimitive(V, string). String concatenation is not
304 // equivalent because it uses ToPrimitive(V, default). Abrupt completions
305 // and native TypeErrors propagate unchanged. This is an intentional
306 // diagnostics tradeoff: decorating object conversion failures would require
307 // maintaining local ECMA-262 ToPrimitive and OrdinaryToPrimitive
308 // implementations.
309 return String(V);
310}
311
312/**
313 * Converts a JavaScript value to a Web IDL integer value.

Callers 2

webidl.jsFile · 0.70
createEnumConverterFunction · 0.70

Calls 2

makeExceptionFunction · 0.85
StringClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…