MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / toPrimitive

Function toPrimitive

lib/web/polyfill.js:793–798  ·  view source on GitHub ↗
(it)

Source from the content-addressed store, hash-verified

791 } return +it;
792 }
793 function toPrimitive(it){
794 var fn, val;
795 if(isFunction(fn = it.valueOf) && !isObject(val = fn.call(it)))return val;
796 if(isFunction(fn = it[TO_STRING]) && !isObject(val = fn.call(it)))return val;
797 throw TypeError("Can't convert object to number");
798 }
799 Number = function Number(it){
800 return this instanceof Number ? new _Number(toNumber(it)) : toNumber(it);
801 };

Callers 1

toNumberFunction · 0.85

Calls 3

isFunctionFunction · 0.70
isObjectFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected