main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
472 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var ToNumber = require('./ToNumber');
|
---|
| 4 | var truncate = require('./truncate');
|
---|
| 5 |
|
---|
[79a0317] | 6 | var $isNaN = require('math-intrinsics/isNaN');
|
---|
| 7 | var $isFinite = require('math-intrinsics/isFinite');
|
---|
[d565449] | 8 |
|
---|
| 9 | // https://262.ecma-international.org/14.0/#sec-tointegerorinfinity
|
---|
| 10 |
|
---|
| 11 | module.exports = function ToIntegerOrInfinity(value) {
|
---|
| 12 | var number = ToNumber(value);
|
---|
| 13 | if ($isNaN(number) || number === 0) { return 0; }
|
---|
| 14 | if (!$isFinite(number)) { return number; }
|
---|
| 15 | return truncate(number);
|
---|
| 16 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.