MCPcopy Create free account
hub / github.com/codrops/RainEffect / toPrimitive

Function toPrimitive

demo/js/index.js:2394–2399  ·  view source on GitHub ↗
(it)

Source from the content-addressed store, hash-verified

2392 // Opera ~12 has broken Object#toString
2393 , BROKEN_COF = cof($.create(proto)) == NUMBER;
2394var toPrimitive = function(it){
2395 var fn, val;
2396 if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
2397 if(typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
2398 throw TypeError("Can't convert object to number");
2399};
2400var toNumber = function(it){
2401 if(isObject(it))it = toPrimitive(it);
2402 if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){

Callers 1

toNumberFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected