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:
462 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var ToNumber = require('./ToNumber');
|
---|
| 4 | var truncate = require('./truncate');
|
---|
| 5 |
|
---|
| 6 | var $isNaN = require('../helpers/isNaN');
|
---|
| 7 | var $isFinite = require('../helpers/isFinite');
|
---|
| 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.