main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
523 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 4 |
|
---|
| 5 | var $Number = GetIntrinsic('%Number%');
|
---|
| 6 |
|
---|
| 7 | var isPrimitive = require('../helpers/isPrimitive');
|
---|
| 8 |
|
---|
| 9 | var ToPrimitive = require('./ToPrimitive');
|
---|
| 10 | var ToNumber = require('./ToNumber');
|
---|
| 11 |
|
---|
| 12 | // https://262.ecma-international.org/11.0/#sec-tonumeric
|
---|
| 13 |
|
---|
| 14 | module.exports = function ToNumeric(argument) {
|
---|
| 15 | var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
|
---|
| 16 | if (typeof primValue === 'bigint') {
|
---|
| 17 | return primValue;
|
---|
| 18 | }
|
---|
| 19 | return ToNumber(primValue);
|
---|
| 20 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.