mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-01 20:05:21 +01:00
22 lines
555 B
JavaScript
22 lines
555 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var GetIntrinsic = require('get-intrinsic');
|
||
|
|
||
|
var $Number = GetIntrinsic('%Number%');
|
||
|
|
||
|
var isPrimitive = require('../helpers/isPrimitive');
|
||
|
|
||
|
var ToPrimitive = require('./ToPrimitive');
|
||
|
var ToNumber = require('./ToNumber');
|
||
|
var Type = require('./Type');
|
||
|
|
||
|
// https://ecma-international.org/ecma-262/6.0/#sec-tonumber
|
||
|
|
||
|
module.exports = function ToNumeric(argument) {
|
||
|
var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
|
||
|
if (Type(primValue) === 'BigInt') {
|
||
|
return primValue;
|
||
|
}
|
||
|
return ToNumber(primValue);
|
||
|
};
|