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.40 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.40 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.39 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.39 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.38 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.38 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.29 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.29 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.28 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.28 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.27 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.27 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.26 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.26 node_modules/es-abstract/2022/ToIntegerOrInfinity.js