web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
550 B

  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $Number = GetIntrinsic('%Number%');
  4. var isPrimitive = require('../helpers/isPrimitive');
  5. var ToPrimitive = require('./ToPrimitive');
  6. var ToNumber = require('./ToNumber');
  7. var Type = require('./Type');
  8. // https://262.ecma-international.org/6.0/#sec-tonumber
  9. module.exports = function ToNumeric(argument) {
  10. var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
  11. if (Type(primValue) === 'BigInt') {
  12. return primValue;
  13. }
  14. return ToNumber(primValue);
  15. };