Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-09-16 17:29:58 +00:00
parent 1afca056e3
commit 6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions

View file

@ -3,7 +3,7 @@
var GetIntrinsic = require('get-intrinsic');
var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $isNaN = require('../helpers/isNaN');
@ -20,7 +20,7 @@ var NumberLessThan = require('./Number/lessThan');
// eslint-disable-next-line max-statements, max-lines-per-function
module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
if (Type(LeftFirst) !== 'Boolean') {
if (typeof LeftFirst !== 'boolean') {
throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean');
}
var px;
@ -32,7 +32,7 @@ module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
py = ToPrimitive(y, $Number);
px = ToPrimitive(x, $Number);
}
if (Type(px) === 'String' && Type(py) === 'String') {
if (typeof px === 'string' && typeof py === 'string') {
if (IsStringPrefix(py, px)) {
return false;
}

View file

@ -2,9 +2,7 @@
var inspect = require('object-inspect');
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Call = require('./Call');
var Get = require('./Get');

View file

@ -1,25 +1,22 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var CodePointAt = require('./CodePointAt');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-advancestringindex
module.exports = function AdvanceStringIndex(S, index, unicode) {
if (Type(S) !== 'String') {
if (typeof S !== 'string') {
throw new $TypeError('Assertion failed: `S` must be a String');
}
if (!isInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53');
}
if (Type(unicode) !== 'Boolean') {
if (typeof unicode !== 'boolean') {
throw new $TypeError('Assertion failed: `unicode` must be a Boolean');
}
if (!unicode) {

View file

@ -3,9 +3,9 @@
var GetIntrinsic = require('get-intrinsic');
var $ArrayPrototype = GetIntrinsic('%Array.prototype%');
var $RangeError = GetIntrinsic('%RangeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $RangeError = require('es-errors/range');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var isInteger = require('../helpers/isInteger');

View file

@ -1,23 +1,19 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $RangeError = require('es-errors/range');
var $TypeError = require('es-errors/type');
var assign = require('object.assign');
var isPropertyDescriptor = require('../helpers/isPropertyDescriptor');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
var IsArray = require('./IsArray');
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
var IsDataDescriptor = require('./IsDataDescriptor');
var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty');
var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty');
var ToNumber = require('./ToNumber');
var ToString = require('./ToString');
var ToUint32 = require('./ToUint32');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-arraysetlength
@ -26,11 +22,7 @@ module.exports = function ArraySetLength(A, Desc) {
if (!IsArray(A)) {
throw new $TypeError('Assertion failed: A must be an Array');
}
if (!isPropertyDescriptor({
Type: Type,
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor
}, Desc)) {
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
}
if (!('[[Value]]' in Desc)) {

View file

@ -4,7 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
var $Array = GetIntrinsic('%Array%');
var $species = GetIntrinsic('%Symbol.species%', true);
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Get = require('./Get');
var IsArray = require('./IsArray');

View file

@ -2,8 +2,8 @@
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $Promise = GetIntrinsic('%Promise%', true);
var callBound = require('call-bind/callBound');
@ -31,7 +31,7 @@ module.exports = function AsyncFromSyncIteratorContinuation(result) {
throw new $SyntaxError('This environment does not support Promises.');
}
return new Promise(function (resolve) {
return new $Promise(function (resolve) {
var done = IteratorComplete(result); // step 2
var value = IteratorValue(result); // step 4
var valueWrapper = PromiseResolve($Promise, value); // step 6

View file

@ -2,8 +2,8 @@
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $Promise = GetIntrinsic('%Promise%', true);
var Call = require('./Call');
@ -11,7 +11,7 @@ var CompletionRecord = require('./CompletionRecord');
var GetMethod = require('./GetMethod');
var Type = require('./Type');
var assertRecord = require('../helpers/assertRecord');
var isIteratorRecord = require('../helpers/records/iterator-record');
var callBound = require('call-bind/callBound');
@ -20,7 +20,9 @@ var $then = callBound('Promise.prototype.then', true);
// https://262.ecma-international.org/9.0/#sec-asynciteratorclose
module.exports = function AsyncIteratorClose(iteratorRecord, completion) {
assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord); // step 1
if (!isIteratorRecord(iteratorRecord)) {
throw new $TypeError('Assertion failed: `iteratorRecord` must be an Iterator Record'); // step 1
}
if (!(completion instanceof CompletionRecord)) {
throw new $TypeError('Assertion failed: completion is not a Completion Record instance'); // step 2

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add
module.exports = function BigIntAdd(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND
module.exports = function BigIntBitwiseAND(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
return BigIntBitwiseOp('&', x, y);

View file

@ -3,14 +3,12 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT
module.exports = function BigIntBitwiseNOT(x) {
if (Type(x) !== 'BigInt') {
if (typeof x !== 'bigint') {
throw new $TypeError('Assertion failed: `x` argument must be a BigInt');
}
return -x - $BigInt(1);

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR
module.exports = function BigIntBitwiseOR(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
return BigIntBitwiseOp('|', x, y);

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR
module.exports = function BigIntBitwiseXOR(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
return BigIntBitwiseOp('^', x, y);

View file

@ -3,15 +3,13 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $RangeError = require('es-errors/range');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide
module.exports = function BigIntDivide(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
if (y === $BigInt(0)) {

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal
module.exports = function BigIntEqual(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
// shortcut for the actual spec mechanics

View file

@ -3,15 +3,13 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $RangeError = require('es-errors/range');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate
module.exports = function BigIntExponentiate(base, exponent) {
if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') {
if (typeof base !== 'bigint' || typeof exponent !== 'bigint') {
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts');
}
if (exponent < $BigInt(0)) {

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift
module.exports = function BigIntLeftShift(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan
module.exports = function BigIntLessThan(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply
module.exports = function BigIntMultiply(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -3,17 +3,15 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $RangeError = require('es-errors/range');
var $TypeError = require('es-errors/type');
var zero = $BigInt && $BigInt(0);
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder
module.exports = function BigIntRemainder(n, d) {
if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') {
if (typeof n !== 'bigint' || typeof d !== 'bigint') {
throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts');
}

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var BigIntEqual = require('./equal');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue
module.exports = function BigIntSameValue(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var BigIntEqual = require('./equal');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero
module.exports = function BigIntSameValueZero(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var BigIntLeftShift = require('./leftShift');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift
module.exports = function BigIntSignedRightShift(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract
module.exports = function BigIntSubtract(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -3,14 +3,12 @@
var GetIntrinsic = require('get-intrinsic');
var $String = GetIntrinsic('%String%');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring
module.exports = function BigIntToString(x) {
if (Type(x) !== 'BigInt') {
if (typeof x !== 'bigint') {
throw new $TypeError('Assertion failed: `x` must be a BigInt');
}

View file

@ -3,16 +3,14 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
var zero = $BigInt && $BigInt(0);
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus
module.exports = function BigIntUnaryMinus(x) {
if (Type(x) !== 'BigInt') {
if (typeof x !== 'bigint') {
throw new $TypeError('Assertion failed: `x` argument must be a BigInt');
}

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift
module.exports = function BigIntUnsignedRightShift(x, y) {
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}

View file

@ -1,15 +1,12 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
// var $BigInt = GetIntrinsic('%BigInt%', true);
// var $pow = GetIntrinsic('%Math.pow%');
// var BinaryAnd = require('./BinaryAnd');
// var BinaryOr = require('./BinaryOr');
// var BinaryXor = require('./BinaryXor');
var Type = require('./Type');
// var modulo = require('./modulo');
// var zero = $BigInt && $BigInt(0);
@ -22,7 +19,7 @@ module.exports = function BigIntBitwiseOp(op, x, y) {
if (op !== '&' && op !== '|' && op !== '^') {
throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`');
}
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('`x` and `y` must be BigInts');
}

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-binaryand

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-binaryor

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/11.0/#sec-binaryxor

View file

@ -3,7 +3,7 @@
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IsArray = require('./IsArray');

View file

@ -1,18 +1,15 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var SameValue = require('./SameValue');
var ToNumber = require('./ToNumber');
var ToString = require('./ToString');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
module.exports = function CanonicalNumericIndexString(argument) {
if (Type(argument) !== 'String') {
if (typeof argument !== 'string') {
throw new $TypeError('Assertion failed: `argument` must be a String');
}
if (argument === '-0') { return -0; }

View file

@ -1,27 +1,23 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
var has = require('has');
var hasOwn = require('hasown');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var $toUpperCase = callBound('String.prototype.toUpperCase');
var Type = require('./Type');
var caseFolding = require('../helpers/caseFolding');
var caseFolding = require('../helpers/caseFolding.json');
// https://262.ecma-international.org/6.0/#sec-runtime-semantics-canonicalize-ch
module.exports = function Canonicalize(ch, IgnoreCase, Unicode) {
if (Type(ch) !== 'String') {
if (typeof ch !== 'string') {
throw new $TypeError('Assertion failed: `ch` must be a character');
}
if (Type(IgnoreCase) !== 'Boolean' || Type(Unicode) !== 'Boolean') {
if (typeof IgnoreCase !== 'boolean' || typeof Unicode !== 'boolean') {
throw new $TypeError('Assertion failed: `IgnoreCase` and `Unicode` must be Booleans');
}
@ -30,10 +26,10 @@ module.exports = function Canonicalize(ch, IgnoreCase, Unicode) {
}
if (Unicode) { // step 2
if (has(caseFolding.C, ch)) {
if (hasOwn(caseFolding.C, ch)) {
return caseFolding.C[ch];
}
if (has(caseFolding.S, ch)) {
if (hasOwn(caseFolding.S, ch)) {
return caseFolding.S[ch];
}
return ch; // step 2.b

View file

@ -4,7 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var $push = callBound('Array.prototype.push');

View file

@ -1,13 +1,10 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
var Type = require('./Type');
var UTF16DecodeSurrogatePair = require('./UTF16DecodeSurrogatePair');
var $charAt = callBound('String.prototype.charAt');
@ -16,7 +13,7 @@ var $charCodeAt = callBound('String.prototype.charCodeAt');
// https://262.ecma-international.org/11.0/#sec-codepointat
module.exports = function CodePointAt(string, position) {
if (Type(string) !== 'String') {
if (typeof string !== 'string') {
throw new $TypeError('Assertion failed: `string` must be a String');
}
var size = string.length;

View file

@ -1,38 +1,42 @@
'use strict';
var has = require('has');
var $TypeError = require('es-errors/type');
var assertRecord = require('../helpers/assertRecord');
var hasOwn = require('hasown');
var IsDataDescriptor = require('./IsDataDescriptor');
var IsGenericDescriptor = require('./IsGenericDescriptor');
var Type = require('./Type');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
// https://262.ecma-international.org/6.0/#sec-completepropertydescriptor
module.exports = function CompletePropertyDescriptor(Desc) {
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
}
/* eslint no-param-reassign: 0 */
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) {
if (!has(Desc, '[[Value]]')) {
if (!hasOwn(Desc, '[[Value]]')) {
Desc['[[Value]]'] = void 0;
}
if (!has(Desc, '[[Writable]]')) {
if (!hasOwn(Desc, '[[Writable]]')) {
Desc['[[Writable]]'] = false;
}
} else {
if (!has(Desc, '[[Get]]')) {
if (!hasOwn(Desc, '[[Get]]')) {
Desc['[[Get]]'] = void 0;
}
if (!has(Desc, '[[Set]]')) {
if (!hasOwn(Desc, '[[Set]]')) {
Desc['[[Set]]'] = void 0;
}
}
if (!has(Desc, '[[Enumerable]]')) {
if (!hasOwn(Desc, '[[Enumerable]]')) {
Desc['[[Enumerable]]'] = false;
}
if (!has(Desc, '[[Configurable]]')) {
if (!hasOwn(Desc, '[[Configurable]]')) {
Desc['[[Configurable]]'] = false;
}
return Desc;

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $SyntaxError = require('es-errors/syntax');
var SLOT = require('internal-slot');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
var forEach = require('../helpers/forEach');

View file

@ -2,7 +2,9 @@
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $Promise = GetIntrinsic('%Promise%', true);
var AsyncFromSyncIteratorContinuation = require('./AsyncFromSyncIteratorContinuation');
var Call = require('./Call');
@ -13,19 +15,23 @@ var IteratorNext = require('./IteratorNext');
var OrdinaryObjectCreate = require('./OrdinaryObjectCreate');
var Type = require('./Type');
var SLOT = require('internal-slot');
var isIteratorRecord = require('../helpers/records/iterator-record');
var assertRecord = require('../helpers/assertRecord');
var SLOT = require('internal-slot');
var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorPrototype%', true) || {
next: function next(value) {
if (!$Promise) {
throw new $SyntaxError('This environment does not support Promises.');
}
var O = this; // step 1
SLOT.assert(O, '[[SyncIteratorRecord]]'); // step 2
var argsLength = arguments.length;
return new Promise(function (resolve) { // step 3
return new $Promise(function (resolve) { // step 3
var syncIteratorRecord = SLOT.get(O, '[[SyncIteratorRecord]]'); // step 4
var result;
if (argsLength > 0) {
@ -37,6 +43,10 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
});
},
'return': function () {
if (!$Promise) {
throw new $SyntaxError('This environment does not support Promises.');
}
var O = this; // step 1
SLOT.assert(O, '[[SyncIteratorRecord]]'); // step 2
@ -44,7 +54,7 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
var valueIsPresent = arguments.length > 0;
var value = valueIsPresent ? arguments[0] : void undefined;
return new Promise(function (resolve, reject) { // step 3
return new $Promise(function (resolve, reject) { // step 3
var syncIterator = SLOT.get(O, '[[SyncIteratorRecord]]')['[[Iterator]]']; // step 4
var iteratorReturn = GetMethod(syncIterator, 'return'); // step 5
@ -68,6 +78,10 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
});
},
'throw': function () {
if (!$Promise) {
throw new $SyntaxError('This environment does not support Promises.');
}
var O = this; // step 1
SLOT.assert(O, '[[SyncIteratorRecord]]'); // step 2
@ -75,7 +89,7 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
var valueIsPresent = arguments.length > 0;
var value = valueIsPresent ? arguments[0] : void undefined;
return new Promise(function (resolve, reject) { // step 3
return new $Promise(function (resolve, reject) { // step 3
var syncIterator = SLOT.get(O, '[[SyncIteratorRecord]]')['[[Iterator]]']; // step 4
var throwMethod = GetMethod(syncIterator, 'throw'); // step 5
@ -104,7 +118,9 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
// https://262.ecma-international.org/11.0/#sec-createasyncfromsynciterator
module.exports = function CreateAsyncFromSyncIterator(syncIteratorRecord) {
assertRecord(Type, 'Iterator Record', 'syncIteratorRecord', syncIteratorRecord);
if (!isIteratorRecord(syncIteratorRecord)) {
throw new $TypeError('Assertion failed: `syncIteratorRecord` must be an Iterator Record');
}
// var asyncIterator = OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »); // step 1
var asyncIterator = OrdinaryObjectCreate($AsyncFromSyncIteratorPrototype);

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IsPropertyKey = require('./IsPropertyKey');
var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var CreateDataProperty = require('./CreateDataProperty');
var IsPropertyKey = require('./IsPropertyKey');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
@ -10,12 +8,11 @@ var $replace = callBound('String.prototype.replace');
var RequireObjectCoercible = require('./RequireObjectCoercible');
var ToString = require('./ToString');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-createhtml
module.exports = function CreateHTML(string, tag, attribute, value) {
if (Type(tag) !== 'String' || Type(attribute) !== 'String') {
if (typeof tag !== 'string' || typeof attribute !== 'string') {
throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings');
}
var str = RequireObjectCoercible(string);

View file

@ -1,15 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('./Type');
var $TypeError = require('es-errors/type');
// https://262.ecma-international.org/6.0/#sec-createiterresultobject
module.exports = function CreateIterResultObject(value, done) {
if (Type(done) !== 'Boolean') {
if (typeof done !== 'boolean') {
throw new $TypeError('Assertion failed: Type(done) is not Boolean');
}
return {

View file

@ -1,10 +1,8 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf');
var $push = callBound('Array.prototype.push');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var DefineOwnProperty = require('../helpers/DefineOwnProperty');

View file

@ -3,7 +3,7 @@
var GetIntrinsic = require('get-intrinsic');
var hasSymbols = require('has-symbols')();
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true);
var AdvanceStringIndex = require('./AdvanceStringIndex');
@ -21,13 +21,13 @@ var SLOT = require('internal-slot');
var setToStringTag = require('es-set-tostringtag');
var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) {
if (Type(S) !== 'String') {
if (typeof S !== 'string') {
throw new $TypeError('`S` must be a string');
}
if (Type(global) !== 'Boolean') {
if (typeof global !== 'boolean') {
throw new $TypeError('`global` must be a boolean');
}
if (Type(fullUnicode) !== 'Boolean') {
if (typeof fullUnicode !== 'boolean') {
throw new $TypeError('`fullUnicode` must be a boolean');
}
SLOT.set(this, '[[IteratingRegExp]]', R);

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $EvalError = GetIntrinsic('%EvalError%');
var $EvalError = require('es-errors/eval');
var DayWithinYear = require('./DayWithinYear');
var InLeapYear = require('./InLeapYear');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@ -10,16 +8,15 @@ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oc
var $isNaN = require('../helpers/isNaN');
var padTimeComponent = require('../helpers/padTimeComponent');
var Type = require('./Type');
var WeekDay = require('./WeekDay');
var MonthFromTime = require('./MonthFromTime');
var YearFromTime = require('./YearFromTime');
var DateFromTime = require('./DateFromTime');
var MonthFromTime = require('./MonthFromTime');
var WeekDay = require('./WeekDay');
var YearFromTime = require('./YearFromTime');
// https://262.ecma-international.org/9.0/#sec-datestring
module.exports = function DateString(tv) {
if (Type(tv) !== 'Number' || $isNaN(tv)) {
if (typeof tv !== 'number' || $isNaN(tv)) {
throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number');
}
var weekday = weekdays[WeekDay(tv)];

View file

@ -1,14 +1,11 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var isPropertyDescriptor = require('../helpers/isPropertyDescriptor');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
var DefineOwnProperty = require('../helpers/DefineOwnProperty');
var FromPropertyDescriptor = require('./FromPropertyDescriptor');
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
var IsDataDescriptor = require('./IsDataDescriptor');
var IsPropertyKey = require('./IsPropertyKey');
var SameValue = require('./SameValue');
@ -26,16 +23,8 @@ module.exports = function DefinePropertyOrThrow(O, P, desc) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var Desc = isPropertyDescriptor({
Type: Type,
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor
}, desc) ? desc : ToPropertyDescriptor(desc);
if (!isPropertyDescriptor({
Type: Type,
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor
}, Desc)) {
var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc);
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
}

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');

View file

@ -1,9 +1,9 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var isArrayBuffer = require('is-array-buffer');
var isSharedArrayBuffer = require('is-shared-array-buffer');
@ -30,14 +30,17 @@ module.exports = function DetachArrayBuffer(arrayBuffer) {
// throw new $TypeError('Assertion failed: `key` must be the value of the [[ArrayBufferDetachKey]] internal slot of `arrayBuffer`');
// }
if (typeof structuredClone === 'function') {
structuredClone(arrayBuffer, { transfer: [arrayBuffer] });
} else if (typeof postMessage === 'function') {
postMessage('', '/', [arrayBuffer]); // TODO: see if this might trigger listeners
} else if (MessageChannel) {
(new MessageChannel()).port1.postMessage(null, [arrayBuffer]);
} else {
throw new $SyntaxError('DetachArrayBuffer is not supported in this environment');
if (!IsDetachedBuffer(arrayBuffer)) { // node v21.0.0+ throws when you structuredClone a detached buffer
if (typeof structuredClone === 'function') {
structuredClone(arrayBuffer, { transfer: [arrayBuffer] });
} else if (typeof postMessage === 'function') {
postMessage('', '/', [arrayBuffer]); // TODO: see if this might trigger listeners
} else if (MessageChannel) {
(new MessageChannel()).port1.postMessage(null, [arrayBuffer]);
} else {
throw new $SyntaxError('DetachArrayBuffer is not supported in this environment');
}
}
return null;
};

View file

@ -2,7 +2,7 @@
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var objectKeys = require('object-keys');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');

View file

@ -1,15 +1,15 @@
'use strict';
var assertRecord = require('../helpers/assertRecord');
var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
var $TypeError = require('es-errors/type');
var Type = require('./Type');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
// https://262.ecma-international.org/6.0/#sec-frompropertydescriptor
module.exports = function FromPropertyDescriptor(Desc) {
if (typeof Desc !== 'undefined') {
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (typeof Desc !== 'undefined' && !isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
}
return fromPropertyDescriptor(Desc);

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var inspect = require('object-inspect');

View file

@ -2,8 +2,8 @@
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = require('es-errors/type');
var $SyntaxError = require('es-errors/syntax');
var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true);
var inspect = require('object-inspect');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var GetV = require('./GetV');
var IsCallable = require('./IsCallable');

View file

@ -4,7 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
var hasSymbols = require('has-symbols')();
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true);

View file

@ -3,8 +3,8 @@
var GetIntrinsic = require('get-intrinsic');
var $Function = GetIntrinsic('%Function%');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = require('es-errors/type');
var $SyntaxError = require('es-errors/syntax');
var Get = require('./Get');
var IsConstructor = require('./IsConstructor');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
var regexTester = require('safe-regex-test');
@ -21,21 +19,20 @@ var Get = require('./Get');
var IsArray = require('./IsArray');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var isStringOrHole = require('../helpers/isStringOrHole');
var isStringOrUndefined = require('../helpers/isStringOrUndefined');
// http://262.ecma-international.org/9.0/#sec-getsubstitution
// eslint-disable-next-line max-statements, max-params, max-lines-per-function
module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) {
if (Type(matched) !== 'String') {
if (typeof matched !== 'string') {
throw new $TypeError('Assertion failed: `matched` must be a String');
}
var matchLength = matched.length;
if (Type(str) !== 'String') {
if (typeof str !== 'string') {
throw new $TypeError('Assertion failed: `str` must be a String');
}
var stringLength = str.length;
@ -44,17 +41,17 @@ module.exports = function GetSubstitution(matched, str, position, captures, name
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
}
if (!IsArray(captures) || !every(captures, isStringOrHole)) {
throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures));
if (!IsArray(captures) || !every(captures, isStringOrUndefined)) {
throw new $TypeError('Assertion failed: `captures` must be a List of Strings or `undefined`, got ' + inspect(captures));
}
if (Type(replacement) !== 'String') {
if (typeof replacement !== 'string') {
throw new $TypeError('Assertion failed: `replacement` must be a String');
}
var tailPos = position + matchLength;
var m = captures.length;
if (Type(namedCaptures) !== 'Undefined') {
if (typeof namedCaptures !== 'undefined') {
namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign
}
@ -84,28 +81,27 @@ module.exports = function GetSubstitution(matched, str, position, captures, name
// $1 through $9, and not followed by a digit
var n = $parseInt(next, 10);
// if (n > m, impl-defined)
result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1];
result += n <= m && typeof captures[n - 1] === 'undefined' ? '' : captures[n - 1];
i += 1;
} else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) {
// $00 through $99
var nn = next + nextNext;
var nnI = $parseInt(nn, 10) - 1;
// if nn === '00' or nn > m, impl-defined
result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI];
result += nn <= m && typeof captures[nnI] === 'undefined' ? '' : captures[nnI];
i += 2;
} else if (next === '<') {
// eslint-disable-next-line max-depth
if (Type(namedCaptures) === 'Undefined') {
if (typeof namedCaptures === 'undefined') {
result += '$<';
i += 2;
} else {
var endIndex = $indexOf(replacement, '>', i);
// eslint-disable-next-line max-depth
if (endIndex > -1) {
var groupName = $strSlice(replacement, i + '$<'.length, endIndex);
var capture = Get(namedCaptures, groupName);
// eslint-disable-next-line max-depth
if (Type(capture) !== 'Undefined') {
if (typeof capture !== 'undefined') {
result += ToString(capture);
}
i += ('<' + groupName + '>').length;

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var inspect = require('object-inspect');

View file

@ -2,8 +2,8 @@
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
var callBound = require('call-bind/callBound');
@ -19,20 +19,7 @@ var isArrayBuffer = require('is-array-buffer');
var isSharedArrayBuffer = require('is-shared-array-buffer');
var safeConcat = require('safe-array-concat');
var table61 = {
__proto__: null,
$Int8: 1,
$Uint8: 1,
$Uint8C: 1,
$Int16: 2,
$Uint16: 2,
$Int32: 4,
$Uint32: 4,
$BigInt64: 8,
$BigUint64: 8,
$Float32: 4,
$Float64: 8
};
var tableTAO = require('./tables/typed-array-objects');
var defaultEndianness = require('../helpers/defaultEndianness');
@ -48,7 +35,7 @@ module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type, isTyp
throw new $TypeError('Assertion failed: `byteIndex` must be an integer');
}
if (typeof type !== 'string' || typeof table61['$' + type] !== 'number') {
if (typeof type !== 'string' || typeof tableTAO.size['$' + type] !== 'number') {
throw new $TypeError('Assertion failed: `type` must be a Typed Array element type');
}
@ -76,7 +63,7 @@ module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type, isTyp
// 4. Let block be arrayBuffer.[[ArrayBufferData]].
var elementSize = table61['$' + type]; // step 5
var elementSize = tableTAO.size['$' + type]; // step 5
if (!elementSize) {
throw new $TypeError('Assertion failed: `type` must be one of "Int8", "Uint8", "Uint8C", "Int16", "Uint16", "Int32", "Uint32", "BigInt64", "BigUint64", "Float32", or "Float64"');
}

View file

@ -1,10 +1,8 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var has = require('has');
var hasOwn = require('hasown');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
@ -18,5 +16,5 @@ module.exports = function HasOwnProperty(O, P) {
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: `P` must be a Property Key');
}
return has(O, P);
return hasOwn(O, P);
};

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $EvalError = GetIntrinsic('%EvalError%');
var $EvalError = require('es-errors/eval');
var DaysInYear = require('./DaysInYear');
var YearFromTime = require('./YearFromTime');

View file

@ -2,7 +2,7 @@
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $hasInstance = GetIntrinsic('Symbol.hasInstance', true);

View file

@ -0,0 +1,53 @@
'use strict';
var $TypeError = require('es-errors/type');
var GetValueFromBuffer = require('./GetValueFromBuffer');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsValidIntegerIndex = require('./IsValidIntegerIndex');
var typedArrayLength = require('typed-array-length');
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteOffset = require('typed-array-byte-offset');
var whichTypedArray = require('which-typed-array');
var tableTAO = require('./tables/typed-array-objects');
// https://262.ecma-international.org/11.0/#sec-integerindexedelementget
module.exports = function IntegerIndexedElementGet(O, index) {
var arrayTypeName = whichTypedArray(O); // step 7
if (!arrayTypeName) {
throw new $TypeError('`O` must be a TypedArray'); // step 1
}
if (typeof index !== 'number') {
throw new $TypeError('`index` must be a Number'); // step 2
}
var buffer = typedArrayBuffer(O); // step 3
if (IsDetachedBuffer(buffer)) {
throw new $TypeError('`O` has a detached buffer'); // step 4
}
if (!IsValidIntegerIndex(O, index)) {
return void undefined; // step 5
}
var offset = typedArrayByteOffset(O); // step 6
var length = typedArrayLength(O); // step 7
if (index < 0 || index >= length) {
return void undefined; // step 8
}
var elementType = tableTAO.name['$' + arrayTypeName]; // step 10
var elementSize = tableTAO.size['$' + elementType]; // step 8
var indexedPosition = (index * elementSize) + offset; // step 9
return GetValueFromBuffer(buffer, indexedPosition, elementType, true, 'Unordered'); // step 11
};

View file

@ -0,0 +1,60 @@
'use strict';
var $TypeError = require('es-errors/type');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsValidIntegerIndex = require('./IsValidIntegerIndex');
var SetValueInBuffer = require('./SetValueInBuffer');
var ToBigInt = require('./ToBigInt');
var ToNumber = require('./ToNumber');
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteOffset = require('typed-array-byte-offset');
var typedArrayLength = require('typed-array-length');
var whichTypedArray = require('which-typed-array');
var tableTAO = require('./tables/typed-array-objects');
// https://262.ecma-international.org/11.0/#sec-integerindexedelementset
module.exports = function IntegerIndexedElementSet(O, index, value) {
var arrayTypeName = whichTypedArray(O); // step 9
if (!arrayTypeName) {
throw new $TypeError('`O` must be a TypedArray'); // step 1
}
if (typeof index !== 'number') {
throw new $TypeError('`index` must be a Number'); // step 2
}
var contentType = arrayTypeName === 'BigInt64Array' || arrayTypeName === 'BigUint64Array' ? 'BigInt' : 'Number';
var numValue = contentType === 'BigInt' ? ToBigInt(value) : ToNumber(value); // steps 3 - 4
var buffer = typedArrayBuffer(O); // step 5
if (IsDetachedBuffer(buffer)) {
throw new $TypeError('`O` has a detached buffer'); // step 6
}
if (!IsValidIntegerIndex(O, index)) {
return false; // step 7
}
var offset = typedArrayByteOffset(O); // step 8
var length = typedArrayLength(O); // step 9
if (index < 0 || index >= length) {
return false; // step 10
}
var elementType = tableTAO.name['$' + arrayTypeName]; // step 12
var elementSize = tableTAO.size['$' + elementType]; // step 10
var indexedPosition = (index * elementSize) + offset; // step 11
SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, 'Unordered'); // step 13
return true; // step 14
};

View file

@ -0,0 +1,66 @@
'use strict';
var $TypeError = require('es-errors/type');
var Call = require('./Call');
var CreateDataProperty = require('./CreateDataProperty');
var EnumerableOwnPropertyNames = require('./EnumerableOwnPropertyNames');
var Get = require('./Get');
var IsArray = require('./IsArray');
var LengthOfArrayLike = require('./LengthOfArrayLike');
var ToString = require('./ToString');
var Type = require('./Type');
var forEach = require('../helpers/forEach');
// https://262.ecma-international.org/11.0/#sec-internalizejsonproperty
module.exports = function InternalizeJSONProperty(holder, name, reviver) {
if (Type(holder) !== 'Object') {
throw new $TypeError('Assertion failed: `holder` is not an Object');
}
if (typeof name !== 'string') {
throw new $TypeError('Assertion failed: `name` is not a String');
}
if (typeof reviver !== 'function') {
throw new $TypeError('Assertion failed: `reviver` is not a Function');
}
var val = Get(holder, name); // step 1
if (Type(val) === 'Object') { // step 2
var isArray = IsArray(val); // step 2.a
if (isArray) { // step 2.b
var I = 0; // step 2.b.i
var len = LengthOfArrayLike(val, 'length'); // step 2.b.ii
while (I < len) { // step 2.b.iii
var newElement = InternalizeJSONProperty(val, ToString(I), reviver); // step 2.b.iv.1
if (typeof newElement === 'undefined') { // step 2.b.iii.2
delete val[ToString(I)]; // step 2.b.iii.2.a
} else { // step 2.b.iii.3
CreateDataProperty(val, ToString(I), newElement); // step 2.b.iii.3.a
}
I += 1; // step 2.b.iii.4
}
} else { // step 2.c
var keys = EnumerableOwnPropertyNames(val, 'key'); // step 2.c.i
forEach(keys, function (P) { // step 2.c.ii
// eslint-disable-next-line no-shadow
var newElement = InternalizeJSONProperty(val, P, reviver); // step 2.c.ii.1
if (typeof newElement === 'undefined') { // step 2.c.ii.2
delete val[P]; // step 2.c.ii.2.a
} else { // step 2.c.ii.3
CreateDataProperty(val, P, newElement); // step 2.c.ii.3.a
}
});
}
}
return Call(reviver, holder, [name, val]); // step 3
};

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Call = require('./Call');
var IsArray = require('./IsArray');

View file

@ -1,10 +1,10 @@
'use strict';
var has = require('has');
var $TypeError = require('es-errors/type');
var Type = require('./Type');
var hasOwn = require('hasown');
var assertRecord = require('../helpers/assertRecord');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
// https://262.ecma-international.org/5.1/#sec-8.10.1
@ -13,9 +13,11 @@ module.exports = function IsAccessorDescriptor(Desc) {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
}
if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
if (!hasOwn(Desc, '[[Get]]') && !hasOwn(Desc, '[[Set]]')) {
return false;
}

View file

@ -1,10 +1,10 @@
'use strict';
var has = require('has');
var $TypeError = require('es-errors/type');
var Type = require('./Type');
var hasOwn = require('hasown');
var assertRecord = require('../helpers/assertRecord');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
// https://262.ecma-international.org/5.1/#sec-8.10.2
@ -13,9 +13,11 @@ module.exports = function IsDataDescriptor(Desc) {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
}
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
if (!hasOwn(Desc, '[[Value]]') && !hasOwn(Desc, '[[Writable]]')) {
return false;
}

View file

@ -1,22 +1,23 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $byteLength = require('array-buffer-byte-length');
var isArrayBuffer = require('is-array-buffer');
var availableTypedArrays = require('available-typed-arrays')();
var callBound = require('call-bind/callBound');
var isArrayBuffer = require('is-array-buffer');
var isSharedArrayBuffer = require('is-shared-array-buffer');
// https://262.ecma-international.org/6.0/#sec-isdetachedbuffer
var $sabByteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);
// https://262.ecma-international.org/8.0/#sec-isdetachedbuffer
module.exports = function IsDetachedBuffer(arrayBuffer) {
if (!isArrayBuffer(arrayBuffer)) {
var isSAB = isSharedArrayBuffer(arrayBuffer);
if (!isArrayBuffer(arrayBuffer) && !isSAB) {
throw new $TypeError('Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot');
}
if ($byteLength(arrayBuffer) === 0) {
if ((isSAB ? $sabByteLength : $byteLength)(arrayBuffer) === 0) {
try {
new global[availableTypedArrays[0]](arrayBuffer); // eslint-disable-line no-new
} catch (error) {

View file

@ -1,10 +1,11 @@
'use strict';
var assertRecord = require('../helpers/assertRecord');
var $TypeError = require('es-errors/type');
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
var IsDataDescriptor = require('./IsDataDescriptor');
var Type = require('./Type');
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
// https://262.ecma-international.org/6.0/#sec-isgenericdescriptor
@ -13,7 +14,9 @@ module.exports = function IsGenericDescriptor(Desc) {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!isPropertyDescriptor(Desc)) {
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
}
if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) {
return true;

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Type = require('./Type');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isPrefixOf = require('../helpers/isPrefixOf');
@ -10,16 +8,14 @@ var isPrefixOf = require('../helpers/isPrefixOf');
// var $charAt = callBound('String.prototype.charAt');
var Type = require('./Type');
// https://262.ecma-international.org/9.0/#sec-isstringprefix
module.exports = function IsStringPrefix(p, q) {
if (Type(p) !== 'String') {
if (typeof p !== 'string') {
throw new $TypeError('Assertion failed: "p" must be a String');
}
if (Type(q) !== 'String') {
if (typeof q !== 'string') {
throw new $TypeError('Assertion failed: "q" must be a String');
}

View file

@ -1,19 +1,21 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var IsInteger = require('./IsInteger');
var isNegativeZero = require('../helpers/isNegativeZero');
var isTypedArray = require('is-typed-array');
var typedArrayBuffer = require('typed-array-buffer');
// https://262.ecma-international.org/11.0/#sec-isvalidintegerindex
module.exports = function IsValidIntegerIndex(O, index) {
// Assert: O is an Integer-Indexed exotic object.
if (!isTypedArray) {
throw new $TypeError('Assertion failed: `O` must be a Typed Array');
}
typedArrayBuffer(O); // step 1
if (typeof index !== 'number') {

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
@ -10,7 +8,6 @@ var $indexOf = callBound('String.prototype.indexOf');
var IsArray = require('./IsArray');
var IsInteger = require('./IsInteger');
var Type = require('./Type');
var WordCharacters = require('./WordCharacters');
var every = require('../helpers/every');
@ -32,7 +29,7 @@ module.exports = function IsWordChar(e, InputLength, Input, IgnoreCase, Unicode)
if (!IsArray(Input) || !every(Input, isChar)) {
throw new $TypeError('Assertion failed: `Input` must be a List of characters');
}
if (Type(IgnoreCase) !== 'Boolean' || Type(Unicode) !== 'Boolean') {
if (typeof IgnoreCase !== 'boolean' || typeof Unicode !== 'boolean') {
throw new $TypeError('Assertion failed: `IgnoreCase` and `Unicode` must be booleans');
}

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Call = require('./Call');
var CompletionRecord = require('./CompletionRecord');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Get = require('./Get');
var ToBoolean = require('./ToBoolean');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Invoke = require('./Invoke');
var Type = require('./Type');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Get = require('./Get');
var Type = require('./Type');

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Get = require('./Get');
var ToLength = require('./ToLength');

View file

@ -1,11 +1,9 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $TypeError = GetIntrinsic('%TypeError%');
var IsCallable = require('es-abstract/2022/IsCallable');
var IsConstructor = require('es-abstract/2022/IsConstructor');
var IsCallable = require('./IsCallable');
var IsConstructor = require('./IsConstructor');
// https://262.ecma-international.org/6.0/#sec-newpromisecapability

View file

@ -1,17 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-add
module.exports = function NumberAdd(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var NumberBitwiseOp = require('../NumberBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND
module.exports = function NumberBitwiseAND(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
return NumberBitwiseOp('&', x, y);

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var ToInt32 = require('../ToInt32');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT
module.exports = function NumberBitwiseNOT(x) {
if (Type(x) !== 'Number') {
if (typeof x !== 'number') {
throw new $TypeError('Assertion failed: `x` argument must be a Number');
}
var oldValue = ToInt32(x);

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var NumberBitwiseOp = require('../NumberBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR
module.exports = function NumberBitwiseOR(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
return NumberBitwiseOp('|', x, y);

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var NumberBitwiseOp = require('../NumberBitwiseOp');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR
module.exports = function NumberBitwiseXOR(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
return NumberBitwiseOp('^', x, y);

View file

@ -1,17 +1,14 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isFinite = require('../../helpers/isFinite');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide
module.exports = function NumberDivide(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) {

View file

@ -1,16 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal
module.exports = function NumberEqual(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
if (isNaN(x) || isNaN(y)) {

View file

@ -5,7 +5,7 @@ var GetIntrinsic = require('get-intrinsic');
var $pow = GetIntrinsic('%Math.pow%');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
/*
var abs = require('../../helpers/abs');
@ -14,14 +14,13 @@ var isNaN = require('../../helpers/isNaN');
var IsInteger = require('../IsInteger');
*/
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate
/* eslint max-lines-per-function: 0, max-statements: 0 */
module.exports = function NumberExponentiate(base, exponent) {
if (Type(base) !== 'Number' || Type(exponent) !== 'Number') {
if (typeof base !== 'number' || typeof exponent !== 'number') {
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers');
}
return $pow(base, exponent);

View file

@ -1,17 +1,14 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var ToInt32 = require('../ToInt32');
var ToUint32 = require('../ToUint32');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-leftShift
module.exports = function NumberLeftShift(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

View file

@ -1,17 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan
module.exports = function NumberLessThan(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

View file

@ -1,17 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply
module.exports = function NumberMultiply(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

View file

@ -1,17 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-remainder
module.exports = function NumberRemainder(n, d) {
if (Type(n) !== 'Number' || Type(d) !== 'Number') {
if (typeof n !== 'number' || typeof d !== 'number') {
throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers');
}

View file

@ -1,17 +1,15 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var isNegativeZero = require('is-negative-zero');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var Type = require('../Type');
var NumberSameValueZero = require('./sameValueZero');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue
module.exports = function NumberSameValue(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}
if (x === 0 && y === 0) {

View file

@ -1,17 +1,13 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var isNaN = require('../../helpers/isNaN');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero
module.exports = function NumberSameValueZero(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

View file

@ -1,17 +1,14 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var ToInt32 = require('../ToInt32');
var ToUint32 = require('../ToUint32');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-signedRightShift
module.exports = function NumberSignedRightShift(x, y) {
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
if (typeof x !== 'number' || typeof y !== 'number') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
}

Some files were not shown because too many files have changed in this diff Show more