Upload folder using huggingface_hub (part 23)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/es-abstract/2023/MinFromTime.js +14 -0
- node_modules/es-abstract/2023/MonthFromTime.js +51 -0
- node_modules/es-abstract/2023/NewPromiseCapability.js +34 -0
- node_modules/es-abstract/2023/NormalCompletion.js +9 -0
- node_modules/es-abstract/2023/Number/add.js +31 -0
- node_modules/es-abstract/2023/Number/bitwiseAND.js +14 -0
- node_modules/es-abstract/2023/Number/bitwiseNOT.js +16 -0
- node_modules/es-abstract/2023/Number/bitwiseOR.js +14 -0
- node_modules/es-abstract/2023/Number/bitwiseXOR.js +14 -0
- node_modules/es-abstract/2023/Number/divide.js +18 -0
- node_modules/es-abstract/2023/Number/equal.js +18 -0
- node_modules/es-abstract/2023/Number/exponentiate.js +74 -0
- node_modules/es-abstract/2023/Number/index.js +43 -0
- node_modules/es-abstract/2023/Number/leftShift.js +22 -0
- node_modules/es-abstract/2023/Number/lessThan.js +22 -0
- node_modules/es-abstract/2023/Number/multiply.js +29 -0
- node_modules/es-abstract/2023/Number/remainder.js +38 -0
- node_modules/es-abstract/2023/Number/sameValue.js +18 -0
- node_modules/es-abstract/2023/Number/sameValueZero.js +20 -0
- node_modules/es-abstract/2023/Number/signedRightShift.js +22 -0
- node_modules/es-abstract/2023/Number/subtract.js +15 -0
- node_modules/es-abstract/2023/Number/toString.js +20 -0
- node_modules/es-abstract/2023/Number/unaryMinus.js +17 -0
- node_modules/es-abstract/2023/Number/unsignedRightShift.js +22 -0
- node_modules/es-abstract/2023/NumberBitwiseOp.js +26 -0
- node_modules/es-abstract/2023/NumberToBigInt.js +25 -0
- node_modules/es-abstract/2023/NumericToRawBytes.js +62 -0
- node_modules/es-abstract/2023/ObjectDefineProperties.js +37 -0
- node_modules/es-abstract/2023/OrdinaryCreateFromConstructor.js +20 -0
- node_modules/es-abstract/2023/OrdinaryDefineOwnProperty.js +54 -0
- node_modules/es-abstract/2023/OrdinaryGetOwnProperty.js +41 -0
- node_modules/es-abstract/2023/OrdinaryGetPrototypeOf.js +18 -0
- node_modules/es-abstract/2023/OrdinaryHasInstance.js +23 -0
- node_modules/es-abstract/2023/OrdinaryHasProperty.js +18 -0
- node_modules/es-abstract/2023/OrdinaryObjectCreate.js +56 -0
- node_modules/es-abstract/2023/OrdinarySetPrototypeOf.js +50 -0
- node_modules/es-abstract/2023/OrdinaryToPrimitive.js +36 -0
- node_modules/es-abstract/2023/ParseHexOctet.js +40 -0
- node_modules/es-abstract/2023/PromiseResolve.js +18 -0
- node_modules/es-abstract/2023/QuoteJSONString.js +52 -0
- node_modules/es-abstract/2023/RawBytesToNumeric.js +67 -0
- node_modules/es-abstract/2023/RegExpCreate.js +21 -0
- node_modules/es-abstract/2023/RegExpExec.js +29 -0
- node_modules/es-abstract/2023/RegExpHasFlag.js +38 -0
- node_modules/es-abstract/2023/RequireObjectCoercible.js +3 -0
- node_modules/es-abstract/2023/SameValue.js +13 -0
- node_modules/es-abstract/2023/SameValueNonNumber.js +18 -0
- node_modules/es-abstract/2023/SameValueZero.js +9 -0
- node_modules/es-abstract/2023/SecFromTime.js +14 -0
- node_modules/es-abstract/2023/Set.js +45 -0
node_modules/es-abstract/2023/MinFromTime.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var floor = require('./floor');
|
| 4 |
+
var modulo = require('./modulo');
|
| 5 |
+
|
| 6 |
+
var timeConstants = require('../helpers/timeConstants');
|
| 7 |
+
var msPerMinute = timeConstants.msPerMinute;
|
| 8 |
+
var MinutesPerHour = timeConstants.MinutesPerHour;
|
| 9 |
+
|
| 10 |
+
// https://262.ecma-international.org/5.1/#sec-15.9.1.10
|
| 11 |
+
|
| 12 |
+
module.exports = function MinFromTime(t) {
|
| 13 |
+
return modulo(floor(t / msPerMinute), MinutesPerHour);
|
| 14 |
+
};
|
node_modules/es-abstract/2023/MonthFromTime.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $RangeError = require('es-errors/range');
|
| 4 |
+
|
| 5 |
+
var DayWithinYear = require('./DayWithinYear');
|
| 6 |
+
var InLeapYear = require('./InLeapYear');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/5.1/#sec-15.9.1.4
|
| 9 |
+
|
| 10 |
+
module.exports = function MonthFromTime(t) {
|
| 11 |
+
var day = DayWithinYear(t);
|
| 12 |
+
if (0 <= day && day < 31) {
|
| 13 |
+
return 0;
|
| 14 |
+
}
|
| 15 |
+
var leap = InLeapYear(t);
|
| 16 |
+
if (31 <= day && day < (59 + leap)) {
|
| 17 |
+
return 1;
|
| 18 |
+
}
|
| 19 |
+
if ((59 + leap) <= day && day < (90 + leap)) {
|
| 20 |
+
return 2;
|
| 21 |
+
}
|
| 22 |
+
if ((90 + leap) <= day && day < (120 + leap)) {
|
| 23 |
+
return 3;
|
| 24 |
+
}
|
| 25 |
+
if ((120 + leap) <= day && day < (151 + leap)) {
|
| 26 |
+
return 4;
|
| 27 |
+
}
|
| 28 |
+
if ((151 + leap) <= day && day < (181 + leap)) {
|
| 29 |
+
return 5;
|
| 30 |
+
}
|
| 31 |
+
if ((181 + leap) <= day && day < (212 + leap)) {
|
| 32 |
+
return 6;
|
| 33 |
+
}
|
| 34 |
+
if ((212 + leap) <= day && day < (243 + leap)) {
|
| 35 |
+
return 7;
|
| 36 |
+
}
|
| 37 |
+
if ((243 + leap) <= day && day < (273 + leap)) {
|
| 38 |
+
return 8;
|
| 39 |
+
}
|
| 40 |
+
if ((273 + leap) <= day && day < (304 + leap)) {
|
| 41 |
+
return 9;
|
| 42 |
+
}
|
| 43 |
+
if ((304 + leap) <= day && day < (334 + leap)) {
|
| 44 |
+
return 10;
|
| 45 |
+
}
|
| 46 |
+
if ((334 + leap) <= day && day < (365 + leap)) {
|
| 47 |
+
return 11;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
throw new $RangeError('Assertion failed: `day` is out of range');
|
| 51 |
+
};
|
node_modules/es-abstract/2023/NewPromiseCapability.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var IsCallable = require('./IsCallable');
|
| 6 |
+
var IsConstructor = require('./IsConstructor');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/6.0/#sec-newpromisecapability
|
| 9 |
+
|
| 10 |
+
module.exports = function NewPromiseCapability(C) {
|
| 11 |
+
if (!IsConstructor(C)) {
|
| 12 |
+
throw new $TypeError('C must be a constructor'); // step 1
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
var resolvingFunctions = { '[[Resolve]]': void undefined, '[[Reject]]': void undefined }; // step 3
|
| 16 |
+
|
| 17 |
+
var promise = new C(function (resolve, reject) { // steps 4-5
|
| 18 |
+
if (typeof resolvingFunctions['[[Resolve]]'] !== 'undefined' || typeof resolvingFunctions['[[Reject]]'] !== 'undefined') {
|
| 19 |
+
throw new $TypeError('executor has already been called'); // step 4.a, 4.b
|
| 20 |
+
}
|
| 21 |
+
resolvingFunctions['[[Resolve]]'] = resolve; // step 4.c
|
| 22 |
+
resolvingFunctions['[[Reject]]'] = reject; // step 4.d
|
| 23 |
+
}); // step 4-6
|
| 24 |
+
|
| 25 |
+
if (!IsCallable(resolvingFunctions['[[Resolve]]']) || !IsCallable(resolvingFunctions['[[Reject]]'])) {
|
| 26 |
+
throw new $TypeError('executor must provide valid resolve and reject functions'); // steps 7-8
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
return {
|
| 30 |
+
'[[Promise]]': promise,
|
| 31 |
+
'[[Resolve]]': resolvingFunctions['[[Resolve]]'],
|
| 32 |
+
'[[Reject]]': resolvingFunctions['[[Reject]]']
|
| 33 |
+
}; // step 9
|
| 34 |
+
};
|
node_modules/es-abstract/2023/NormalCompletion.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var CompletionRecord = require('./CompletionRecord');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/6.0/#sec-normalcompletion
|
| 6 |
+
|
| 7 |
+
module.exports = function NormalCompletion(value) {
|
| 8 |
+
return new CompletionRecord('normal', value);
|
| 9 |
+
};
|
node_modules/es-abstract/2023/Number/add.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isFinite = require('math-intrinsics/isFinite');
|
| 5 |
+
var isNaN = require('math-intrinsics/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/12.0/#sec-numeric-types-number-add
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberAdd(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) {
|
| 15 |
+
return NaN;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
if (!isFinite(x)) {
|
| 19 |
+
return x;
|
| 20 |
+
}
|
| 21 |
+
if (!isFinite(y)) {
|
| 22 |
+
return y;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
if (x === y && x === 0) { // both zeroes
|
| 26 |
+
return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
// shortcut for the actual spec mechanics
|
| 30 |
+
return x + y;
|
| 31 |
+
};
|
node_modules/es-abstract/2023/Number/bitwiseAND.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberBitwiseAND(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
return NumberBitwiseOp('&', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2023/Number/bitwiseNOT.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var ToInt32 = require('../ToInt32');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberBitwiseNOT(x) {
|
| 10 |
+
if (typeof x !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` argument must be a Number');
|
| 12 |
+
}
|
| 13 |
+
var oldValue = ToInt32(x);
|
| 14 |
+
// Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer.
|
| 15 |
+
return ~oldValue;
|
| 16 |
+
};
|
node_modules/es-abstract/2023/Number/bitwiseOR.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberBitwiseOR(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
return NumberBitwiseOp('|', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2023/Number/bitwiseXOR.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberBitwiseXOR(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
return NumberBitwiseOp('^', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2023/Number/divide.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isFinite = require('math-intrinsics/isFinite');
|
| 5 |
+
var isNaN = require('math-intrinsics/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberDivide(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) {
|
| 14 |
+
return NaN;
|
| 15 |
+
}
|
| 16 |
+
// shortcut for the actual spec mechanics
|
| 17 |
+
return x / y;
|
| 18 |
+
};
|
node_modules/es-abstract/2023/Number/equal.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isNaN = require('../../helpers/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberEqual(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
if (isNaN(x) || isNaN(y)) {
|
| 14 |
+
return false;
|
| 15 |
+
}
|
| 16 |
+
// shortcut for the actual spec mechanics
|
| 17 |
+
return x === y;
|
| 18 |
+
};
|
node_modules/es-abstract/2023/Number/exponentiate.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// var isNegativeZero = require('math-intrinsics/isNegativeZero');
|
| 4 |
+
var $pow = require('math-intrinsics/pow');
|
| 5 |
+
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
|
| 8 |
+
/*
|
| 9 |
+
var abs = require('math-intrinsics/abs');
|
| 10 |
+
var isFinite = require('math-intrinsics/isFinite');
|
| 11 |
+
var isNaN = require('math-intrinsics/isNaN');
|
| 12 |
+
|
| 13 |
+
var IsInteger = require('math-intrinsics/isInteger');
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate
|
| 17 |
+
|
| 18 |
+
/* eslint max-lines-per-function: 0, max-statements: 0 */
|
| 19 |
+
|
| 20 |
+
module.exports = function NumberExponentiate(base, exponent) {
|
| 21 |
+
if (typeof base !== 'number' || typeof exponent !== 'number') {
|
| 22 |
+
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers');
|
| 23 |
+
}
|
| 24 |
+
return $pow(base, exponent);
|
| 25 |
+
/*
|
| 26 |
+
if (isNaN(exponent)) {
|
| 27 |
+
return NaN;
|
| 28 |
+
}
|
| 29 |
+
if (exponent === 0) {
|
| 30 |
+
return 1;
|
| 31 |
+
}
|
| 32 |
+
if (isNaN(base)) {
|
| 33 |
+
return NaN;
|
| 34 |
+
}
|
| 35 |
+
var aB = abs(base);
|
| 36 |
+
if (aB > 1 && exponent === Infinity) {
|
| 37 |
+
return Infinity;
|
| 38 |
+
}
|
| 39 |
+
if (aB > 1 && exponent === -Infinity) {
|
| 40 |
+
return 0;
|
| 41 |
+
}
|
| 42 |
+
if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) {
|
| 43 |
+
return NaN;
|
| 44 |
+
}
|
| 45 |
+
if (aB < 1 && exponent === Infinity) {
|
| 46 |
+
return +0;
|
| 47 |
+
}
|
| 48 |
+
if (aB < 1 && exponent === -Infinity) {
|
| 49 |
+
return Infinity;
|
| 50 |
+
}
|
| 51 |
+
if (base === Infinity) {
|
| 52 |
+
return exponent > 0 ? Infinity : 0;
|
| 53 |
+
}
|
| 54 |
+
if (base === -Infinity) {
|
| 55 |
+
var isOdd = true;
|
| 56 |
+
if (exponent > 0) {
|
| 57 |
+
return isOdd ? -Infinity : Infinity;
|
| 58 |
+
}
|
| 59 |
+
return isOdd ? -0 : 0;
|
| 60 |
+
}
|
| 61 |
+
if (exponent > 0) {
|
| 62 |
+
return isNegativeZero(base) ? Infinity : 0;
|
| 63 |
+
}
|
| 64 |
+
if (isNegativeZero(base)) {
|
| 65 |
+
if (exponent > 0) {
|
| 66 |
+
return isOdd ? -0 : 0;
|
| 67 |
+
}
|
| 68 |
+
return isOdd ? -Infinity : Infinity;
|
| 69 |
+
}
|
| 70 |
+
if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) {
|
| 71 |
+
return NaN;
|
| 72 |
+
}
|
| 73 |
+
*/
|
| 74 |
+
};
|
node_modules/es-abstract/2023/Number/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var add = require('./add');
|
| 4 |
+
var bitwiseAND = require('./bitwiseAND');
|
| 5 |
+
var bitwiseNOT = require('./bitwiseNOT');
|
| 6 |
+
var bitwiseOR = require('./bitwiseOR');
|
| 7 |
+
var bitwiseXOR = require('./bitwiseXOR');
|
| 8 |
+
var divide = require('./divide');
|
| 9 |
+
var equal = require('./equal');
|
| 10 |
+
var exponentiate = require('./exponentiate');
|
| 11 |
+
var leftShift = require('./leftShift');
|
| 12 |
+
var lessThan = require('./lessThan');
|
| 13 |
+
var multiply = require('./multiply');
|
| 14 |
+
var remainder = require('./remainder');
|
| 15 |
+
var sameValue = require('./sameValue');
|
| 16 |
+
var sameValueZero = require('./sameValueZero');
|
| 17 |
+
var signedRightShift = require('./signedRightShift');
|
| 18 |
+
var subtract = require('./subtract');
|
| 19 |
+
var toString = require('./toString');
|
| 20 |
+
var unaryMinus = require('./unaryMinus');
|
| 21 |
+
var unsignedRightShift = require('./unsignedRightShift');
|
| 22 |
+
|
| 23 |
+
module.exports = {
|
| 24 |
+
add: add,
|
| 25 |
+
bitwiseAND: bitwiseAND,
|
| 26 |
+
bitwiseNOT: bitwiseNOT,
|
| 27 |
+
bitwiseOR: bitwiseOR,
|
| 28 |
+
bitwiseXOR: bitwiseXOR,
|
| 29 |
+
divide: divide,
|
| 30 |
+
equal: equal,
|
| 31 |
+
exponentiate: exponentiate,
|
| 32 |
+
leftShift: leftShift,
|
| 33 |
+
lessThan: lessThan,
|
| 34 |
+
multiply: multiply,
|
| 35 |
+
remainder: remainder,
|
| 36 |
+
sameValue: sameValue,
|
| 37 |
+
sameValueZero: sameValueZero,
|
| 38 |
+
signedRightShift: signedRightShift,
|
| 39 |
+
subtract: subtract,
|
| 40 |
+
toString: toString,
|
| 41 |
+
unaryMinus: unaryMinus,
|
| 42 |
+
unsignedRightShift: unsignedRightShift
|
| 43 |
+
};
|
node_modules/es-abstract/2023/Number/leftShift.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var ToInt32 = require('../ToInt32');
|
| 6 |
+
var ToUint32 = require('../ToUint32');
|
| 7 |
+
var modulo = require('../modulo');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift
|
| 10 |
+
|
| 11 |
+
module.exports = function NumberLeftShift(x, y) {
|
| 12 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
var lnum = ToInt32(x);
|
| 17 |
+
var rnum = ToUint32(y);
|
| 18 |
+
|
| 19 |
+
var shiftCount = modulo(rnum, 32);
|
| 20 |
+
|
| 21 |
+
return lnum << shiftCount;
|
| 22 |
+
};
|
node_modules/es-abstract/2023/Number/lessThan.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isNaN = require('../../helpers/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberLessThan(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
// If x is NaN, return undefined.
|
| 15 |
+
// If y is NaN, return undefined.
|
| 16 |
+
if (isNaN(x) || isNaN(y)) {
|
| 17 |
+
return void undefined;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
// shortcut for the actual spec mechanics
|
| 21 |
+
return x < y;
|
| 22 |
+
};
|
node_modules/es-abstract/2023/Number/multiply.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isNaN = require('../../helpers/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberMultiply(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) {
|
| 15 |
+
return NaN;
|
| 16 |
+
}
|
| 17 |
+
if (!isFinite(x) && !isFinite(y)) {
|
| 18 |
+
return x === y ? Infinity : -Infinity;
|
| 19 |
+
}
|
| 20 |
+
if (!isFinite(x) && y !== 0) {
|
| 21 |
+
return x > 0 ? Infinity : -Infinity;
|
| 22 |
+
}
|
| 23 |
+
if (!isFinite(y) && x !== 0) {
|
| 24 |
+
return y > 0 ? Infinity : -Infinity;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// shortcut for the actual spec mechanics
|
| 28 |
+
return x * y;
|
| 29 |
+
};
|
node_modules/es-abstract/2023/Number/remainder.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isNaN = require('math-intrinsics/isNaN');
|
| 5 |
+
var isFinite = require('math-intrinsics/isFinite');
|
| 6 |
+
|
| 7 |
+
var truncate = require('../truncate');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/14.0/#sec-numeric-types-number-remainder
|
| 10 |
+
|
| 11 |
+
module.exports = function NumberRemainder(n, d) {
|
| 12 |
+
if (typeof n !== 'number' || typeof d !== 'number') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
// If either operand is NaN, the result is NaN.
|
| 17 |
+
// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
|
| 18 |
+
if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) {
|
| 19 |
+
return NaN;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
|
| 23 |
+
// If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.
|
| 24 |
+
if (!isFinite(d) || n === 0) {
|
| 25 |
+
return n;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (!isFinite(n) || !isFinite(d) || n === 0 || d === 0) {
|
| 29 |
+
throw new $TypeError('Assertion failed: `n` and `d` arguments must be finite and nonzero');
|
| 30 |
+
}
|
| 31 |
+
var quotient = n / d;
|
| 32 |
+
var q = truncate(quotient);
|
| 33 |
+
var r = n - (d * q);
|
| 34 |
+
if (r === 0 && n < 0) {
|
| 35 |
+
return -0;
|
| 36 |
+
}
|
| 37 |
+
return r;
|
| 38 |
+
};
|
node_modules/es-abstract/2023/Number/sameValue.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var isNegativeZero = require('math-intrinsics/isNegativeZero');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
|
| 6 |
+
var NumberSameValueZero = require('./sameValueZero');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue
|
| 9 |
+
|
| 10 |
+
module.exports = function NumberSameValue(x, y) {
|
| 11 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 12 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 13 |
+
}
|
| 14 |
+
if (x === 0 && y === 0) {
|
| 15 |
+
return !(isNegativeZero(x) ^ isNegativeZero(y));
|
| 16 |
+
}
|
| 17 |
+
return NumberSameValueZero(x, y);
|
| 18 |
+
};
|
node_modules/es-abstract/2023/Number/sameValueZero.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isNaN = require('../../helpers/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberSameValueZero(x, y) {
|
| 10 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
var xNaN = isNaN(x);
|
| 15 |
+
var yNaN = isNaN(y);
|
| 16 |
+
if (xNaN || yNaN) {
|
| 17 |
+
return xNaN === yNaN;
|
| 18 |
+
}
|
| 19 |
+
return x === y;
|
| 20 |
+
};
|
node_modules/es-abstract/2023/Number/signedRightShift.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var ToInt32 = require('../ToInt32');
|
| 6 |
+
var ToUint32 = require('../ToUint32');
|
| 7 |
+
var modulo = require('../modulo');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift
|
| 10 |
+
|
| 11 |
+
module.exports = function NumberSignedRightShift(x, y) {
|
| 12 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
var lnum = ToInt32(x);
|
| 17 |
+
var rnum = ToUint32(y);
|
| 18 |
+
|
| 19 |
+
var shiftCount = modulo(rnum, 32);
|
| 20 |
+
|
| 21 |
+
return lnum >> shiftCount;
|
| 22 |
+
};
|
node_modules/es-abstract/2023/Number/subtract.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var NumberAdd = require('./add');
|
| 6 |
+
var NumberUnaryMinus = require('./unaryMinus');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract
|
| 9 |
+
|
| 10 |
+
module.exports = function NumberSubtract(x, y) {
|
| 11 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 12 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 13 |
+
}
|
| 14 |
+
return NumberAdd(x, NumberUnaryMinus(y));
|
| 15 |
+
};
|
node_modules/es-abstract/2023/Number/toString.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var callBound = require('call-bound');
|
| 5 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 6 |
+
|
| 7 |
+
var $numberToString = callBound('Number.prototype.toString');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/14.0/#sec-numeric-types-number-tostring
|
| 10 |
+
|
| 11 |
+
module.exports = function NumberToString(x, radix) {
|
| 12 |
+
if (typeof x !== 'number') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `x` must be a Number');
|
| 14 |
+
}
|
| 15 |
+
if (!isInteger(radix) || radix < 2 || radix > 36) {
|
| 16 |
+
throw new $TypeError('Assertion failed: `radix` must be an integer >= 2 and <= 36');
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
return $numberToString(x, radix); // steps 1 - 12
|
| 20 |
+
};
|
node_modules/es-abstract/2023/Number/unaryMinus.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isNaN = require('../../helpers/isNaN');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus
|
| 8 |
+
|
| 9 |
+
module.exports = function NumberUnaryMinus(x) {
|
| 10 |
+
if (typeof x !== 'number') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` argument must be a Number');
|
| 12 |
+
}
|
| 13 |
+
if (isNaN(x)) {
|
| 14 |
+
return NaN;
|
| 15 |
+
}
|
| 16 |
+
return -x;
|
| 17 |
+
};
|
node_modules/es-abstract/2023/Number/unsignedRightShift.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var ToInt32 = require('../ToInt32');
|
| 6 |
+
var ToUint32 = require('../ToUint32');
|
| 7 |
+
var modulo = require('../modulo');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift
|
| 10 |
+
|
| 11 |
+
module.exports = function NumberUnsignedRightShift(x, y) {
|
| 12 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
var lnum = ToInt32(x);
|
| 17 |
+
var rnum = ToUint32(y);
|
| 18 |
+
|
| 19 |
+
var shiftCount = modulo(rnum, 32);
|
| 20 |
+
|
| 21 |
+
return lnum >>> shiftCount;
|
| 22 |
+
};
|
node_modules/es-abstract/2023/NumberBitwiseOp.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var ToInt32 = require('./ToInt32');
|
| 6 |
+
var ToUint32 = require('./ToUint32');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/11.0/#sec-numberbitwiseop
|
| 9 |
+
|
| 10 |
+
module.exports = function NumberBitwiseOp(op, x, y) {
|
| 11 |
+
if (op !== '&' && op !== '|' && op !== '^') {
|
| 12 |
+
throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`');
|
| 13 |
+
}
|
| 14 |
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
| 15 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
| 16 |
+
}
|
| 17 |
+
var lnum = ToInt32(x);
|
| 18 |
+
var rnum = ToUint32(y);
|
| 19 |
+
if (op === '&') {
|
| 20 |
+
return lnum & rnum;
|
| 21 |
+
}
|
| 22 |
+
if (op === '|') {
|
| 23 |
+
return lnum | rnum;
|
| 24 |
+
}
|
| 25 |
+
return lnum ^ rnum;
|
| 26 |
+
};
|
node_modules/es-abstract/2023/NumberToBigInt.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 8 |
+
var $TypeError = require('es-errors/type');
|
| 9 |
+
|
| 10 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 11 |
+
|
| 12 |
+
// https://262.ecma-international.org/12.0/#sec-numbertobigint
|
| 13 |
+
|
| 14 |
+
module.exports = function NumberToBigInt(number) {
|
| 15 |
+
if (typeof number !== 'number') {
|
| 16 |
+
throw new $TypeError('Assertion failed: `number` must be a String');
|
| 17 |
+
}
|
| 18 |
+
if (!isInteger(number)) {
|
| 19 |
+
throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer');
|
| 20 |
+
}
|
| 21 |
+
if (!$BigInt) {
|
| 22 |
+
throw new $SyntaxError('BigInts are not supported in this environment');
|
| 23 |
+
}
|
| 24 |
+
return $BigInt(number);
|
| 25 |
+
};
|
node_modules/es-abstract/2023/NumericToRawBytes.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var hasOwnProperty = require('./HasOwnProperty');
|
| 6 |
+
var ToBigInt64 = require('./ToBigInt64');
|
| 7 |
+
var ToBigUint64 = require('./ToBigUint64');
|
| 8 |
+
var ToInt16 = require('./ToInt16');
|
| 9 |
+
var ToInt32 = require('./ToInt32');
|
| 10 |
+
var ToInt8 = require('./ToInt8');
|
| 11 |
+
var ToUint16 = require('./ToUint16');
|
| 12 |
+
var ToUint32 = require('./ToUint32');
|
| 13 |
+
var ToUint8 = require('./ToUint8');
|
| 14 |
+
var ToUint8Clamp = require('./ToUint8Clamp');
|
| 15 |
+
|
| 16 |
+
var valueToFloat32Bytes = require('../helpers/valueToFloat32Bytes');
|
| 17 |
+
var valueToFloat64Bytes = require('../helpers/valueToFloat64Bytes');
|
| 18 |
+
var integerToNBytes = require('../helpers/integerToNBytes');
|
| 19 |
+
|
| 20 |
+
var tableTAO = require('./tables/typed-array-objects');
|
| 21 |
+
|
| 22 |
+
// https://262.ecma-international.org/11.0/#table-the-typedarray-constructors
|
| 23 |
+
var TypeToAO = {
|
| 24 |
+
__proto__: null,
|
| 25 |
+
$Int8: ToInt8,
|
| 26 |
+
$Uint8: ToUint8,
|
| 27 |
+
$Uint8C: ToUint8Clamp,
|
| 28 |
+
$Int16: ToInt16,
|
| 29 |
+
$Uint16: ToUint16,
|
| 30 |
+
$Int32: ToInt32,
|
| 31 |
+
$Uint32: ToUint32,
|
| 32 |
+
$BigInt64: ToBigInt64,
|
| 33 |
+
$BigUint64: ToBigUint64
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
// https://262.ecma-international.org/11.0/#sec-numerictorawbytes
|
| 37 |
+
|
| 38 |
+
module.exports = function NumericToRawBytes(type, value, isLittleEndian) {
|
| 39 |
+
if (typeof type !== 'string' || !hasOwnProperty(tableTAO.size, '$' + type)) {
|
| 40 |
+
throw new $TypeError('Assertion failed: `type` must be a TypedArray element type');
|
| 41 |
+
}
|
| 42 |
+
if (typeof value !== 'number' && typeof value !== 'bigint') {
|
| 43 |
+
throw new $TypeError('Assertion failed: `value` must be a Number or a BigInt');
|
| 44 |
+
}
|
| 45 |
+
if (typeof isLittleEndian !== 'boolean') {
|
| 46 |
+
throw new $TypeError('Assertion failed: `isLittleEndian` must be a Boolean');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
if (type === 'Float32') { // step 1
|
| 50 |
+
return valueToFloat32Bytes(value, isLittleEndian);
|
| 51 |
+
} else if (type === 'Float64') { // step 2
|
| 52 |
+
return valueToFloat64Bytes(value, isLittleEndian);
|
| 53 |
+
} // step 3
|
| 54 |
+
|
| 55 |
+
var n = tableTAO.size['$' + type]; // step 3.a
|
| 56 |
+
|
| 57 |
+
var convOp = TypeToAO['$' + type]; // step 3.b
|
| 58 |
+
|
| 59 |
+
var intValue = convOp(value); // step 3.c
|
| 60 |
+
|
| 61 |
+
return integerToNBytes(intValue, n, isLittleEndian); // step 3.d, 3.e, 4
|
| 62 |
+
};
|
node_modules/es-abstract/2023/ObjectDefineProperties.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
|
| 4 |
+
var Get = require('./Get');
|
| 5 |
+
var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty');
|
| 6 |
+
var ToObject = require('./ToObject');
|
| 7 |
+
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
| 8 |
+
|
| 9 |
+
var forEach = require('../helpers/forEach');
|
| 10 |
+
var OwnPropertyKeys = require('own-keys');
|
| 11 |
+
|
| 12 |
+
// https://262.ecma-international.org/6.0/#sec-objectdefineproperties
|
| 13 |
+
|
| 14 |
+
/** @type {<T extends Record<PropertyKey, unknown> = {}>(O: T, Properties: object) => T} */
|
| 15 |
+
module.exports = function ObjectDefineProperties(O, Properties) {
|
| 16 |
+
var props = ToObject(Properties); // step 1
|
| 17 |
+
var keys = OwnPropertyKeys(props); // step 2
|
| 18 |
+
/** @type {[string | symbol, import('../types').Descriptor][]} */
|
| 19 |
+
var descriptors = []; // step 3
|
| 20 |
+
|
| 21 |
+
forEach(keys, function (nextKey) { // step 4
|
| 22 |
+
var propDesc = OrdinaryGetOwnProperty(props, nextKey); // ToPropertyDescriptor(getOwnPropertyDescriptor(props, nextKey)); // step 4.a
|
| 23 |
+
if (typeof propDesc !== 'undefined' && propDesc['[[Enumerable]]']) { // step 4.b
|
| 24 |
+
var descObj = Get(props, nextKey); // step 4.b.i
|
| 25 |
+
var desc = ToPropertyDescriptor(descObj); // step 4.b.ii
|
| 26 |
+
descriptors[descriptors.length] = [nextKey, desc]; // step 4.b.iii
|
| 27 |
+
}
|
| 28 |
+
});
|
| 29 |
+
|
| 30 |
+
forEach(descriptors, function (pair) { // step 5
|
| 31 |
+
var P = pair[0]; // step 5.a
|
| 32 |
+
var desc = pair[1]; // step 5.b
|
| 33 |
+
DefinePropertyOrThrow(O, P, desc); // step 5.c
|
| 34 |
+
});
|
| 35 |
+
|
| 36 |
+
return O; // step 6
|
| 37 |
+
};
|
node_modules/es-abstract/2023/OrdinaryCreateFromConstructor.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
|
| 6 |
+
var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor');
|
| 7 |
+
var IsArray = require('./IsArray');
|
| 8 |
+
var OrdinaryObjectCreate = require('./OrdinaryObjectCreate');
|
| 9 |
+
|
| 10 |
+
// https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor
|
| 11 |
+
|
| 12 |
+
module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) {
|
| 13 |
+
GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
|
| 14 |
+
var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto);
|
| 15 |
+
var slots = arguments.length < 3 ? [] : arguments[2];
|
| 16 |
+
if (!IsArray(slots)) {
|
| 17 |
+
throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List');
|
| 18 |
+
}
|
| 19 |
+
return OrdinaryObjectCreate(proto, slots);
|
| 20 |
+
};
|
node_modules/es-abstract/2023/OrdinaryDefineOwnProperty.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $gOPD = require('gopd');
|
| 4 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 5 |
+
var $TypeError = require('es-errors/type');
|
| 6 |
+
var isObject = require('es-object-atoms/isObject');
|
| 7 |
+
|
| 8 |
+
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
|
| 9 |
+
|
| 10 |
+
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
|
| 11 |
+
var IsExtensible = require('./IsExtensible');
|
| 12 |
+
var isPropertyKey = require('../helpers/isPropertyKey');
|
| 13 |
+
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
| 14 |
+
var SameValue = require('./SameValue');
|
| 15 |
+
var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor');
|
| 16 |
+
|
| 17 |
+
// https://262.ecma-international.org/6.0/#sec-ordinarydefineownproperty
|
| 18 |
+
|
| 19 |
+
module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) {
|
| 20 |
+
if (!isObject(O)) {
|
| 21 |
+
throw new $TypeError('Assertion failed: O must be an Object');
|
| 22 |
+
}
|
| 23 |
+
if (!isPropertyKey(P)) {
|
| 24 |
+
throw new $TypeError('Assertion failed: P must be a Property Key');
|
| 25 |
+
}
|
| 26 |
+
if (!isPropertyDescriptor(Desc)) {
|
| 27 |
+
throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
|
| 28 |
+
}
|
| 29 |
+
if (!$gOPD) {
|
| 30 |
+
// ES3/IE 8 fallback
|
| 31 |
+
if (IsAccessorDescriptor(Desc)) {
|
| 32 |
+
throw new $SyntaxError('This environment does not support accessor property descriptors.');
|
| 33 |
+
}
|
| 34 |
+
var creatingNormalDataProperty = !(P in O)
|
| 35 |
+
&& Desc['[[Writable]]']
|
| 36 |
+
&& Desc['[[Enumerable]]']
|
| 37 |
+
&& Desc['[[Configurable]]']
|
| 38 |
+
&& '[[Value]]' in Desc;
|
| 39 |
+
var settingExistingDataProperty = (P in O)
|
| 40 |
+
&& (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]'])
|
| 41 |
+
&& (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]'])
|
| 42 |
+
&& (!('[[Writable]]' in Desc) || Desc['[[Writable]]'])
|
| 43 |
+
&& '[[Value]]' in Desc;
|
| 44 |
+
if (creatingNormalDataProperty || settingExistingDataProperty) {
|
| 45 |
+
O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign
|
| 46 |
+
return SameValue(O[P], Desc['[[Value]]']);
|
| 47 |
+
}
|
| 48 |
+
throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties');
|
| 49 |
+
}
|
| 50 |
+
var desc = $gOPD(O, P);
|
| 51 |
+
var current = desc && ToPropertyDescriptor(desc);
|
| 52 |
+
var extensible = IsExtensible(O);
|
| 53 |
+
return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current);
|
| 54 |
+
};
|
node_modules/es-abstract/2023/OrdinaryGetOwnProperty.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $gOPD = require('gopd');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
var isObject = require('es-object-atoms/isObject');
|
| 6 |
+
var callBound = require('call-bound');
|
| 7 |
+
|
| 8 |
+
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
| 9 |
+
|
| 10 |
+
var hasOwn = require('hasown');
|
| 11 |
+
|
| 12 |
+
var IsArray = require('./IsArray');
|
| 13 |
+
var isPropertyKey = require('../helpers/isPropertyKey');
|
| 14 |
+
var IsRegExp = require('./IsRegExp');
|
| 15 |
+
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
| 16 |
+
|
| 17 |
+
// https://262.ecma-international.org/6.0/#sec-ordinarygetownproperty
|
| 18 |
+
|
| 19 |
+
module.exports = function OrdinaryGetOwnProperty(O, P) {
|
| 20 |
+
if (!isObject(O)) {
|
| 21 |
+
throw new $TypeError('Assertion failed: O must be an Object');
|
| 22 |
+
}
|
| 23 |
+
if (!isPropertyKey(P)) {
|
| 24 |
+
throw new $TypeError('Assertion failed: P must be a Property Key');
|
| 25 |
+
}
|
| 26 |
+
if (!hasOwn(O, P)) {
|
| 27 |
+
return void 0;
|
| 28 |
+
}
|
| 29 |
+
if (!$gOPD) {
|
| 30 |
+
// ES3 / IE 8 fallback
|
| 31 |
+
var arrayLength = IsArray(O) && P === 'length';
|
| 32 |
+
var regexLastIndex = IsRegExp(O) && P === 'lastIndex';
|
| 33 |
+
return {
|
| 34 |
+
'[[Configurable]]': !(arrayLength || regexLastIndex),
|
| 35 |
+
'[[Enumerable]]': $isEnumerable(O, P),
|
| 36 |
+
'[[Value]]': O[P],
|
| 37 |
+
'[[Writable]]': true
|
| 38 |
+
};
|
| 39 |
+
}
|
| 40 |
+
return ToPropertyDescriptor($gOPD(O, P));
|
| 41 |
+
};
|
node_modules/es-abstract/2023/OrdinaryGetPrototypeOf.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
|
| 6 |
+
var $getProto = require('get-proto');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof
|
| 9 |
+
|
| 10 |
+
module.exports = function OrdinaryGetPrototypeOf(O) {
|
| 11 |
+
if (!isObject(O)) {
|
| 12 |
+
throw new $TypeError('Assertion failed: O must be an Object');
|
| 13 |
+
}
|
| 14 |
+
if (!$getProto) {
|
| 15 |
+
throw new $TypeError('This environment does not support fetching prototypes.');
|
| 16 |
+
}
|
| 17 |
+
return $getProto(O);
|
| 18 |
+
};
|
node_modules/es-abstract/2023/OrdinaryHasInstance.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
|
| 6 |
+
var Get = require('./Get');
|
| 7 |
+
var IsCallable = require('./IsCallable');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
|
| 10 |
+
|
| 11 |
+
module.exports = function OrdinaryHasInstance(C, O) {
|
| 12 |
+
if (!IsCallable(C)) {
|
| 13 |
+
return false;
|
| 14 |
+
}
|
| 15 |
+
if (!isObject(O)) {
|
| 16 |
+
return false;
|
| 17 |
+
}
|
| 18 |
+
var P = Get(C, 'prototype');
|
| 19 |
+
if (!isObject(P)) {
|
| 20 |
+
throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
|
| 21 |
+
}
|
| 22 |
+
return O instanceof C;
|
| 23 |
+
};
|
node_modules/es-abstract/2023/OrdinaryHasProperty.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
|
| 6 |
+
var isPropertyKey = require('../helpers/isPropertyKey');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty
|
| 9 |
+
|
| 10 |
+
module.exports = function OrdinaryHasProperty(O, P) {
|
| 11 |
+
if (!isObject(O)) {
|
| 12 |
+
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
| 13 |
+
}
|
| 14 |
+
if (!isPropertyKey(P)) {
|
| 15 |
+
throw new $TypeError('Assertion failed: P must be a Property Key');
|
| 16 |
+
}
|
| 17 |
+
return P in O;
|
| 18 |
+
};
|
node_modules/es-abstract/2023/OrdinaryObjectCreate.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $ObjectCreate = GetIntrinsic('%Object.create%', true);
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 8 |
+
var isObject = require('es-object-atoms/isObject');
|
| 9 |
+
|
| 10 |
+
var IsArray = require('./IsArray');
|
| 11 |
+
|
| 12 |
+
var forEach = require('../helpers/forEach');
|
| 13 |
+
|
| 14 |
+
var SLOT = require('internal-slot');
|
| 15 |
+
|
| 16 |
+
var hasProto = require('has-proto')();
|
| 17 |
+
|
| 18 |
+
// https://262.ecma-international.org/11.0/#sec-objectcreate
|
| 19 |
+
|
| 20 |
+
module.exports = function OrdinaryObjectCreate(proto) {
|
| 21 |
+
if (proto !== null && !isObject(proto)) {
|
| 22 |
+
throw new $TypeError('Assertion failed: `proto` must be null or an object');
|
| 23 |
+
}
|
| 24 |
+
var additionalInternalSlotsList = arguments.length < 2 ? [] : arguments[1];
|
| 25 |
+
if (!IsArray(additionalInternalSlotsList)) {
|
| 26 |
+
throw new $TypeError('Assertion failed: `additionalInternalSlotsList` must be an Array');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
// var internalSlotsList = ['[[Prototype]]', '[[Extensible]]']; // step 1
|
| 30 |
+
// internalSlotsList.push(...additionalInternalSlotsList); // step 2
|
| 31 |
+
// var O = MakeBasicObject(internalSlotsList); // step 3
|
| 32 |
+
// setProto(O, proto); // step 4
|
| 33 |
+
// return O; // step 5
|
| 34 |
+
|
| 35 |
+
var O;
|
| 36 |
+
if (hasProto) {
|
| 37 |
+
O = { __proto__: proto };
|
| 38 |
+
} else if ($ObjectCreate) {
|
| 39 |
+
O = $ObjectCreate(proto);
|
| 40 |
+
} else {
|
| 41 |
+
if (proto === null) {
|
| 42 |
+
throw new $SyntaxError('native Object.create support is required to create null objects');
|
| 43 |
+
}
|
| 44 |
+
var T = function T() {};
|
| 45 |
+
T.prototype = proto;
|
| 46 |
+
O = new T();
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
if (additionalInternalSlotsList.length > 0) {
|
| 50 |
+
forEach(additionalInternalSlotsList, function (slot) {
|
| 51 |
+
SLOT.set(O, slot, void undefined);
|
| 52 |
+
});
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return O;
|
| 56 |
+
};
|
node_modules/es-abstract/2023/OrdinarySetPrototypeOf.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var $setProto = require('set-proto');
|
| 5 |
+
var isObject = require('es-object-atoms/isObject');
|
| 6 |
+
|
| 7 |
+
var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof
|
| 10 |
+
|
| 11 |
+
module.exports = function OrdinarySetPrototypeOf(O, V) {
|
| 12 |
+
if (V !== null && !isObject(V)) {
|
| 13 |
+
throw new $TypeError('Assertion failed: V must be Object or Null');
|
| 14 |
+
}
|
| 15 |
+
/*
|
| 16 |
+
var extensible = IsExtensible(O);
|
| 17 |
+
var current = OrdinaryGetPrototypeOf(O);
|
| 18 |
+
if (SameValue(V, current)) {
|
| 19 |
+
return true;
|
| 20 |
+
}
|
| 21 |
+
if (!extensible) {
|
| 22 |
+
return false;
|
| 23 |
+
}
|
| 24 |
+
*/
|
| 25 |
+
try {
|
| 26 |
+
$setProto(O, V);
|
| 27 |
+
} catch (e) {
|
| 28 |
+
return false;
|
| 29 |
+
}
|
| 30 |
+
return OrdinaryGetPrototypeOf(O) === V;
|
| 31 |
+
/*
|
| 32 |
+
var p = V;
|
| 33 |
+
var done = false;
|
| 34 |
+
while (!done) {
|
| 35 |
+
if (p === null) {
|
| 36 |
+
done = true;
|
| 37 |
+
} else if (SameValue(p, O)) {
|
| 38 |
+
return false;
|
| 39 |
+
} else {
|
| 40 |
+
if (wat) {
|
| 41 |
+
done = true;
|
| 42 |
+
} else {
|
| 43 |
+
p = p.[[Prototype]];
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
O.[[Prototype]] = V;
|
| 48 |
+
return true;
|
| 49 |
+
*/
|
| 50 |
+
};
|
node_modules/es-abstract/2023/OrdinaryToPrimitive.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
|
| 6 |
+
var Call = require('./Call');
|
| 7 |
+
var Get = require('./Get');
|
| 8 |
+
var IsCallable = require('./IsCallable');
|
| 9 |
+
|
| 10 |
+
var inspect = require('object-inspect');
|
| 11 |
+
|
| 12 |
+
// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive
|
| 13 |
+
|
| 14 |
+
module.exports = function OrdinaryToPrimitive(O, hint) {
|
| 15 |
+
if (!isObject(O)) {
|
| 16 |
+
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
| 17 |
+
}
|
| 18 |
+
if (/* typeof hint !== 'string' || */ hint !== 'string' && hint !== 'number') {
|
| 19 |
+
throw new $TypeError('Assertion failed: `hint` must be "string" or "number"');
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
|
| 23 |
+
|
| 24 |
+
for (var i = 0; i < methodNames.length; i += 1) {
|
| 25 |
+
var name = methodNames[i];
|
| 26 |
+
var method = Get(O, name);
|
| 27 |
+
if (IsCallable(method)) {
|
| 28 |
+
var result = Call(method, O);
|
| 29 |
+
if (!isObject(result)) {
|
| 30 |
+
return result;
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
throw new $TypeError('No primitive value for ' + inspect(O));
|
| 36 |
+
};
|
node_modules/es-abstract/2023/ParseHexOctet.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
|
| 6 |
+
var substring = require('./substring');
|
| 7 |
+
|
| 8 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 9 |
+
var isNaN = require('math-intrinsics/isNaN');
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/14.0/#sec-parsehexoctet
|
| 12 |
+
|
| 13 |
+
module.exports = function ParseHexOctet(string, position) {
|
| 14 |
+
if (typeof string !== 'string') {
|
| 15 |
+
throw new $TypeError('Assertion failed: `string` must be a String');
|
| 16 |
+
}
|
| 17 |
+
if (!isInteger(position) || position < 0) {
|
| 18 |
+
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer');
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
var len = string.length; // step 1
|
| 22 |
+
if ((position + 2) > len) { // step 2
|
| 23 |
+
var error = new $SyntaxError('requested a position on a string that does not contain 2 characters at that position'); // step 2.a
|
| 24 |
+
return [error]; // step 2.b
|
| 25 |
+
}
|
| 26 |
+
var hexDigits = substring(string, position, position + 2); // step 3
|
| 27 |
+
|
| 28 |
+
var n = +('0x' + hexDigits);
|
| 29 |
+
if (isNaN(n)) {
|
| 30 |
+
return [new $SyntaxError('Invalid hexadecimal characters')];
|
| 31 |
+
}
|
| 32 |
+
return n;
|
| 33 |
+
|
| 34 |
+
/*
|
| 35 |
+
4. Let _parseResult_ be ParseText(StringToCodePoints(_hexDigits_), |HexDigits[~Sep]|).
|
| 36 |
+
5. If _parseResult_ is not a Parse Node, return _parseResult_.
|
| 37 |
+
6. Let _n_ be the unsigned 8-bit value corresponding with the MV of _parseResult_.
|
| 38 |
+
7. Return _n_.
|
| 39 |
+
*/
|
| 40 |
+
};
|
node_modules/es-abstract/2023/PromiseResolve.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
var callBind = require('call-bind');
|
| 5 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 6 |
+
|
| 7 |
+
var $resolve = GetIntrinsic('%Promise.resolve%', true);
|
| 8 |
+
var $PromiseResolve = $resolve && callBind($resolve);
|
| 9 |
+
|
| 10 |
+
// https://262.ecma-international.org/9.0/#sec-promise-resolve
|
| 11 |
+
|
| 12 |
+
module.exports = function PromiseResolve(C, x) {
|
| 13 |
+
if (!$PromiseResolve) {
|
| 14 |
+
throw new $SyntaxError('This environment does not support Promises.');
|
| 15 |
+
}
|
| 16 |
+
return $PromiseResolve(C, x);
|
| 17 |
+
};
|
| 18 |
+
|
node_modules/es-abstract/2023/QuoteJSONString.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var callBound = require('call-bound');
|
| 6 |
+
var forEach = require('../helpers/forEach');
|
| 7 |
+
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
|
| 8 |
+
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
|
| 9 |
+
|
| 10 |
+
var $charCodeAt = callBound('String.prototype.charCodeAt');
|
| 11 |
+
var $strSplit = callBound('String.prototype.split');
|
| 12 |
+
|
| 13 |
+
var StringToCodePoints = require('./StringToCodePoints');
|
| 14 |
+
var UnicodeEscape = require('./UnicodeEscape');
|
| 15 |
+
var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint');
|
| 16 |
+
|
| 17 |
+
var hasOwn = require('hasown');
|
| 18 |
+
|
| 19 |
+
// https://262.ecma-international.org/12.0/#sec-quotejsonstring
|
| 20 |
+
|
| 21 |
+
var escapes = {
|
| 22 |
+
'\u0008': '\\b',
|
| 23 |
+
'\u0009': '\\t',
|
| 24 |
+
'\u000A': '\\n',
|
| 25 |
+
'\u000C': '\\f',
|
| 26 |
+
'\u000D': '\\r',
|
| 27 |
+
'\u0022': '\\"',
|
| 28 |
+
'\u005c': '\\\\'
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
module.exports = function QuoteJSONString(value) {
|
| 32 |
+
if (typeof value !== 'string') {
|
| 33 |
+
throw new $TypeError('Assertion failed: `value` must be a String');
|
| 34 |
+
}
|
| 35 |
+
var product = '"';
|
| 36 |
+
if (value) {
|
| 37 |
+
forEach($strSplit(StringToCodePoints(value), ''), function (C) {
|
| 38 |
+
if (hasOwn(escapes, C)) {
|
| 39 |
+
product += escapes[C];
|
| 40 |
+
} else {
|
| 41 |
+
var cCharCode = $charCodeAt(C, 0);
|
| 42 |
+
if (cCharCode < 0x20 || isLeadingSurrogate(cCharCode) || isTrailingSurrogate(cCharCode)) {
|
| 43 |
+
product += UnicodeEscape(C);
|
| 44 |
+
} else {
|
| 45 |
+
product += UTF16EncodeCodePoint(cCharCode);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
});
|
| 49 |
+
}
|
| 50 |
+
product += '"';
|
| 51 |
+
return product;
|
| 52 |
+
};
|
node_modules/es-abstract/2023/RawBytesToNumeric.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
var callBound = require('call-bound');
|
| 5 |
+
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 8 |
+
var $TypeError = require('es-errors/type');
|
| 9 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 10 |
+
|
| 11 |
+
var hasOwnProperty = require('./HasOwnProperty');
|
| 12 |
+
var IsArray = require('./IsArray');
|
| 13 |
+
var IsBigIntElementType = require('./IsBigIntElementType');
|
| 14 |
+
var IsUnsignedElementType = require('./IsUnsignedElementType');
|
| 15 |
+
|
| 16 |
+
var bytesAsFloat32 = require('../helpers/bytesAsFloat32');
|
| 17 |
+
var bytesAsFloat64 = require('../helpers/bytesAsFloat64');
|
| 18 |
+
var bytesAsInteger = require('../helpers/bytesAsInteger');
|
| 19 |
+
var every = require('../helpers/every');
|
| 20 |
+
var isByteValue = require('../helpers/isByteValue');
|
| 21 |
+
|
| 22 |
+
var $reverse = callBound('Array.prototype.reverse');
|
| 23 |
+
var $slice = callBound('Array.prototype.slice');
|
| 24 |
+
|
| 25 |
+
var tableTAO = require('./tables/typed-array-objects');
|
| 26 |
+
|
| 27 |
+
// https://262.ecma-international.org/11.0/#sec-rawbytestonumeric
|
| 28 |
+
|
| 29 |
+
module.exports = function RawBytesToNumeric(type, rawBytes, isLittleEndian) {
|
| 30 |
+
if (typeof type !== 'string' || !hasOwnProperty(tableTAO.size, '$' + type)) {
|
| 31 |
+
throw new $TypeError('Assertion failed: `type` must be a TypedArray element type');
|
| 32 |
+
}
|
| 33 |
+
if (!IsArray(rawBytes) || !every(rawBytes, isByteValue)) {
|
| 34 |
+
throw new $TypeError('Assertion failed: `rawBytes` must be an Array of bytes');
|
| 35 |
+
}
|
| 36 |
+
if (typeof isLittleEndian !== 'boolean') {
|
| 37 |
+
throw new $TypeError('Assertion failed: `isLittleEndian` must be a Boolean');
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
var elementSize = tableTAO.size['$' + type]; // step 1
|
| 41 |
+
|
| 42 |
+
if (rawBytes.length !== elementSize) {
|
| 43 |
+
// this assertion is not in the spec, but it'd be an editorial error if it were ever violated
|
| 44 |
+
throw new $RangeError('Assertion failed: `rawBytes` must have a length of ' + elementSize + ' for type ' + type);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
var isBigInt = IsBigIntElementType(type);
|
| 48 |
+
if (isBigInt && !$BigInt) {
|
| 49 |
+
throw new $SyntaxError('this environment does not support BigInts');
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// eslint-disable-next-line no-param-reassign
|
| 53 |
+
rawBytes = $slice(rawBytes, 0, elementSize);
|
| 54 |
+
if (!isLittleEndian) {
|
| 55 |
+
$reverse(rawBytes); // step 2
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
if (type === 'Float32') { // step 3
|
| 59 |
+
return bytesAsFloat32(rawBytes);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
if (type === 'Float64') { // step 4
|
| 63 |
+
return bytesAsFloat64(rawBytes);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
return bytesAsInteger(rawBytes, elementSize, IsUnsignedElementType(type), isBigInt);
|
| 67 |
+
};
|
node_modules/es-abstract/2023/RegExpCreate.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $RegExp = GetIntrinsic('%RegExp%');
|
| 6 |
+
|
| 7 |
+
// var RegExpAlloc = require('./RegExpAlloc');
|
| 8 |
+
// var RegExpInitialize = require('./RegExpInitialize');
|
| 9 |
+
var ToString = require('./ToString');
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/6.0/#sec-regexpcreate
|
| 12 |
+
|
| 13 |
+
module.exports = function RegExpCreate(P, F) {
|
| 14 |
+
// var obj = RegExpAlloc($RegExp);
|
| 15 |
+
// return RegExpInitialize(obj, P, F);
|
| 16 |
+
|
| 17 |
+
// covers spec mechanics; bypass regex brand checking
|
| 18 |
+
var pattern = typeof P === 'undefined' ? '' : ToString(P);
|
| 19 |
+
var flags = typeof F === 'undefined' ? '' : ToString(F);
|
| 20 |
+
return new $RegExp(pattern, flags);
|
| 21 |
+
};
|
node_modules/es-abstract/2023/RegExpExec.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
var regexExec = require('call-bound')('RegExp.prototype.exec');
|
| 6 |
+
|
| 7 |
+
var Call = require('./Call');
|
| 8 |
+
var Get = require('./Get');
|
| 9 |
+
var IsCallable = require('./IsCallable');
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/6.0/#sec-regexpexec
|
| 12 |
+
|
| 13 |
+
module.exports = function RegExpExec(R, S) {
|
| 14 |
+
if (!isObject(R)) {
|
| 15 |
+
throw new $TypeError('Assertion failed: `R` must be an Object');
|
| 16 |
+
}
|
| 17 |
+
if (typeof S !== 'string') {
|
| 18 |
+
throw new $TypeError('Assertion failed: `S` must be a String');
|
| 19 |
+
}
|
| 20 |
+
var exec = Get(R, 'exec');
|
| 21 |
+
if (IsCallable(exec)) {
|
| 22 |
+
var result = Call(exec, R, [S]);
|
| 23 |
+
if (result === null || isObject(result)) {
|
| 24 |
+
return result;
|
| 25 |
+
}
|
| 26 |
+
throw new $TypeError('"exec" method must return `null` or an Object');
|
| 27 |
+
}
|
| 28 |
+
return regexExec(R, S);
|
| 29 |
+
};
|
node_modules/es-abstract/2023/RegExpHasFlag.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
var callBound = require('call-bound');
|
| 5 |
+
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var isObject = require('es-object-atoms/isObject');
|
| 8 |
+
var $RegExpPrototype = GetIntrinsic('%RegExp.prototype%');
|
| 9 |
+
|
| 10 |
+
var SameValue = require('./SameValue');
|
| 11 |
+
|
| 12 |
+
var $indexOf = callBound('String.prototype.indexOf');
|
| 13 |
+
|
| 14 |
+
var hasRegExpMatcher = require('is-regex');
|
| 15 |
+
var getFlags = require('regexp.prototype.flags');
|
| 16 |
+
|
| 17 |
+
// https://262.ecma-international.org/13.0/#sec-regexphasflag
|
| 18 |
+
|
| 19 |
+
module.exports = function RegExpHasFlag(R, codeUnit) {
|
| 20 |
+
if (typeof codeUnit !== 'string' || codeUnit.length !== 1) {
|
| 21 |
+
throw new $TypeError('Assertion failed: `string` must be a code unit - a String of length 1');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
if (!isObject(R)) {
|
| 25 |
+
throw new $TypeError('Assertion failed: Type(R) is not Object');
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (!hasRegExpMatcher(R)) { // step 2
|
| 29 |
+
if (SameValue(R, $RegExpPrototype)) {
|
| 30 |
+
return void undefined; // step 2.a
|
| 31 |
+
}
|
| 32 |
+
throw new $TypeError('`R` must be a RegExp object'); // step 2.b
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
var flags = getFlags(R); // step 3
|
| 36 |
+
|
| 37 |
+
return $indexOf(flags, codeUnit) > -1; // steps 4-5
|
| 38 |
+
};
|
node_modules/es-abstract/2023/RequireObjectCoercible.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
module.exports = require('es-object-atoms/RequireObjectCoercible');
|
node_modules/es-abstract/2023/SameValue.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $isNaN = require('math-intrinsics/isNaN');
|
| 4 |
+
|
| 5 |
+
// http://262.ecma-international.org/5.1/#sec-9.12
|
| 6 |
+
|
| 7 |
+
module.exports = function SameValue(x, y) {
|
| 8 |
+
if (x === y) { // 0 === -0, but they are not identical.
|
| 9 |
+
if (x === 0) { return 1 / x === 1 / y; }
|
| 10 |
+
return true;
|
| 11 |
+
}
|
| 12 |
+
return $isNaN(x) && $isNaN(y);
|
| 13 |
+
};
|
node_modules/es-abstract/2023/SameValueNonNumber.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var SameValue = require('./SameValue');
|
| 6 |
+
var Type = require('./Type');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/14.0/#sec-samevaluenonnumeric
|
| 9 |
+
|
| 10 |
+
module.exports = function SameValueNonNumber(x, y) {
|
| 11 |
+
if (typeof x === 'number') {
|
| 12 |
+
throw new $TypeError('Assertion failed: SameValueNonNumber does not accept Number values');
|
| 13 |
+
}
|
| 14 |
+
if (Type(x) !== Type(y)) {
|
| 15 |
+
throw new $TypeError('SameValueNonNumber requires two non-Number values of the same type.');
|
| 16 |
+
}
|
| 17 |
+
return SameValue(x, y);
|
| 18 |
+
};
|
node_modules/es-abstract/2023/SameValueZero.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $isNaN = require('math-intrinsics/isNaN');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/6.0/#sec-samevaluezero
|
| 6 |
+
|
| 7 |
+
module.exports = function SameValueZero(x, y) {
|
| 8 |
+
return (x === y) || ($isNaN(x) && $isNaN(y));
|
| 9 |
+
};
|
node_modules/es-abstract/2023/SecFromTime.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var floor = require('./floor');
|
| 4 |
+
var modulo = require('./modulo');
|
| 5 |
+
|
| 6 |
+
var timeConstants = require('../helpers/timeConstants');
|
| 7 |
+
var msPerSecond = timeConstants.msPerSecond;
|
| 8 |
+
var SecondsPerMinute = timeConstants.SecondsPerMinute;
|
| 9 |
+
|
| 10 |
+
// https://262.ecma-international.org/5.1/#sec-15.9.1.10
|
| 11 |
+
|
| 12 |
+
module.exports = function SecFromTime(t) {
|
| 13 |
+
return modulo(floor(t / msPerSecond), SecondsPerMinute);
|
| 14 |
+
};
|
node_modules/es-abstract/2023/Set.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
|
| 6 |
+
var isPropertyKey = require('../helpers/isPropertyKey');
|
| 7 |
+
var SameValue = require('./SameValue');
|
| 8 |
+
|
| 9 |
+
// IE 9 does not throw in strict mode when writability/configurability/extensibility is violated
|
| 10 |
+
var noThrowOnStrictViolation = (function () {
|
| 11 |
+
try {
|
| 12 |
+
delete [].length;
|
| 13 |
+
return true;
|
| 14 |
+
} catch (e) {
|
| 15 |
+
return false;
|
| 16 |
+
}
|
| 17 |
+
}());
|
| 18 |
+
|
| 19 |
+
// https://262.ecma-international.org/6.0/#sec-set-o-p-v-throw
|
| 20 |
+
|
| 21 |
+
module.exports = function Set(O, P, V, Throw) {
|
| 22 |
+
if (!isObject(O)) {
|
| 23 |
+
throw new $TypeError('Assertion failed: `O` must be an Object');
|
| 24 |
+
}
|
| 25 |
+
if (!isPropertyKey(P)) {
|
| 26 |
+
throw new $TypeError('Assertion failed: `P` must be a Property Key');
|
| 27 |
+
}
|
| 28 |
+
if (typeof Throw !== 'boolean') {
|
| 29 |
+
throw new $TypeError('Assertion failed: `Throw` must be a Boolean');
|
| 30 |
+
}
|
| 31 |
+
if (Throw) {
|
| 32 |
+
O[P] = V; // eslint-disable-line no-param-reassign
|
| 33 |
+
if (noThrowOnStrictViolation && !SameValue(O[P], V)) {
|
| 34 |
+
throw new $TypeError('Attempted to assign to readonly property.');
|
| 35 |
+
}
|
| 36 |
+
return true;
|
| 37 |
+
}
|
| 38 |
+
try {
|
| 39 |
+
O[P] = V; // eslint-disable-line no-param-reassign
|
| 40 |
+
return noThrowOnStrictViolation ? SameValue(O[P], V) : true;
|
| 41 |
+
} catch (e) {
|
| 42 |
+
return false;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
};
|