webhook-action/node_modules/es-abstract/2020/ToNumeric.js

21 lines
523 B
JavaScript
Raw Normal View History

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $Number = GetIntrinsic('%Number%');
var isPrimitive = require('../helpers/isPrimitive');
var ToPrimitive = require('./ToPrimitive');
var ToNumber = require('./ToNumber');
2024-03-28 02:00:41 +00:00
// https://262.ecma-international.org/11.0/#sec-tonumeric
module.exports = function ToNumeric(argument) {
var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
2024-03-28 02:00:41 +00:00
if (typeof primValue === 'bigint') {
return primValue;
}
return ToNumber(primValue);
};