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:
514 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var abs = require('./abs');
|
---|
4 | var floor = require('./floor');
|
---|
5 | var ToNumber = require('./ToNumber');
|
---|
6 |
|
---|
7 | var $isNaN = require('../helpers/isNaN');
|
---|
8 | var $isFinite = require('../helpers/isFinite');
|
---|
9 | var $sign = require('../helpers/sign');
|
---|
10 |
|
---|
11 | // http://262.ecma-international.org/5.1/#sec-9.4
|
---|
12 |
|
---|
13 | module.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.