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

Version Path
immosquare-cleaner-0.1.25 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.25 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.24 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.24 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.23 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.23 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.22 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.22 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.21 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.21 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.20 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.20 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.19 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.19 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.18 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.18 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.17 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.17 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.16 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.16 node_modules/es-abstract/2022/ToIntegerOrInfinity.js