Initial commit
This commit is contained in:
53
node_modules/es-abstract/helpers/DefineOwnProperty.js
generated
vendored
Normal file
53
node_modules/es-abstract/helpers/DefineOwnProperty.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var hasPropertyDescriptors = require('has-property-descriptors');
|
||||
|
||||
var $defineProperty = require('es-define-property');
|
||||
|
||||
var hasArrayLengthDefineBug = hasPropertyDescriptors.hasArrayLengthDefineBug();
|
||||
|
||||
// eslint-disable-next-line global-require
|
||||
var isArray = hasArrayLengthDefineBug && require('../helpers/IsArray');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
|
||||
if (!$defineProperty) {
|
||||
if (!IsDataDescriptor(desc)) {
|
||||
// ES3 does not support getters/setters
|
||||
return false;
|
||||
}
|
||||
if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// fallback for ES3
|
||||
if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
|
||||
// a non-enumerable existing property
|
||||
return false;
|
||||
}
|
||||
|
||||
// property does not exist at all, or exists but is enumerable
|
||||
var V = desc['[[Value]]'];
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
O[P] = V; // will use [[Define]]
|
||||
return SameValue(O[P], V);
|
||||
}
|
||||
if (
|
||||
hasArrayLengthDefineBug
|
||||
&& P === 'length'
|
||||
&& '[[Value]]' in desc
|
||||
&& isArray(O)
|
||||
&& O.length !== desc['[[Value]]']
|
||||
) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
O.length = desc['[[Value]]'];
|
||||
return O.length === desc['[[Value]]'];
|
||||
}
|
||||
|
||||
$defineProperty(O, P, FromPropertyDescriptor(desc));
|
||||
return true;
|
||||
};
|
12
node_modules/es-abstract/helpers/IsArray.js
generated
vendored
Normal file
12
node_modules/es-abstract/helpers/IsArray.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $Array = GetIntrinsic('%Array%');
|
||||
|
||||
// eslint-disable-next-line global-require
|
||||
var toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString');
|
||||
|
||||
module.exports = $Array.isArray || function IsArray(argument) {
|
||||
return toStr(argument) === '[object Array]';
|
||||
};
|
22
node_modules/es-abstract/helpers/OwnPropertyKeys.js
generated
vendored
Normal file
22
node_modules/es-abstract/helpers/OwnPropertyKeys.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var callBind = require('call-bind');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true);
|
||||
var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%'));
|
||||
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
||||
var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
|
||||
var $gOPS = $SymbolValueOf ? GetIntrinsic('%Object.getOwnPropertySymbols%') : null;
|
||||
|
||||
var keys = require('object-keys');
|
||||
|
||||
module.exports = $ownKeys || function OwnPropertyKeys(source) {
|
||||
var ownKeys = ($gOPN || keys)(source);
|
||||
if ($gOPS) {
|
||||
$pushApply(ownKeys, $gOPS(source));
|
||||
}
|
||||
return ownKeys;
|
||||
};
|
32
node_modules/es-abstract/helpers/assertRecord.js
generated
vendored
Normal file
32
node_modules/es-abstract/helpers/assertRecord.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
// TODO, semver-major: delete this
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
var $SyntaxError = require('es-errors/syntax');
|
||||
|
||||
var isMatchRecord = require('./records/match-record');
|
||||
var isPropertyDescriptor = require('./records/property-descriptor');
|
||||
var isIteratorRecord = require('./records/iterator-record');
|
||||
var isPromiseCapabilityRecord = require('./records/promise-capability-record');
|
||||
var isAsyncGeneratorRequestRecord = require('./records/async-generator-request-record');
|
||||
var isRegExpRecord = require('./records/regexp-record');
|
||||
|
||||
var predicates = {
|
||||
'Property Descriptor': isPropertyDescriptor,
|
||||
'Match Record': isMatchRecord,
|
||||
'Iterator Record': isIteratorRecord,
|
||||
'PromiseCapability Record': isPromiseCapabilityRecord,
|
||||
'AsyncGeneratorRequest Record': isAsyncGeneratorRequestRecord,
|
||||
'RegExp Record': isRegExpRecord
|
||||
};
|
||||
|
||||
module.exports = function assertRecord(Type, recordType, argumentName, value) {
|
||||
var predicate = predicates[recordType];
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new $SyntaxError('unknown record type: ' + recordType);
|
||||
}
|
||||
if (!predicate(value)) {
|
||||
throw new $TypeError(argumentName + ' must be a ' + recordType);
|
||||
}
|
||||
};
|
22
node_modules/es-abstract/helpers/assign.js
generated
vendored
Normal file
22
node_modules/es-abstract/helpers/assign.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
var $assign = GetIntrinsic('%Object.assign%', true);
|
||||
|
||||
module.exports = function assign(target, source) {
|
||||
if ($assign) {
|
||||
return $assign(target, source);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (var key in source) {
|
||||
if (hasOwn(source, key)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
38
node_modules/es-abstract/helpers/bytesAsFloat32.js
generated
vendored
Normal file
38
node_modules/es-abstract/helpers/bytesAsFloat32.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
|
||||
module.exports = function bytesAsFloat32(rawBytes) {
|
||||
// return new $Float32Array(new $Uint8Array(rawBytes).buffer)[0];
|
||||
|
||||
/*
|
||||
Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2008 binary32 value.
|
||||
If value is an IEEE 754-2008 binary32 NaN value, return the NaN Number value.
|
||||
Return the Number value that corresponds to value.
|
||||
*/
|
||||
var sign = rawBytes[3] & 0x80 ? -1 : 1; // Check the sign bit
|
||||
var exponent = ((rawBytes[3] & 0x7F) << 1)
|
||||
| (rawBytes[2] >> 7); // Combine bits for exponent
|
||||
var mantissa = ((rawBytes[2] & 0x7F) << 16)
|
||||
| (rawBytes[1] << 8)
|
||||
| rawBytes[0]; // Combine bits for mantissa
|
||||
|
||||
if (exponent === 0 && mantissa === 0) {
|
||||
return sign === 1 ? 0 : -0;
|
||||
}
|
||||
if (exponent === 0xFF && mantissa === 0) {
|
||||
return sign === 1 ? Infinity : -Infinity;
|
||||
}
|
||||
if (exponent === 0xFF && mantissa !== 0) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
exponent -= 127; // subtract the bias
|
||||
|
||||
if (exponent === -127) {
|
||||
return sign * mantissa * $pow(2, -126 - 23);
|
||||
}
|
||||
return sign * (1 + (mantissa * $pow(2, -23))) * $pow(2, exponent);
|
||||
};
|
44
node_modules/es-abstract/helpers/bytesAsFloat64.js
generated
vendored
Normal file
44
node_modules/es-abstract/helpers/bytesAsFloat64.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
|
||||
module.exports = function bytesAsFloat64(rawBytes) {
|
||||
// return new $Float64Array(new $Uint8Array(rawBytes).buffer)[0];
|
||||
|
||||
/*
|
||||
Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2008 binary64 value.
|
||||
If value is an IEEE 754-2008 binary64 NaN value, return the NaN Number value.
|
||||
Return the Number value that corresponds to value.
|
||||
*/
|
||||
var sign = rawBytes[7] & 0x80 ? -1 : 1; // first bit
|
||||
var exponent = ((rawBytes[7] & 0x7F) << 4) // 7 bits from index 7
|
||||
| ((rawBytes[6] & 0xF0) >> 4); // 4 bits from index 6
|
||||
var mantissa = ((rawBytes[6] & 0x0F) * 0x1000000000000) // 4 bits from index 6
|
||||
+ (rawBytes[5] * 0x10000000000) // 8 bits from index 5
|
||||
+ (rawBytes[4] * 0x100000000) // 8 bits from index 4
|
||||
+ (rawBytes[3] * 0x1000000) // 8 bits from index 3
|
||||
+ (rawBytes[2] * 0x10000) // 8 bits from index 2
|
||||
+ (rawBytes[1] * 0x100) // 8 bits from index 1
|
||||
+ rawBytes[0]; // 8 bits from index 0
|
||||
|
||||
if (exponent === 0 && mantissa === 0) {
|
||||
return sign * 0;
|
||||
}
|
||||
if (exponent === 0x7FF && mantissa !== 0) {
|
||||
return NaN;
|
||||
}
|
||||
if (exponent === 0x7FF && mantissa === 0) {
|
||||
return sign * Infinity;
|
||||
}
|
||||
|
||||
exponent -= 1023; // subtract the bias
|
||||
|
||||
// Handle subnormal numbers
|
||||
if (exponent === -1023) {
|
||||
return sign * mantissa * 5e-324; // $pow(2, -1022 - 52)
|
||||
}
|
||||
|
||||
return sign * (1 + (mantissa / 0x10000000000000)) * $pow(2, exponent);
|
||||
};
|
31
node_modules/es-abstract/helpers/bytesAsInteger.js
generated
vendored
Normal file
31
node_modules/es-abstract/helpers/bytesAsInteger.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
var $Number = GetIntrinsic('%Number%');
|
||||
var $BigInt = GetIntrinsic('%BigInt%', true);
|
||||
|
||||
module.exports = function bytesAsInteger(rawBytes, elementSize, isUnsigned, isBigInt) {
|
||||
var Z = isBigInt ? $BigInt : $Number;
|
||||
|
||||
// this is common to both branches
|
||||
var intValue = Z(0);
|
||||
for (var i = 0; i < rawBytes.length; i++) {
|
||||
intValue += Z(rawBytes[i] * $pow(2, 8 * i));
|
||||
}
|
||||
/*
|
||||
Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of an unsigned little-endian binary number.
|
||||
*/
|
||||
|
||||
if (!isUnsigned) { // steps 5-6
|
||||
// Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of a binary little-endian 2's complement number of bit length elementSize × 8.
|
||||
var bitLength = elementSize * 8;
|
||||
|
||||
if (rawBytes[elementSize - 1] & 0x80) {
|
||||
intValue -= Z($pow(2, bitLength));
|
||||
}
|
||||
}
|
||||
|
||||
return intValue; // step 7
|
||||
};
|
5
node_modules/es-abstract/helpers/callBind.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/callBind.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// TODO; semver-major: remove
|
||||
|
||||
module.exports = require('call-bind');
|
5
node_modules/es-abstract/helpers/callBound.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/callBound.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// TODO; semver-major: remove
|
||||
|
||||
module.exports = require('call-bind/callBound');
|
1430
node_modules/es-abstract/helpers/caseFolding.json
generated
vendored
Normal file
1430
node_modules/es-abstract/helpers/caseFolding.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/es-abstract/helpers/defaultEndianness.js
generated
vendored
Normal file
21
node_modules/es-abstract/helpers/defaultEndianness.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
||||
var $Uint32Array = GetIntrinsic('%Uint32Array%', true);
|
||||
|
||||
var typedArrayBuffer = require('typed-array-buffer');
|
||||
|
||||
var uInt32 = $Uint32Array && new $Uint32Array([0x12345678]);
|
||||
var uInt8 = uInt32 && new $Uint8Array(typedArrayBuffer(uInt32));
|
||||
|
||||
module.exports = uInt8
|
||||
? uInt8[0] === 0x78
|
||||
? 'little'
|
||||
: uInt8[0] === 0x12
|
||||
? 'big'
|
||||
: uInt8[0] === 0x34
|
||||
? 'mixed' // https://developer.mozilla.org/en-US/docs/Glossary/Endianness
|
||||
: 'unknown' // ???
|
||||
: 'indeterminate'; // no way to know
|
10
node_modules/es-abstract/helpers/every.js
generated
vendored
Normal file
10
node_modules/es-abstract/helpers/every.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function every(array, predicate) {
|
||||
for (var i = 0; i < array.length; i += 1) {
|
||||
if (!predicate(array[i], i, array)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
7
node_modules/es-abstract/helpers/forEach.js
generated
vendored
Normal file
7
node_modules/es-abstract/helpers/forEach.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function forEach(array, callback) {
|
||||
for (var i = 0; i < array.length; i += 1) {
|
||||
callback(array[i], i, array); // eslint-disable-line callback-return
|
||||
}
|
||||
};
|
33
node_modules/es-abstract/helpers/fractionToBinaryString.js
generated
vendored
Normal file
33
node_modules/es-abstract/helpers/fractionToBinaryString.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var MAX_ITER = 1075; // 1023+52 (subnormals) => BIAS+NUM_SIGNFICAND_BITS-1
|
||||
var maxBits = 54; // only 53 bits for fraction
|
||||
|
||||
module.exports = function fractionToBitString(x) {
|
||||
var str = '';
|
||||
if (x === 0) {
|
||||
return str;
|
||||
}
|
||||
var j = MAX_ITER;
|
||||
|
||||
var y;
|
||||
// Each time we multiply by 2 and find a ones digit, add a '1'; otherwise, add a '0'..
|
||||
for (var i = 0; i < MAX_ITER; i += 1) {
|
||||
y = x * 2;
|
||||
if (y >= 1) {
|
||||
x = y - 1; // eslint-disable-line no-param-reassign
|
||||
str += '1';
|
||||
if (j === MAX_ITER) {
|
||||
j = i; // first 1
|
||||
}
|
||||
} else {
|
||||
x = y; // eslint-disable-line no-param-reassign
|
||||
str += '0';
|
||||
}
|
||||
// Stop when we have no more decimals to process or in the event we found a fraction which cannot be represented in a finite number of bits...
|
||||
if (y === 1 || i - j > maxBits) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
27
node_modules/es-abstract/helpers/fromPropertyDescriptor.js
generated
vendored
Normal file
27
node_modules/es-abstract/helpers/fromPropertyDescriptor.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function fromPropertyDescriptor(Desc) {
|
||||
if (typeof Desc === 'undefined') {
|
||||
return Desc;
|
||||
}
|
||||
var obj = {};
|
||||
if ('[[Value]]' in Desc) {
|
||||
obj.value = Desc['[[Value]]'];
|
||||
}
|
||||
if ('[[Writable]]' in Desc) {
|
||||
obj.writable = !!Desc['[[Writable]]'];
|
||||
}
|
||||
if ('[[Get]]' in Desc) {
|
||||
obj.get = Desc['[[Get]]'];
|
||||
}
|
||||
if ('[[Set]]' in Desc) {
|
||||
obj.set = Desc['[[Set]]'];
|
||||
}
|
||||
if ('[[Enumerable]]' in Desc) {
|
||||
obj.enumerable = !!Desc['[[Enumerable]]'];
|
||||
}
|
||||
if ('[[Configurable]]' in Desc) {
|
||||
obj.configurable = !!Desc['[[Configurable]]'];
|
||||
}
|
||||
return obj;
|
||||
};
|
4
node_modules/es-abstract/helpers/getInferredName.js
generated
vendored
Normal file
4
node_modules/es-abstract/helpers/getInferredName.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: remove, semver-major
|
||||
module.exports = require('get-symbol-description/getInferredName');
|
47
node_modules/es-abstract/helpers/getIteratorMethod.js
generated
vendored
Normal file
47
node_modules/es-abstract/helpers/getIteratorMethod.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBound = require('call-bind/callBound');
|
||||
var isString = require('is-string');
|
||||
|
||||
var $iterator = GetIntrinsic('%Symbol.iterator%', true);
|
||||
var $stringSlice = callBound('String.prototype.slice');
|
||||
var $String = GetIntrinsic('%String%');
|
||||
|
||||
module.exports = function getIteratorMethod(ES, iterable) {
|
||||
var usingIterator;
|
||||
if (hasSymbols) {
|
||||
usingIterator = ES.GetMethod(iterable, $iterator);
|
||||
} else if (ES.IsArray(iterable)) {
|
||||
usingIterator = function () {
|
||||
var i = -1;
|
||||
var arr = this; // eslint-disable-line no-invalid-this
|
||||
return {
|
||||
next: function () {
|
||||
i += 1;
|
||||
return {
|
||||
done: i >= arr.length,
|
||||
value: arr[i]
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
} else if (isString(iterable)) {
|
||||
usingIterator = function () {
|
||||
var i = 0;
|
||||
return {
|
||||
next: function () {
|
||||
var nextIndex = ES.AdvanceStringIndex($String(iterable), i, true);
|
||||
var value = $stringSlice(iterable, i, nextIndex);
|
||||
i = nextIndex;
|
||||
return {
|
||||
done: nextIndex > iterable.length,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
return usingIterator;
|
||||
};
|
5
node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: remove, semver-major
|
||||
|
||||
module.exports = require('gopd');
|
15
node_modules/es-abstract/helpers/getProto.js
generated
vendored
Normal file
15
node_modules/es-abstract/helpers/getProto.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var originalGetProto = GetIntrinsic('%Object.getPrototypeOf%', true);
|
||||
|
||||
var hasProto = require('has-proto')();
|
||||
|
||||
module.exports = originalGetProto || (
|
||||
hasProto
|
||||
? function (O) {
|
||||
return O.__proto__; // eslint-disable-line no-proto
|
||||
}
|
||||
: null
|
||||
);
|
4
node_modules/es-abstract/helpers/getSymbolDescription.js
generated
vendored
Normal file
4
node_modules/es-abstract/helpers/getSymbolDescription.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: remove, semver-major
|
||||
module.exports = require('get-symbol-description');
|
23
node_modules/es-abstract/helpers/intToBinaryString.js
generated
vendored
Normal file
23
node_modules/es-abstract/helpers/intToBinaryString.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $floor = GetIntrinsic('%Math.floor%');
|
||||
|
||||
// https://runestone.academy/ns/books/published/pythonds/BasicDS/ConvertingDecimalNumberstoBinaryNumbers.html#:~:text=The%20Divide%20by%202%20algorithm,have%20a%20remainder%20of%200
|
||||
|
||||
module.exports = function intToBinaryString(x) {
|
||||
var str = '';
|
||||
var y;
|
||||
|
||||
while (x > 0) {
|
||||
y = x / 2;
|
||||
x = $floor(y); // eslint-disable-line no-param-reassign
|
||||
if (y === x) {
|
||||
str = '0' + str;
|
||||
} else {
|
||||
str = '1' + str;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
28
node_modules/es-abstract/helpers/integerToNBytes.js
generated
vendored
Normal file
28
node_modules/es-abstract/helpers/integerToNBytes.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $Number = GetIntrinsic('%Number%');
|
||||
var $BigInt = GetIntrinsic('%BigInt%', true);
|
||||
|
||||
module.exports = function integerToNBytes(intValue, n, isLittleEndian) {
|
||||
var Z = typeof intValue === 'bigint' ? $BigInt : $Number;
|
||||
/*
|
||||
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 >>>= 0; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
var rawBytes = [];
|
||||
for (var i = 0; i < n; i++) {
|
||||
rawBytes[isLittleEndian ? i : n - 1 - i] = $Number(intValue & Z(0xFF));
|
||||
intValue >>= Z(8); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
return rawBytes; // step 4
|
||||
};
|
9
node_modules/es-abstract/helpers/isAbstractClosure.js
generated
vendored
Normal file
9
node_modules/es-abstract/helpers/isAbstractClosure.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var functionName = require('function.prototype.name');
|
||||
|
||||
var anon = functionName(function () {});
|
||||
|
||||
module.exports = function isAbstractClosure(x) {
|
||||
return typeof x === 'function' && (!x.prototype || functionName(x) === anon);
|
||||
};
|
5
node_modules/es-abstract/helpers/isByteValue.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isByteValue.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isByteValue(value) {
|
||||
return typeof value === 'number' && value >= 0 && value <= 255 && (value | 0) === value;
|
||||
};
|
5
node_modules/es-abstract/helpers/isCodePoint.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isCodePoint.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isCodePoint(cp) {
|
||||
return typeof cp === 'number' && cp >= 0 && cp <= 0x10FFFF && (cp | 0) === cp;
|
||||
};
|
5
node_modules/es-abstract/helpers/isFinite.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isFinite.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var $isNaN = require('./isNaN');
|
||||
|
||||
module.exports = function (x) { return (typeof x === 'number' || typeof x === 'bigint') && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
|
11
node_modules/es-abstract/helpers/isFullyPopulatedPropertyDescriptor.js
generated
vendored
Normal file
11
node_modules/es-abstract/helpers/isFullyPopulatedPropertyDescriptor.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var isPropertyDescriptor = require('./records/property-descriptor');
|
||||
|
||||
module.exports = function isFullyPopulatedPropertyDescriptor(ES, Desc) {
|
||||
return isPropertyDescriptor(Desc)
|
||||
&& typeof Desc === 'object'
|
||||
&& '[[Enumerable]]' in Desc
|
||||
&& '[[Configurable]]' in Desc
|
||||
&& (ES.IsAccessorDescriptor(Desc) || ES.IsDataDescriptor(Desc));
|
||||
};
|
18
node_modules/es-abstract/helpers/isInteger.js
generated
vendored
Normal file
18
node_modules/es-abstract/helpers/isInteger.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $abs = GetIntrinsic('%Math.abs%');
|
||||
var $floor = GetIntrinsic('%Math.floor%');
|
||||
|
||||
var $isNaN = require('./isNaN');
|
||||
var $isFinite = require('./isFinite');
|
||||
|
||||
module.exports = function isInteger(argument) {
|
||||
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
|
||||
return false;
|
||||
}
|
||||
var absValue = $abs(argument);
|
||||
return $floor(absValue) === absValue;
|
||||
};
|
||||
|
5
node_modules/es-abstract/helpers/isLeadingSurrogate.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isLeadingSurrogate.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isLeadingSurrogate(charCode) {
|
||||
return typeof charCode === 'number' && charCode >= 0xD800 && charCode <= 0xDBFF;
|
||||
};
|
7
node_modules/es-abstract/helpers/isLineTerminator.js
generated
vendored
Normal file
7
node_modules/es-abstract/helpers/isLineTerminator.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-7.3
|
||||
|
||||
module.exports = function isLineTerminator(c) {
|
||||
return c === '\n' || c === '\r' || c === '\u2028' || c === '\u2029';
|
||||
};
|
5
node_modules/es-abstract/helpers/isNaN.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isNaN.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = Number.isNaN || function isNaN(a) {
|
||||
return a !== a;
|
||||
};
|
5
node_modules/es-abstract/helpers/isNegativeZero.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isNegativeZero.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isNegativeZero(x) {
|
||||
return x === 0 && 1 / x === 1 / -0;
|
||||
};
|
13
node_modules/es-abstract/helpers/isPrefixOf.js
generated
vendored
Normal file
13
node_modules/es-abstract/helpers/isPrefixOf.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var $strSlice = require('call-bind/callBound')('String.prototype.slice');
|
||||
|
||||
module.exports = function isPrefixOf(prefix, string) {
|
||||
if (prefix === string) {
|
||||
return true;
|
||||
}
|
||||
if (prefix.length > string.length) {
|
||||
return false;
|
||||
}
|
||||
return $strSlice(string, 0, prefix.length) === prefix;
|
||||
};
|
5
node_modules/es-abstract/helpers/isPrimitive.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isPrimitive.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isPrimitive(value) {
|
||||
return value === null || (typeof value !== 'function' && typeof value !== 'object');
|
||||
};
|
20
node_modules/es-abstract/helpers/isSamePropertyDescriptor.js
generated
vendored
Normal file
20
node_modules/es-abstract/helpers/isSamePropertyDescriptor.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var every = require('./every');
|
||||
|
||||
module.exports = function isSamePropertyDescriptor(ES, D1, D2) {
|
||||
var fields = [
|
||||
'[[Configurable]]',
|
||||
'[[Enumerable]]',
|
||||
'[[Get]]',
|
||||
'[[Set]]',
|
||||
'[[Value]]',
|
||||
'[[Writable]]'
|
||||
];
|
||||
return every(fields, function (field) {
|
||||
if ((field in D1) !== (field in D2)) {
|
||||
return false;
|
||||
}
|
||||
return ES.SameValue(D1[field], D2[field]);
|
||||
});
|
||||
};
|
9
node_modules/es-abstract/helpers/isStringOrHole.js
generated
vendored
Normal file
9
node_modules/es-abstract/helpers/isStringOrHole.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: semver-major: remove
|
||||
|
||||
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false
|
||||
|
||||
module.exports = function isStringOrHole(item, index, arr) {
|
||||
return typeof item === 'string' || (canDistinguishSparseFromUndefined ? !(index in arr) : typeof item === 'undefined');
|
||||
};
|
5
node_modules/es-abstract/helpers/isStringOrUndefined.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isStringOrUndefined.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isStringOrUndefined(item) {
|
||||
return typeof item === 'string' || typeof item === 'undefined';
|
||||
};
|
5
node_modules/es-abstract/helpers/isTrailingSurrogate.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/isTrailingSurrogate.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isTrailingSurrogate(charCode) {
|
||||
return typeof charCode === 'number' && charCode >= 0xDC00 && charCode <= 0xDFFF;
|
||||
};
|
3
node_modules/es-abstract/helpers/maxSafeInteger.js
generated
vendored
Normal file
3
node_modules/es-abstract/helpers/maxSafeInteger.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = Number.MAX_SAFE_INTEGER || 9007199254740991; // Math.pow(2, 53) - 1;
|
3
node_modules/es-abstract/helpers/maxValue.js
generated
vendored
Normal file
3
node_modules/es-abstract/helpers/maxValue.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = Number.MAX_VALUE || 1.7976931348623157e+308;
|
8
node_modules/es-abstract/helpers/mod.js
generated
vendored
Normal file
8
node_modules/es-abstract/helpers/mod.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var $floor = Math.floor;
|
||||
|
||||
module.exports = function mod(number, modulo) {
|
||||
var remain = number % modulo;
|
||||
return $floor(remain >= 0 ? remain : remain + modulo);
|
||||
};
|
6
node_modules/es-abstract/helpers/modBigInt.js
generated
vendored
Normal file
6
node_modules/es-abstract/helpers/modBigInt.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function bigIntMod(BigIntRemainder, bigint, modulo) {
|
||||
var remain = BigIntRemainder(bigint, modulo);
|
||||
return remain >= 0 ? remain : remain + modulo;
|
||||
};
|
9
node_modules/es-abstract/helpers/padTimeComponent.js
generated
vendored
Normal file
9
node_modules/es-abstract/helpers/padTimeComponent.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $strSlice = callBound('String.prototype.slice');
|
||||
|
||||
module.exports = function padTimeComponent(c, count) {
|
||||
return $strSlice('00' + c, -(count || 2));
|
||||
};
|
13
node_modules/es-abstract/helpers/records/async-generator-request-record.js
generated
vendored
Normal file
13
node_modules/es-abstract/helpers/records/async-generator-request-record.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
var isPromiseCapabilityRecord = require('./promise-capability-record');
|
||||
|
||||
module.exports = function isAsyncGeneratorRequestRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[Completion]]') // TODO: confirm is a completion record
|
||||
&& hasOwn(value, '[[Capability]]')
|
||||
&& isPromiseCapabilityRecord(value['[[Capability]]']);
|
||||
};
|
18
node_modules/es-abstract/helpers/records/data-view-with-buffer-witness-record.js
generated
vendored
Normal file
18
node_modules/es-abstract/helpers/records/data-view-with-buffer-witness-record.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
var isDataView = require('is-data-view');
|
||||
|
||||
var isInteger = require('../isInteger');
|
||||
|
||||
module.exports = function isDataViewWithBufferWitnessRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[Object]]')
|
||||
&& hasOwn(value, '[[CachedBufferByteLength]]')
|
||||
&& (
|
||||
(isInteger(value['[[CachedBufferByteLength]]']) && value['[[CachedBufferByteLength]]'] >= 0)
|
||||
|| value['[[CachedBufferByteLength]]'] === 'DETACHED'
|
||||
)
|
||||
&& isDataView(value['[[Object]]']);
|
||||
};
|
13
node_modules/es-abstract/helpers/records/iterator-record.js
generated
vendored
Normal file
13
node_modules/es-abstract/helpers/records/iterator-record.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
module.exports = function isIteratorRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[Iterator]]')
|
||||
&& hasOwn(value, '[[NextMethod]]')
|
||||
&& typeof value['[[NextMethod]]'] === 'function'
|
||||
&& hasOwn(value, '[[Done]]')
|
||||
&& typeof value['[[Done]]'] === 'boolean';
|
||||
};
|
18
node_modules/es-abstract/helpers/records/match-record.js
generated
vendored
Normal file
18
node_modules/es-abstract/helpers/records/match-record.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
// https://262.ecma-international.org/13.0/#sec-match-records
|
||||
|
||||
module.exports = function isMatchRecord(record) {
|
||||
return (
|
||||
!!record
|
||||
&& typeof record === 'object'
|
||||
&& hasOwn(record, '[[StartIndex]]')
|
||||
&& hasOwn(record, '[[EndIndex]]')
|
||||
&& record['[[StartIndex]]'] >= 0
|
||||
&& record['[[EndIndex]]'] >= record['[[StartIndex]]']
|
||||
&& String(parseInt(record['[[StartIndex]]'], 10)) === String(record['[[StartIndex]]'])
|
||||
&& String(parseInt(record['[[EndIndex]]'], 10)) === String(record['[[EndIndex]]'])
|
||||
);
|
||||
};
|
16
node_modules/es-abstract/helpers/records/promise-capability-record.js
generated
vendored
Normal file
16
node_modules/es-abstract/helpers/records/promise-capability-record.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
module.exports = function isPromiseCapabilityRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[Resolve]]')
|
||||
&& typeof value['[[Resolve]]'] === 'function'
|
||||
&& hasOwn(value, '[[Reject]]')
|
||||
&& typeof value['[[Reject]]'] === 'function'
|
||||
&& hasOwn(value, '[[Promise]]')
|
||||
&& !!value['[[Promise]]']
|
||||
&& typeof value['[[Promise]]'] === 'object'
|
||||
&& typeof value['[[Promise]]'].then === 'function';
|
||||
};
|
36
node_modules/es-abstract/helpers/records/property-descriptor.js
generated
vendored
Normal file
36
node_modules/es-abstract/helpers/records/property-descriptor.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
var allowed = {
|
||||
__proto__: null,
|
||||
'[[Configurable]]': true,
|
||||
'[[Enumerable]]': true,
|
||||
'[[Get]]': true,
|
||||
'[[Set]]': true,
|
||||
'[[Value]]': true,
|
||||
'[[Writable]]': true
|
||||
};
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
|
||||
|
||||
module.exports = function isPropertyDescriptor(Desc) {
|
||||
if (!Desc || typeof Desc !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var key in Desc) { // eslint-disable-line
|
||||
if (hasOwn(Desc, key) && !allowed[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var isData = hasOwn(Desc, '[[Value]]') || hasOwn(Desc, '[[Writable]]');
|
||||
var IsAccessor = hasOwn(Desc, '[[Get]]') || hasOwn(Desc, '[[Set]]');
|
||||
if (isData && IsAccessor) {
|
||||
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
|
||||
}
|
||||
return true;
|
||||
};
|
23
node_modules/es-abstract/helpers/records/regexp-record.js
generated
vendored
Normal file
23
node_modules/es-abstract/helpers/records/regexp-record.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
var isInteger = require('../isInteger');
|
||||
|
||||
module.exports = function isRegExpRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[IgnoreCase]]')
|
||||
&& typeof value['[[IgnoreCase]]'] === 'boolean'
|
||||
&& hasOwn(value, '[[Multiline]]')
|
||||
&& typeof value['[[Multiline]]'] === 'boolean'
|
||||
&& hasOwn(value, '[[DotAll]]')
|
||||
&& typeof value['[[DotAll]]'] === 'boolean'
|
||||
&& hasOwn(value, '[[Unicode]]')
|
||||
&& typeof value['[[Unicode]]'] === 'boolean'
|
||||
&& hasOwn(value, '[[CapturingGroupsCount]]')
|
||||
&& typeof value['[[CapturingGroupsCount]]'] === 'number'
|
||||
&& isInteger(value['[[CapturingGroupsCount]]'])
|
||||
&& value['[[CapturingGroupsCount]]'] >= 0
|
||||
&& (!hasOwn(value, '[[UnicodeSets]]') || typeof value['[[UnicodeSets]]'] === 'boolean'); // optional since it was added later
|
||||
};
|
18
node_modules/es-abstract/helpers/records/typed-array-with-buffer-witness-record.js
generated
vendored
Normal file
18
node_modules/es-abstract/helpers/records/typed-array-with-buffer-witness-record.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
var isTypedArray = require('is-typed-array');
|
||||
|
||||
var isInteger = require('../isInteger');
|
||||
|
||||
module.exports = function isTypedArrayWithBufferWitnessRecord(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& hasOwn(value, '[[Object]]')
|
||||
&& hasOwn(value, '[[CachedBufferByteLength]]')
|
||||
&& (
|
||||
(isInteger(value['[[CachedBufferByteLength]]']) && value['[[CachedBufferByteLength]]'] >= 0)
|
||||
|| value['[[CachedBufferByteLength]]'] === 'DETACHED'
|
||||
)
|
||||
&& isTypedArray(value['[[Object]]']);
|
||||
};
|
9
node_modules/es-abstract/helpers/reduce.js
generated
vendored
Normal file
9
node_modules/es-abstract/helpers/reduce.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function reduce(arr, fn, init) {
|
||||
var acc = init;
|
||||
for (var i = 0; i < arr.length; i += 1) {
|
||||
acc = fn(acc, arr[i], i);
|
||||
}
|
||||
return acc;
|
||||
};
|
5
node_modules/es-abstract/helpers/regexTester.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/regexTester.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: remove, semver-major
|
||||
|
||||
module.exports = require('safe-regex-test');
|
17
node_modules/es-abstract/helpers/setProto.js
generated
vendored
Normal file
17
node_modules/es-abstract/helpers/setProto.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true);
|
||||
|
||||
var hasProto = require('has-proto')();
|
||||
|
||||
module.exports = originalSetProto || (
|
||||
|
||||
hasProto
|
||||
? function (O, proto) {
|
||||
O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign
|
||||
return O;
|
||||
}
|
||||
: null
|
||||
);
|
5
node_modules/es-abstract/helpers/sign.js
generated
vendored
Normal file
5
node_modules/es-abstract/helpers/sign.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function sign(number) {
|
||||
return number >= 0 ? 1 : -1;
|
||||
};
|
10
node_modules/es-abstract/helpers/some.js
generated
vendored
Normal file
10
node_modules/es-abstract/helpers/some.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function some(array, predicate) {
|
||||
for (var i = 0; i < array.length; i += 1) {
|
||||
if (predicate(array[i], i, array)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
19
node_modules/es-abstract/helpers/timeConstants.js
generated
vendored
Normal file
19
node_modules/es-abstract/helpers/timeConstants.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var HoursPerDay = 24;
|
||||
var MinutesPerHour = 60;
|
||||
var SecondsPerMinute = 60;
|
||||
var msPerSecond = 1e3;
|
||||
var msPerMinute = msPerSecond * SecondsPerMinute;
|
||||
var msPerHour = msPerMinute * MinutesPerHour;
|
||||
var msPerDay = 86400000;
|
||||
|
||||
module.exports = {
|
||||
HoursPerDay: HoursPerDay,
|
||||
MinutesPerHour: MinutesPerHour,
|
||||
SecondsPerMinute: SecondsPerMinute,
|
||||
msPerSecond: msPerSecond,
|
||||
msPerMinute: msPerMinute,
|
||||
msPerHour: msPerHour,
|
||||
msPerDay: msPerDay
|
||||
};
|
22
node_modules/es-abstract/helpers/typedArrayConstructors.js
generated
vendored
Normal file
22
node_modules/es-abstract/helpers/typedArrayConstructors.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var constructors = {
|
||||
__proto__: null,
|
||||
$Int8Array: GetIntrinsic('%Int8Array%', true),
|
||||
$Uint8Array: GetIntrinsic('%Uint8Array%', true),
|
||||
$Uint8ClampedArray: GetIntrinsic('%Uint8ClampedArray%', true),
|
||||
$Int16Array: GetIntrinsic('%Int16Array%', true),
|
||||
$Uint16Array: GetIntrinsic('%Uint16Array%', true),
|
||||
$Int32Array: GetIntrinsic('%Int32Array%', true),
|
||||
$Uint32Array: GetIntrinsic('%Uint32Array%', true),
|
||||
$BigInt64Array: GetIntrinsic('%BigInt64Array%', true),
|
||||
$BigUint64Array: GetIntrinsic('%BigUint64Array%', true),
|
||||
$Float32Array: GetIntrinsic('%Float32Array%', true),
|
||||
$Float64Array: GetIntrinsic('%Float64Array%', true)
|
||||
};
|
||||
|
||||
module.exports = function getConstructor(kind) {
|
||||
return constructors['$' + kind];
|
||||
};
|
69
node_modules/es-abstract/helpers/valueToFloat32Bytes.js
generated
vendored
Normal file
69
node_modules/es-abstract/helpers/valueToFloat32Bytes.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $abs = GetIntrinsic('%Math.abs%');
|
||||
var $floor = GetIntrinsic('%Math.floor%');
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
|
||||
var isFinite = require('./isFinite');
|
||||
var isNaN = require('./isNaN');
|
||||
var isNegativeZero = require('./isNegativeZero');
|
||||
|
||||
var maxFiniteFloat32 = 3.4028234663852886e+38; // roughly 2 ** 128 - 1
|
||||
|
||||
module.exports = function valueToFloat32Bytes(value, isLittleEndian) {
|
||||
if (isNaN(value)) {
|
||||
return isLittleEndian ? [0, 0, 192, 127] : [127, 192, 0, 0]; // hardcoded
|
||||
}
|
||||
|
||||
var leastSig;
|
||||
|
||||
if (value === 0) {
|
||||
leastSig = isNegativeZero(value) ? 0x80 : 0;
|
||||
return isLittleEndian ? [0, 0, 0, leastSig] : [leastSig, 0, 0, 0];
|
||||
}
|
||||
|
||||
if ($abs(value) > maxFiniteFloat32 || !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
|
||||
|
||||
var 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) + 0.5;
|
||||
mantissa = $floor(mantissa);
|
||||
|
||||
exponent += 127;
|
||||
exponent <<= 23;
|
||||
|
||||
var result = (sign << 31)
|
||||
| exponent
|
||||
| mantissa;
|
||||
|
||||
var byte0 = result & 255;
|
||||
result >>= 8;
|
||||
var byte1 = result & 255;
|
||||
result >>= 8;
|
||||
var byte2 = result & 255;
|
||||
result >>= 8;
|
||||
var byte3 = result & 255;
|
||||
|
||||
if (isLittleEndian) {
|
||||
return [byte0, byte1, byte2, byte3];
|
||||
}
|
||||
return [byte3, byte2, byte1, byte0];
|
||||
};
|
83
node_modules/es-abstract/helpers/valueToFloat64Bytes.js
generated
vendored
Normal file
83
node_modules/es-abstract/helpers/valueToFloat64Bytes.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $parseInt = GetIntrinsic('%parseInt%');
|
||||
var $abs = GetIntrinsic('%Math.abs%');
|
||||
var $floor = GetIntrinsic('%Math.floor%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $strIndexOf = callBound('String.prototype.indexOf');
|
||||
var $strSlice = callBound('String.prototype.slice');
|
||||
|
||||
var fractionToBitString = require('../helpers/fractionToBinaryString');
|
||||
var intToBinString = require('../helpers/intToBinaryString');
|
||||
var isNegativeZero = require('./isNegativeZero');
|
||||
|
||||
var float64bias = 1023;
|
||||
|
||||
var elevenOnes = '11111111111';
|
||||
var elevenZeroes = '00000000000';
|
||||
var fiftyOneZeroes = elevenZeroes + elevenZeroes + elevenZeroes + elevenZeroes + '0000000';
|
||||
|
||||
// IEEE 754-1985
|
||||
module.exports = function valueToFloat64Bytes(value, isLittleEndian) {
|
||||
var signBit = value < 0 || isNegativeZero(value) ? '1' : '0';
|
||||
var exponentBits;
|
||||
var significandBits;
|
||||
|
||||
if (isNaN(value)) {
|
||||
exponentBits = elevenOnes;
|
||||
significandBits = '1' + fiftyOneZeroes;
|
||||
} else if (!isFinite(value)) {
|
||||
exponentBits = elevenOnes;
|
||||
significandBits = '0' + fiftyOneZeroes;
|
||||
} else if (value === 0) {
|
||||
exponentBits = elevenZeroes;
|
||||
significandBits = '0' + fiftyOneZeroes;
|
||||
} else {
|
||||
value = $abs(value); // eslint-disable-line no-param-reassign
|
||||
|
||||
// Isolate the integer part (digits before the decimal):
|
||||
var integerPart = $floor(value);
|
||||
|
||||
var intBinString = intToBinString(integerPart); // bit string for integer part
|
||||
var fracBinString = fractionToBitString(value - integerPart); // bit string for fractional part
|
||||
|
||||
var numberOfBits;
|
||||
// find exponent needed to normalize integer+fractional parts
|
||||
if (intBinString) {
|
||||
exponentBits = intBinString.length - 1; // move the decimal to the left
|
||||
} else {
|
||||
var first1 = $strIndexOf(fracBinString, '1');
|
||||
if (first1 > -1) {
|
||||
numberOfBits = first1 + 1;
|
||||
}
|
||||
exponentBits = -numberOfBits; // move the decimal to the right
|
||||
}
|
||||
|
||||
significandBits = intBinString + fracBinString;
|
||||
if (exponentBits < 0) {
|
||||
// subnormals
|
||||
if (exponentBits <= -float64bias) {
|
||||
numberOfBits = float64bias - 1; // limit number of removed bits
|
||||
}
|
||||
significandBits = $strSlice(significandBits, numberOfBits); // remove all leading 0s and the first 1 for normal values; for subnormals, remove up to `float64bias - 1` leading bits
|
||||
} else {
|
||||
significandBits = $strSlice(significandBits, 1); // remove the leading '1' (implicit/hidden bit)
|
||||
}
|
||||
exponentBits = $strSlice(elevenZeroes + intToBinString(exponentBits + float64bias), -11); // Convert the exponent to a bit string
|
||||
|
||||
significandBits = $strSlice(significandBits + fiftyOneZeroes + '0', 0, 52); // fill in any trailing zeros and ensure we have only 52 fraction bits
|
||||
}
|
||||
|
||||
var bits = signBit + exponentBits + significandBits;
|
||||
var rawBytes = [];
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var targetIndex = isLittleEndian ? 8 - i - 1 : i;
|
||||
rawBytes[targetIndex] = $parseInt($strSlice(bits, i * 8, (i + 1) * 8), 2);
|
||||
}
|
||||
|
||||
return rawBytes;
|
||||
};
|
Reference in New Issue
Block a user