Sha256: 3b98703c83b9e2d6a8b2b0e097422f5e667ee2d7aefdeb5692cfda6725695c58
Contents?: true
Size: 779 Bytes
Versions: 25
Compression:
Stored size: 779 Bytes
Contents
var isObject = require('../internals/is-object'); // `ToPrimitive` abstract operation // https://tc39.github.io/ecma262/#sec-toprimitive // 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 (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); };
Version data entries
25 entries across 25 versions & 7 rubygems