source: trip-planner-front/node_modules/core-js/internals/ordinary-to-primitive.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 601 bytes
Line 
1var isObject = require('../internals/is-object');
2
3// `OrdinaryToPrimitive` abstract operation
4// https://tc39.es/ecma262/#sec-ordinarytoprimitive
5module.exports = function (input, pref) {
6 var fn, val;
7 if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
8 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
9 if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
10 throw TypeError("Can't convert object to primitive value");
11};
Note: See TracBrowser for help on using the repository browser.