Sha256: d0e745fc6c805b647eb611064b9dcd7f6a37ca1a2bf37f9a3356ea6a60e6d7f4
Contents?: true
Size: 656 Bytes
Versions: 20
Compression:
Stored size: 656 Bytes
Contents
// 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = require('./$.is-object'); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function(it, S){ if(!isObject(it))return it; var fn, val; if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; throw TypeError("Can't convert object to primitive value"); };
Version data entries
20 entries across 10 versions & 3 rubygems