mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-23 02:23:26 +01:00
21 lines
552 B
JavaScript
21 lines
552 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://262.ecma-international.org/11.0/#sec-tonumeric
|
|
|
|
module.exports = function ToNumeric(argument) {
|
|
var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
|
|
if (Type(primValue) === 'BigInt') {
|
|
return primValue;
|
|
}
|
|
return ToNumber(primValue);
|
|
};
|