summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/math/trunc/shim.js
blob: 02e2c2ad3bfcf4691d61dcf2f95a19100e52a205 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
'use strict';

var floor = Math.floor;

module.exports = function (x) {
	if (isNaN(x)) return NaN;
	x = Number(x);
	if (x === 0) return x;
	if (x === Infinity) return Infinity;
	if (x === -Infinity) return -Infinity;
	if (x > 0) return floor(x);
	return -floor(-x);
};