Sha256: 7be2bb82804e344daa0f7a63b150c836ceef366888e635da8792b33d9d558fef
Contents?: true
Size: 600 Bytes
Versions: 100
Compression:
Stored size: 600 Bytes
Contents
'use strict'; var abs = require('./abs'); var floor = require('./floor'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); // https://262.ecma-international.org/12.0/#sec-tointegerorinfinity module.exports = function ToIntegerOrInfinity(value) { var number = ToNumber(value); if ($isNaN(number) || number === 0) { return 0; } if (!$isFinite(number)) { return number; } var integer = floor(abs(number)); if (integer === 0) { return 0; } return $sign(number) * integer; };
Version data entries
100 entries across 50 versions & 2 rubygems