Bump the npm group with 2 updates (#1819)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.45.0 to 8.46.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0) Updates `eslint-plugin-import` from 2.27.5 to 2.28.0 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a6b0ced86b
commit
e7e35baaf0
1408 changed files with 27215 additions and 9910 deletions
136
node_modules/es-abstract/2017/NumberToRawBytes.js
generated
vendored
136
node_modules/es-abstract/2017/NumberToRawBytes.js
generated
vendored
|
|
@ -2,23 +2,8 @@
|
|||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $floor = GetIntrinsic('%Math.floor%');
|
||||
var $log = GetIntrinsic('%Math.log%');
|
||||
var $log2E = GetIntrinsic('%Math.LOG2E%');
|
||||
var $log2 = GetIntrinsic('%Math.log2%', true) || function log2(x) {
|
||||
return $log(x) * $log2E;
|
||||
};
|
||||
var $parseInt = GetIntrinsic('%parseInt%');
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $reverse = callBound('Array.prototype.reverse');
|
||||
var $numberToString = callBound('Number.prototype.toString');
|
||||
var $strSlice = callBound('String.prototype.slice');
|
||||
|
||||
var abs = require('./abs');
|
||||
var hasOwnProperty = require('./HasOwnProperty');
|
||||
var ToInt16 = require('./ToInt16');
|
||||
var ToInt32 = require('./ToInt32');
|
||||
|
|
@ -29,8 +14,9 @@ var ToUint8 = require('./ToUint8');
|
|||
var ToUint8Clamp = require('./ToUint8Clamp');
|
||||
var Type = require('./Type');
|
||||
|
||||
var isNaN = require('../helpers/isNaN');
|
||||
var isFinite = require('../helpers/isFinite');
|
||||
var valueToFloat32Bytes = require('../helpers/valueToFloat32Bytes');
|
||||
var valueToFloat64Bytes = require('../helpers/valueToFloat64Bytes');
|
||||
var integerToNBytes = require('../helpers/integerToNBytes');
|
||||
|
||||
var keys = require('object-keys');
|
||||
|
||||
|
|
@ -72,105 +58,10 @@ module.exports = function NumberToRawBytes(type, value, isLittleEndian) {
|
|||
throw new $TypeError('Assertion failed: `isLittleEndian` must be a Boolean');
|
||||
}
|
||||
|
||||
var rawBytes = [];
|
||||
var exponent;
|
||||
|
||||
if (type === 'Float32') { // step 1
|
||||
if (isNaN(value)) {
|
||||
return isLittleEndian ? [0, 0, 192, 127] : [127, 192, 0, 0]; // hardcoded
|
||||
}
|
||||
|
||||
var leastSig;
|
||||
|
||||
if (value === 0) {
|
||||
leastSig = Object.is(value, -0) ? 0x80 : 0;
|
||||
return isLittleEndian ? [0, 0, 0, leastSig] : [leastSig, 0, 0, 0];
|
||||
}
|
||||
|
||||
if (!isFinite(value)) {
|
||||
leastSig = value < 0 ? 255 : 127;
|
||||
return isLittleEndian ? [0, 0, 128, leastSig] : [leastSig, 128, 0, 0];
|
||||
}
|
||||
|
||||
var sign = value < 0 ? 1 : 0;
|
||||
value = abs(value); // eslint-disable-line no-param-reassign
|
||||
|
||||
exponent = 0;
|
||||
while (value >= 2) {
|
||||
exponent += 1;
|
||||
value /= 2; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
while (value < 1) {
|
||||
exponent -= 1;
|
||||
value *= 2; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
var mantissa = value - 1;
|
||||
mantissa *= $pow(2, 23);
|
||||
mantissa = $floor(mantissa);
|
||||
|
||||
exponent += 127;
|
||||
exponent = exponent << 23;
|
||||
|
||||
var result = sign << 31;
|
||||
result |= exponent;
|
||||
result |= mantissa;
|
||||
|
||||
var byte0 = result & 255;
|
||||
result = result >> 8;
|
||||
var byte1 = result & 255;
|
||||
result = result >> 8;
|
||||
var byte2 = result & 255;
|
||||
result = result >> 8;
|
||||
var byte3 = result & 255;
|
||||
|
||||
if (isLittleEndian) {
|
||||
return [byte0, byte1, byte2, byte3];
|
||||
}
|
||||
return [byte3, byte2, byte1, byte0];
|
||||
return valueToFloat32Bytes(value, isLittleEndian);
|
||||
} else if (type === 'Float64') { // step 2
|
||||
if (value === 0) {
|
||||
leastSig = Object.is(value, -0) ? 0x80 : 0;
|
||||
return isLittleEndian ? [0, 0, 0, 0, 0, 0, 0, leastSig] : [leastSig, 0, 0, 0, 0, 0, 0, 0];
|
||||
}
|
||||
if (isNaN(value)) {
|
||||
return isLittleEndian ? [0, 0, 0, 0, 0, 0, 248, 127] : [127, 248, 0, 0, 0, 0, 0, 0];
|
||||
}
|
||||
if (!isFinite(value)) {
|
||||
var infBytes = value < 0 ? [0, 0, 0, 0, 0, 0, 240, 255] : [0, 0, 0, 0, 0, 0, 240, 127];
|
||||
return isLittleEndian ? infBytes : $reverse(infBytes);
|
||||
}
|
||||
|
||||
var isNegative = value < 0;
|
||||
if (isNegative) { value = -value; } // eslint-disable-line no-param-reassign
|
||||
|
||||
exponent = $floor($log2(value));
|
||||
var significand = (value / $pow(2, exponent)) - 1;
|
||||
|
||||
var bitString = '';
|
||||
for (var i = 0; i < 52; i++) {
|
||||
significand *= 2;
|
||||
if (significand >= 1) {
|
||||
bitString += '1';
|
||||
significand -= 1;
|
||||
} else {
|
||||
bitString += '0';
|
||||
}
|
||||
}
|
||||
|
||||
exponent += 1023;
|
||||
var exponentBits = $numberToString(exponent, 2);
|
||||
while (exponentBits.length < 11) { exponentBits = '0' + exponentBits; }
|
||||
|
||||
var fullBitString = (isNegative ? '1' : '0') + exponentBits + bitString;
|
||||
while (fullBitString.length < 64) { fullBitString = '0' + fullBitString; }
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
rawBytes[i] = $parseInt($strSlice(fullBitString, i * 8, (i + 1) * 8), 2);
|
||||
}
|
||||
|
||||
return isLittleEndian ? $reverse(rawBytes) : rawBytes;
|
||||
return valueToFloat64Bytes(value, isLittleEndian);
|
||||
} // step 3
|
||||
|
||||
var n = TypeToSizes[type]; // step 3.a
|
||||
|
|
@ -179,20 +70,5 @@ module.exports = function NumberToRawBytes(type, value, isLittleEndian) {
|
|||
|
||||
var intValue = convOp(value); // step 3.c
|
||||
|
||||
/*
|
||||
if (intValue >= 0) { // step 3.d
|
||||
// Let rawBytes be a List containing the n-byte binary encoding of intValue. If isLittleEndian is false, the bytes are ordered in big endian order. Otherwise, the bytes are ordered in little endian order.
|
||||
} else { // step 3.e
|
||||
// Let rawBytes be a List containing the n-byte binary 2's complement encoding of intValue. If isLittleEndian is false, the bytes are ordered in big endian order. Otherwise, the bytes are ordered in little endian order.
|
||||
}
|
||||
*/
|
||||
if (intValue < 0) {
|
||||
intValue = intValue >>> 0;
|
||||
}
|
||||
for (i = 0; i < n; i++) {
|
||||
rawBytes[isLittleEndian ? i : n - 1 - i] = intValue & 0xff;
|
||||
intValue = intValue >> 8;
|
||||
}
|
||||
|
||||
return rawBytes; // step 4
|
||||
return integerToNBytes(intValue, n, isLittleEndian); // step 3.d, 3.e, 4
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue