source: imaps-frontend/node_modules/es-abstract/2024/ToIntegerOrInfinity.js

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
Line 
1'use strict';
2
3var ToNumber = require('./ToNumber');
4var truncate = require('./truncate');
5
6var $isNaN = require('../helpers/isNaN');
7var $isFinite = require('../helpers/isFinite');
8
9// https://262.ecma-international.org/14.0/#sec-tointegerorinfinity
10
11module.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.