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.60 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.60 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.59 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.59 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.58 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.58 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.57 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.57 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.56 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.56 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.55 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.55 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.54 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.54 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.53 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.53 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.52 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.52 node_modules/es-abstract/2022/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.51 node_modules/es-abstract/2021/ToIntegerOrInfinity.js
immosquare-cleaner-0.1.51 node_modules/es-abstract/2022/ToIntegerOrInfinity.js