source: imaps-frontend/node_modules/es-abstract/5/ToInteger.js@ 79a0317

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: 557 bytes
RevLine 
[d565449]1'use strict';
2
3var ToNumber = require('./ToNumber');
4
[79a0317]5var abs = require('math-intrinsics/abs');
6var floor = require('math-intrinsics/floor');
7var $isNaN = require('math-intrinsics/isNaN');
8var $isFinite = require('math-intrinsics/isFinite');
9var $sign = require('math-intrinsics/sign');
[d565449]10
11// http://262.ecma-international.org/5.1/#sec-9.4
12
13module.exports = function ToInteger(value) {
14 var number = ToNumber(value);
15 if ($isNaN(number)) { return 0; }
16 if (number === 0 || !$isFinite(number)) { return number; }
17 return $sign(number) * floor(abs(number));
18};
Note: See TracBrowser for help on using the repository browser.