MCPcopy
hub / github.com/TheAlgorithms/JavaScript / toString

Function toString

Sorts/IntroSort.js:48–56  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

46 * @returns {String} String representation of given object
47 */
48 const toString = function (obj) {
49 if (obj === null) return 'null'
50 if (typeof obj === 'boolean' || typeof obj === 'number') {
51 return obj.toString()
52 }
53 if (typeof obj === 'string') return obj
54 if (typeof obj === 'symbol') throw new TypeError()
55 return obj.toString()
56 }
57 /**
58 * Checks if the value passed is an array
59 * or not

Callers 1

defaultComparatorFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected