Bump the npm group with 2 updates (#1819)

* Bump the npm group with 2 updates

Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import).


Updates `eslint` from 8.45.0 to 8.46.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0)

Updates `eslint-plugin-import` from 2.27.5 to 2.28.0
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-08-01 03:35:02 -07:00 committed by GitHub
parent a6b0ced86b
commit e7e35baaf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1408 changed files with 27215 additions and 9910 deletions

View file

@ -13,9 +13,10 @@ var IsCallable = require('./IsCallable');
var IteratorClose = require('./IteratorClose');
var IteratorStep = require('./IteratorStep');
var IteratorValue = require('./IteratorValue');
var ThrowCompletion = require('./ThrowCompletion');
var Type = require('./Type');
// https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable
// https://262.ecma-international.org/10.0/#sec-add-entries-from-iterable
module.exports = function AddEntriesFromIterable(target, iterable, adder) {
if (!IsCallable(adder)) {
@ -32,21 +33,15 @@ module.exports = function AddEntriesFromIterable(target, iterable, adder) {
}
var nextItem = IteratorValue(next);
if (Type(nextItem) !== 'Object') {
var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem));
return IteratorClose(
iteratorRecord,
function () { throw error; } // eslint-disable-line no-loop-func
);
var error = ThrowCompletion(new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)));
return IteratorClose(iteratorRecord, error);
}
try {
var k = Get(nextItem, '0');
var v = Get(nextItem, '1');
Call(adder, target, [k, v]);
} catch (e) {
return IteratorClose(
iteratorRecord,
function () { throw e; }
);
return IteratorClose(iteratorRecord, ThrowCompletion(e));
}
}
};

View file

@ -11,7 +11,7 @@ var Type = require('./Type');
var $push = callBound('Array.prototype.push');
// https://ecma-international.org/ecma-262/12.0/#sec-addtokeptobjects
// https://262.ecma-international.org/12.0/#sec-addtokeptobjects
module.exports = function AddToKeptObjects(object) {
if (Type(object) !== 'Object') {

View file

@ -3,20 +3,20 @@
var GetIntrinsic = require('get-intrinsic');
var CodePointAt = require('./CodePointAt');
var IsIntegralNumber = require('./IsIntegralNumber');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');
var $TypeError = GetIntrinsic('%TypeError%');
// https://ecma-international.org/ecma-262/12.0/#sec-advancestringindex
// https://262.ecma-international.org/12.0/#sec-advancestringindex
module.exports = function AdvanceStringIndex(S, index, unicode) {
if (Type(S) !== 'String') {
throw new $TypeError('Assertion failed: `S` must be a String');
}
if (!IsIntegralNumber(index) || index < 0 || index > MAX_SAFE_INTEGER) {
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') {

View file

@ -35,9 +35,9 @@ var BigIntSignedRightShift = require('./BigInt/signedRightShift');
var BigIntSubtract = require('./BigInt/subtract');
var BigIntUnsignedRightShift = require('./BigInt/unsignedRightShift');
// https://ecma-international.org/ecma-262/12.0/#sec-applystringornumericbinaryoperator
// https://262.ecma-international.org/12.0/#sec-applystringornumericbinaryoperator
// https://ecma-international.org/ecma-262/12.0/#step-applystringornumericbinaryoperator-operations-table
// https://262.ecma-international.org/12.0/#step-applystringornumericbinaryoperator-operations-table
var table = {
'**': [NumberExponentiate, BigIntExponentiate],
'*': [NumberMultiply, BigIntMultiply],

View file

@ -7,7 +7,7 @@ var $RangeError = GetIntrinsic('%RangeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var IsIntegralNumber = require('./IsIntegralNumber');
var isInteger = require('../helpers/isInteger');
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
@ -22,10 +22,10 @@ var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || (
: null
);
// https://www.ecma-international.org/ecma-262/12.0/#sec-arraycreate
// https://262.ecma-international.org/12.0/#sec-arraycreate
module.exports = function ArrayCreate(length) {
if (!IsIntegralNumber(length) || length < 0) {
if (!isInteger(length) || length < 0) {
throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0');
}
if (length > MAX_ARRAY_LENGTH) {

View file

@ -19,7 +19,7 @@ var ToString = require('./ToString');
var ToUint32 = require('./ToUint32');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength
// https://262.ecma-international.org/6.0/#sec-arraysetlength
// eslint-disable-next-line max-statements, max-lines-per-function
module.exports = function ArraySetLength(A, Desc) {

View file

@ -9,13 +9,14 @@ var ArrayCreate = require('./ArrayCreate');
var Get = require('./Get');
var IsArray = require('./IsArray');
var IsConstructor = require('./IsConstructor');
var IsIntegralNumber = require('./IsIntegralNumber');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/12.0/#sec-arrayspeciescreate
var isInteger = require('../helpers/isInteger');
// https://262.ecma-international.org/12.0/#sec-arrayspeciescreate
module.exports = function ArraySpeciesCreate(originalArray, length) {
if (!IsIntegralNumber(length) || length < 0) {
if (!isInteger(length) || length < 0) {
throw new $TypeError('Assertion failed: length must be an integer >= 0');
}

View file

@ -16,7 +16,7 @@ var Type = require('./Type');
var $then = callBound('Promise.prototype.then', true);
// https://ecma-international.org/ecma-262/10.0/#sec-asyncfromsynciteratorcontinuation
// https://262.ecma-international.org/10.0/#sec-asyncfromsynciteratorcontinuation
module.exports = function AsyncFromSyncIteratorContinuation(result) {
if (Type(result) !== 'Object') {

View file

@ -11,7 +11,7 @@ var IsArray = require('./IsArray');
var isByteValue = require('../helpers/isByteValue');
// https://ecma-international.org/ecma-262/12.0/#sec-bytelistbitwiseop
// https://262.ecma-international.org/12.0/#sec-bytelistbitwiseop
module.exports = function ByteListBitwiseOp(op, xBytes, yBytes) {
if (op !== '&' && op !== '^' && op !== '|') {

View file

@ -8,7 +8,7 @@ var IsArray = require('./IsArray');
var isByteValue = require('../helpers/isByteValue');
// https://ecma-international.org/ecma-262/12.0/#sec-bytelistequal
// https://262.ecma-international.org/12.0/#sec-bytelistequal
module.exports = function ByteListEqual(xBytes, yBytes) {
if (!IsArray(xBytes) || !IsArray(yBytes)) {

View file

@ -7,9 +7,9 @@ var $TypeError = GetIntrinsic('%TypeError%');
var IsArray = require('./IsArray');
var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%');
var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('Function.prototype.apply');
// https://ecma-international.org/ecma-262/6.0/#sec-call
// https://262.ecma-international.org/6.0/#sec-call
module.exports = function Call(F, V) {
var argumentsList = arguments.length > 2 ? arguments[2] : [];

View file

@ -9,7 +9,7 @@ var ToNumber = require('./ToNumber');
var ToString = require('./ToString');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
// https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
module.exports = function CanonicalNumericIndexString(argument) {
if (Type(argument) !== 'String') {

55
node_modules/es-abstract/2022/Canonicalize.js generated vendored Normal file
View file

@ -0,0 +1,55 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var has = require('has');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var $toUpperCase = callBound('String.prototype.toUpperCase');
var Type = require('./Type');
var caseFolding = require('../helpers/caseFolding');
// https://262.ecma-international.org/6.0/#sec-runtime-semantics-canonicalize-ch
module.exports = function Canonicalize(ch, IgnoreCase, Unicode) {
if (Type(ch) !== 'String') {
throw new $TypeError('Assertion failed: `ch` must be a character');
}
if (Type(IgnoreCase) !== 'Boolean' || Type(Unicode) !== 'Boolean') {
throw new $TypeError('Assertion failed: `IgnoreCase` and `Unicode` must be Booleans');
}
if (!IgnoreCase) {
return ch; // step 1
}
if (Unicode) { // step 2
if (has(caseFolding.C, ch)) {
return caseFolding.C[ch];
}
if (has(caseFolding.S, ch)) {
return caseFolding.S[ch];
}
return ch; // step 2.b
}
var u = $toUpperCase(ch); // step 2
if (u.length !== 1) {
return ch; // step 3
}
var cu = u; // step 4
if ($charCodeAt(ch, 0) >= 128 && $charCodeAt(cu, 0) < 128) {
return ch; // step 5
}
return cu;
};

View file

@ -5,8 +5,8 @@ var callBound = require('call-bind/callBound');
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
var $TypeError = GetIntrinsic('%TypeError%');
var $charCodeAt = callBound('%String.prototype.charCodeAt%');
var $push = callBound('%Array.prototype.push%');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var $push = callBound('Array.prototype.push');
module.exports = function CharacterRange(A, B) {
if (A.length !== 1 || B.length !== 1) {

View file

@ -3,7 +3,7 @@
var SLOT = require('internal-slot');
var keptObjects = [];
// https://ecma-international.org/ecma-262/12.0/#sec-clear-kept-objects
// https://262.ecma-international.org/12.0/#sec-clear-kept-objects
module.exports = function ClearKeptObjects() {
keptObjects.length = 0;

49
node_modules/es-abstract/2022/CloneArrayBuffer.js generated vendored Normal file
View file

@ -0,0 +1,49 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor');
var IsConstructor = require('./IsConstructor');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var OrdinarySetPrototypeOf = require('./OrdinarySetPrototypeOf');
var isInteger = require('../helpers/isInteger');
var isArrayBuffer = require('is-array-buffer');
var arrayBufferSlice = require('arraybuffer.prototype.slice');
// https://262.ecma-international.org/12.0/#sec-clonearraybuffer
module.exports = function CloneArrayBuffer(srcBuffer, srcByteOffset, srcLength, cloneConstructor) {
if (!isArrayBuffer(srcBuffer)) {
throw new $TypeError('Assertion failed: `srcBuffer` must be an ArrayBuffer instance');
}
if (!isInteger(srcByteOffset) || srcByteOffset < 0) {
throw new $TypeError('Assertion failed: `srcByteOffset` must be a non-negative integer');
}
if (!isInteger(srcLength) || srcLength < 0) {
throw new $TypeError('Assertion failed: `srcLength` must be a non-negative integer');
}
if (!IsConstructor(cloneConstructor)) {
throw new $TypeError('Assertion failed: `cloneConstructor` must be a constructor');
}
// 3. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, srcLength).
var proto = GetPrototypeFromConstructor(cloneConstructor, '%ArrayBufferPrototype%'); // step 3, kinda
if (IsDetachedBuffer(srcBuffer)) {
throw new $TypeError('`srcBuffer` must not be a detached ArrayBuffer'); // step 4
}
/*
5. Let srcBlock be srcBuffer.[[ArrayBufferData]].
6. Let targetBlock be targetBuffer.[[ArrayBufferData]].
7. Perform CopyDataBlockBytes(targetBlock, 0, srcBlock, srcByteOffset, srcLength).
*/
var targetBuffer = arrayBufferSlice(srcBuffer, srcByteOffset, srcByteOffset + srcLength); // steps 5-7
OrdinarySetPrototypeOf(targetBuffer, proto); // step 3
return targetBuffer; // step 8
};

View file

@ -13,7 +13,7 @@ var UTF16SurrogatePairToCodePoint = require('./UTF16SurrogatePairToCodePoint');
var $charAt = callBound('String.prototype.charAt');
var $charCodeAt = callBound('String.prototype.charCodeAt');
// https://ecma-international.org/ecma-262/12.0/#sec-codepointat
// https://262.ecma-international.org/12.0/#sec-codepointat
module.exports = function CodePointAt(string, position) {
if (Type(string) !== 'String') {

View file

@ -10,7 +10,7 @@ var IsArray = require('./IsArray');
var forEach = require('../helpers/forEach');
var isCodePoint = require('../helpers/isCodePoint');
// https://ecma-international.org/ecma-262/12.0/#sec-codepointstostring
// https://262.ecma-international.org/12.0/#sec-codepointstostring
module.exports = function CodePointsToString(text) {
if (!IsArray(text)) {

View file

@ -8,7 +8,7 @@ var IsDataDescriptor = require('./IsDataDescriptor');
var IsGenericDescriptor = require('./IsGenericDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor
// https://262.ecma-international.org/6.0/#sec-completepropertydescriptor
module.exports = function CompletePropertyDescriptor(Desc) {
/* eslint no-param-reassign: 0 */

View file

@ -22,7 +22,7 @@ var ToNumber = require('./ToNumber');
var ToObject = require('./ToObject');
var Type = require('./Type');
// https://www.ecma-international.org/ecma-262/12.0/#sec-copydataproperties
// https://262.ecma-international.org/12.0/#sec-copydataproperties
module.exports = function CopyDataProperties(target, source, excludedItems) {
if (Type(target) !== 'Object') {

View file

@ -101,7 +101,7 @@ var $AsyncFromSyncIteratorPrototype = GetIntrinsic('%AsyncFromSyncIteratorProtot
}
};
// https://ecma-international.org/ecma-262/11.0/#sec-createasyncfromsynciterator
// https://262.ecma-international.org/11.0/#sec-createasyncfromsynciterator
module.exports = function CreateAsyncFromSyncIterator(syncIteratorRecord) {
assertRecord(Type, 'Iterator Record', 'syncIteratorRecord', syncIteratorRecord);

View file

@ -4,17 +4,11 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var DefineOwnProperty = require('../helpers/DefineOwnProperty');
var FromPropertyDescriptor = require('./FromPropertyDescriptor');
var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty');
var IsDataDescriptor = require('./IsDataDescriptor');
var IsExtensible = require('./IsExtensible');
var IsPropertyKey = require('./IsPropertyKey');
var SameValue = require('./SameValue');
var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
// https://262.ecma-international.org/6.0/#sec-createdataproperty
module.exports = function CreateDataProperty(O, P, V) {
if (Type(O) !== 'Object') {
@ -23,23 +17,11 @@ module.exports = function CreateDataProperty(O, P, V) {
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var oldDesc = OrdinaryGetOwnProperty(O, P);
var extensible = !oldDesc || IsExtensible(O);
var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]'];
if (nonConfigurable || !extensible) {
return false;
}
return DefineOwnProperty(
IsDataDescriptor,
SameValue,
FromPropertyDescriptor,
O,
P,
{
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Value]]': V,
'[[Writable]]': true
}
);
var newDesc = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Value]]': V,
'[[Writable]]': true
};
return OrdinaryDefineOwnProperty(O, P, newDesc);
};

View file

@ -8,7 +8,7 @@ var CreateDataProperty = require('./CreateDataProperty');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
// // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
if (Type(O) !== 'Object') {

View file

@ -12,7 +12,7 @@ var RequireObjectCoercible = require('./RequireObjectCoercible');
var ToString = require('./ToString');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-createhtml
// https://262.ecma-international.org/6.0/#sec-createhtml
module.exports = function CreateHTML(string, tag, attribute, value) {
if (Type(tag) !== 'String' || Type(attribute) !== 'String') {

View file

@ -6,7 +6,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
// https://262.ecma-international.org/6.0/#sec-createiterresultobject
module.exports = function CreateIterResultObject(value, done) {
if (Type(done) !== 'Boolean') {

View file

@ -14,12 +14,14 @@ var LengthOfArrayLike = require('./LengthOfArrayLike');
var ToString = require('./ToString');
var Type = require('./Type');
var defaultElementTypes = ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'BigInt', 'Object'];
// https://262.ecma-international.org/11.0/#sec-createlistfromarraylike
module.exports = function CreateListFromArrayLike(obj) {
var elementTypes = arguments.length > 1
? arguments[1]
: ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'BigInt', 'Object'];
: defaultElementTypes;
if (Type(obj) !== 'Object') {
throw new $TypeError('Assertion failed: `obj` must be an Object');

View file

@ -12,7 +12,7 @@ var IsPropertyKey = require('./IsPropertyKey');
var SameValue = require('./SameValue');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty
// https://262.ecma-international.org/6.0/#sec-createmethodproperty
module.exports = function CreateMethodProperty(O, P, V) {
if (Type(O) !== 'Object') {

View file

@ -15,7 +15,7 @@ var SameValue = require('./SameValue');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
// https://262.ecma-international.org/6.0/#sec-definepropertyorthrow
module.exports = function DefinePropertyOrThrow(O, P, desc) {
if (Type(O) !== 'Object') {

View file

@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow
// https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow
module.exports = function DeletePropertyOrThrow(O, P) {
if (Type(O) !== 'Object') {

View file

@ -16,7 +16,6 @@ var ToString = require('./ToString');
// https://262.ecma-international.org/11.0/#sec-flattenintoarray
// eslint-disable-next-line max-params
module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) {
var mapperFunction;
if (arguments.length > 5) {

View file

@ -5,7 +5,7 @@ var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
// https://262.ecma-international.org/6.0/#sec-frompropertydescriptor
module.exports = function FromPropertyDescriptor(Desc) {
if (typeof Desc !== 'undefined') {

View file

@ -9,7 +9,7 @@ var inspect = require('object-inspect');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
// https://262.ecma-international.org/6.0/#sec-get-o-p
module.exports = function Get(O, P) {
// 7.3.1.1

View file

@ -16,7 +16,8 @@ var GetMethod = require('./GetMethod');
var IsArray = require('./IsArray');
var Type = require('./Type');
// https://262.ecma-international.org/9.0/#sec-getiterator
// https://262.ecma-international.org/11.0/#sec-getiterator
module.exports = function GetIterator(obj, hint, method) {
var actualHint = hint;
if (arguments.length < 2) {

View file

@ -8,7 +8,7 @@ var Type = require('./Type');
var assertRecord = require('../helpers/assertRecord');
// https://ecma-international.org/ecma-262/13.0/#sec-getmatchindexpair
// https://262.ecma-international.org/13.0/#sec-getmatchindexpair
module.exports = function GetMatchIndexPair(S, match) {
if (Type(S) !== 'String') {

View file

@ -9,7 +9,7 @@ var Type = require('./Type');
var assertRecord = require('../helpers/assertRecord');
// https://ecma-international.org/ecma-262/13.0/#sec-getmatchstring
// https://262.ecma-international.org/13.0/#sec-getmatchstring
module.exports = function GetMatchString(S, match) {
if (Type(S) !== 'String') {

View file

@ -8,9 +8,9 @@ var GetV = require('./GetV');
var IsCallable = require('./IsCallable');
var IsPropertyKey = require('./IsPropertyKey');
var debug = require('object-inspect');
var inspect = require('object-inspect');
// https://ecma-international.org/ecma-262/6.0/#sec-getmethod
// https://262.ecma-international.org/6.0/#sec-getmethod
module.exports = function GetMethod(O, P) {
// 7.3.9.1
@ -28,7 +28,7 @@ module.exports = function GetMethod(O, P) {
// 7.3.9.5
if (!IsCallable(func)) {
throw new $TypeError(P + ' is not a function: ' + debug(func));
throw new $TypeError(inspect(P) + ' is not a function: ' + inspect(func));
}
// 7.3.9.6

View file

@ -12,7 +12,7 @@ var keys = require('object-keys');
var esType = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys
// https://262.ecma-international.org/6.0/#sec-getownpropertykeys
module.exports = function GetOwnPropertyKeys(O, Type) {
if (esType(O) !== 'Object') {

View file

@ -8,7 +8,7 @@ var Get = require('./Get');
var IsCallable = require('./IsCallable');
var IsConstructor = require('./IsConstructor');
// https://ecma-international.org/ecma-262/12.0/#sec-getpromiseresolve
// https://262.ecma-international.org/12.0/#sec-getpromiseresolve
module.exports = function GetPromiseResolve(promiseConstructor) {
if (!IsConstructor(promiseConstructor)) {

View file

@ -10,10 +10,13 @@ var Get = require('./Get');
var IsConstructor = require('./IsConstructor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor
// https://262.ecma-international.org/6.0/#sec-getprototypefromconstructor
module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) {
var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
if (Type(intrinsic) !== 'Object') {
throw new $TypeError('intrinsicDefaultProto must be an object');
}
if (!IsConstructor(constructor)) {
throw new $TypeError('Assertion failed: `constructor` must be a constructor');
}

View file

@ -5,19 +5,20 @@ var callBound = require('call-bind/callBound');
var $TypeError = GetIntrinsic('%TypeError%');
var IsIntegralNumber = require('./IsIntegralNumber');
var StringToCodePoints = require('./StringToCodePoints');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var $indexOf = callBound('String.prototype.indexOf');
// https://ecma-international.org/ecma-262/13.0/#sec-getstringindex
// https://262.ecma-international.org/13.0/#sec-getstringindex
module.exports = function GetStringIndex(S, e) {
if (Type(S) !== 'String') {
throw new $TypeError('Assertion failed: `S` must be a String');
}
if (!IsIntegralNumber(e) || e < 0) {
if (!isInteger(e) || e < 0) {
throw new $TypeError('Assertion failed: `e` must be a non-negative integer');
}

View file

@ -19,16 +19,12 @@ var inspect = require('object-inspect');
var Get = require('./Get');
var IsArray = require('./IsArray');
var IsIntegralNumber = require('./IsIntegralNumber');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var Type = require('./Type');
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false
var isStringOrHole = function (capture, index, arr) {
return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined');
};
var isInteger = require('../helpers/isInteger');
var isStringOrHole = require('../helpers/isStringOrHole');
// http://www.ecma-international.org/ecma-262/12.0/#sec-getsubstitution
@ -44,7 +40,7 @@ module.exports = function GetSubstitution(matched, str, position, captures, name
}
var stringLength = str.length;
if (!IsIntegralNumber(position) || position < 0 || position > stringLength) {
if (!isInteger(position) || position < 0 || position > stringLength) {
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
}

View file

@ -4,20 +4,22 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var ToObject = require('./ToObject');
var inspect = require('object-inspect');
// https://ecma-international.org/ecma-262/6.0/#sec-getv
var IsPropertyKey = require('./IsPropertyKey');
// var ToObject = require('./ToObject');
// https://262.ecma-international.org/6.0/#sec-getv
module.exports = function GetV(V, P) {
// 7.3.2.1
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
}
// 7.3.2.2-3
var O = ToObject(V);
// var O = ToObject(V);
// 7.3.2.4
return O[P];
return V[P];
};

110
node_modules/es-abstract/2022/GetValueFromBuffer.js generated vendored Normal file
View file

@ -0,0 +1,110 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
var callBound = require('call-bind/callBound');
var $slice = callBound('Array.prototype.slice');
var isInteger = require('../helpers/isInteger');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var RawBytesToNumeric = require('./RawBytesToNumeric');
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 defaultEndianness = require('../helpers/defaultEndianness');
// https://262.ecma-international.org/11.0/#sec-getvaluefrombuffer
module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type, isTypedArray, order) {
var isSAB = isSharedArrayBuffer(arrayBuffer);
if (!isArrayBuffer(arrayBuffer) && !isSAB) {
throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer');
}
if (!isInteger(byteIndex)) {
throw new $TypeError('Assertion failed: `byteIndex` must be an integer');
}
if (typeof type !== 'string' || typeof table61['$' + type] !== 'number') {
throw new $TypeError('Assertion failed: `type` must be a Typed Array element type');
}
if (typeof isTypedArray !== 'boolean') {
throw new $TypeError('Assertion failed: `isTypedArray` must be a boolean');
}
if (order !== 'SeqCst' && order !== 'Unordered') {
throw new $TypeError('Assertion failed: `order` must be either `SeqCst` or `Unordered`');
}
if (arguments.length > 5 && typeof arguments[5] !== 'boolean') {
throw new $TypeError('Assertion failed: `isLittleEndian` must be a boolean, if present');
}
if (IsDetachedBuffer(arrayBuffer)) {
throw new $TypeError('Assertion failed: `arrayBuffer` is detached'); // step 1
}
// 2. Assert: There are sufficient bytes in arrayBuffer starting at byteIndex to represent a value of type.
if (byteIndex < 0) {
throw new $TypeError('Assertion failed: `byteIndex` must be non-negative'); // step 3
}
// 4. Let block be arrayBuffer.[[ArrayBufferData]].
var elementSize = table61['$' + 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"');
}
var rawValue;
if (isSAB) { // step 6
/*
a. Let execution be the [[CandidateExecution]] field of the surrounding agent's Agent Record.
b. Let eventList be the [[EventList]] field of the element in execution.[[EventLists]] whose [[AgentSignifier]] is AgentSignifier().
c. If isTypedArray is true and type is "Int8", "Uint8", "Int16", "Uint16", "Int32", or "Uint32", let noTear be true; otherwise let noTear be false.
d. Let rawValue be a List of length elementSize of nondeterministically chosen byte values.
e. NOTE: In implementations, rawValue is the result of a non-atomic or atomic read instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency.
f. Let readEvent be ReadSharedMemory{ [[Order]]: order, [[NoTear]]: noTear, [[Block]]: block, [[ByteIndex]]: byteIndex, [[ElementSize]]: elementSize }.
g. Append readEvent to eventList.
h. Append Chosen Value Record { [[Event]]: readEvent, [[ChosenValue]]: rawValue } to execution.[[ChosenValues]].
*/
throw new $SyntaxError('SharedArrayBuffer is not supported by this implementation');
} else {
// 7. Let rawValue be a List of elementSize containing, in order, the elementSize sequence of bytes starting with block[byteIndex].
rawValue = $slice(new $Uint8Array(arrayBuffer, byteIndex), 0, elementSize); // step 6
}
// 8. If isLittleEndian is not present, set isLittleEndian to either true or false. The choice is implementation dependent and should be the alternative that is most efficient for the implementation. An implementation must use the same value each time this step is executed and the same value must be used for the corresponding step in the SetValueInBuffer abstract operation.
var isLittleEndian = arguments.length > 5 ? arguments[5] : defaultEndianness === 'little'; // step 8
var bytes = isLittleEndian
? $slice(safeConcat([0, 0, 0, 0, 0, 0, 0, 0], rawValue), -elementSize)
: $slice(safeConcat(rawValue, [0, 0, 0, 0, 0, 0, 0, 0]), 0, elementSize);
return RawBytesToNumeric(type, bytes, isLittleEndian);
};

View file

@ -9,7 +9,7 @@ var has = require('has');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
// https://262.ecma-international.org/6.0/#sec-hasownproperty
module.exports = function HasOwnProperty(O, P) {
if (Type(O) !== 'Object') {

View file

@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
// https://262.ecma-international.org/6.0/#sec-hasproperty
module.exports = function HasProperty(O, P) {
if (Type(O) !== 'Object') {

View file

@ -13,7 +13,7 @@ var OrdinaryHasInstance = require('./OrdinaryHasInstance');
var ToBoolean = require('./ToBoolean');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator
// https://262.ecma-international.org/6.0/#sec-instanceofoperator
module.exports = function InstanceofOperator(O, C) {
if (Type(O) !== 'Object') {

View file

@ -9,7 +9,7 @@ var IsArray = require('./IsArray');
var GetV = require('./GetV');
var IsPropertyKey = require('./IsPropertyKey');
// https://ecma-international.org/ecma-262/6.0/#sec-invoke
// https://262.ecma-international.org/6.0/#sec-invoke
module.exports = function Invoke(O, P) {
if (!IsPropertyKey(P)) {

View file

@ -2,11 +2,11 @@
var has = require('has');
var assertRecord = require('../helpers/assertRecord');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
var assertRecord = require('../helpers/assertRecord');
// https://262.ecma-international.org/5.1/#sec-8.10.1
module.exports = function IsAccessorDescriptor(Desc) {
if (typeof Desc === 'undefined') {

View file

@ -1,4 +1,4 @@
'use strict';
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
// https://262.ecma-international.org/6.0/#sec-isarray
module.exports = require('../helpers/IsArray');

View file

@ -9,7 +9,7 @@ var IsArray = require('./IsArray');
var ToBoolean = require('./ToBoolean');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
// https://262.ecma-international.org/6.0/#sec-isconcatspreadable
module.exports = function IsConcatSpreadable(O) {
if (Type(O) !== 'Object') {

View file

@ -12,7 +12,7 @@ try {
DefinePropertyOrThrow = null;
}
// https://ecma-international.org/ecma-262/6.0/#sec-isconstructor
// https://262.ecma-international.org/6.0/#sec-isconstructor
if (DefinePropertyOrThrow && $construct) {
var isConstructorMarker = {};

View file

@ -2,11 +2,11 @@
var has = require('has');
var assertRecord = require('../helpers/assertRecord');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
var assertRecord = require('../helpers/assertRecord');
// https://262.ecma-international.org/5.1/#sec-8.10.2
module.exports = function IsDataDescriptor(Desc) {
if (typeof Desc === 'undefined') {

View file

@ -4,10 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var $byteLength = callBound('%ArrayBuffer.prototype.byteLength%', true)
|| function byteLength(ab) { return ab.byteLength; }; // in node < 0.11, byteLength is an own nonconfigurable property
var $byteLength = require('array-buffer-byte-length');
var isArrayBuffer = require('is-array-buffer');
@ -23,7 +20,7 @@ module.exports = function IsDetachedBuffer(arrayBuffer) {
try {
new global[availableTypedArrays[0]](arrayBuffer); // eslint-disable-line no-new
} catch (error) {
return error.name === 'TypeError';
return !!error && error.name === 'TypeError';
}
}
return false;

View file

@ -7,7 +7,7 @@ var $isExtensible = GetIntrinsic('%Object.isExtensible%', true);
var isPrimitive = require('../helpers/isPrimitive');
// https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
// https://262.ecma-international.org/6.0/#sec-isextensible-o
module.exports = $preventExtensions
? function IsExtensible(obj) {

View file

@ -6,7 +6,7 @@ var IsAccessorDescriptor = require('./IsAccessorDescriptor');
var IsDataDescriptor = require('./IsDataDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor
// https://262.ecma-international.org/6.0/#sec-isgenericdescriptor
module.exports = function IsGenericDescriptor(Desc) {
if (typeof Desc === 'undefined') {

View file

@ -1,18 +1,9 @@
'use strict';
var abs = require('./abs');
var floor = require('./floor');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
// https://tc39.es/ecma262/#sec-isintegralnumber
// https://262.ecma-international.org/12.0/#sec-isinteger
module.exports = function IsIntegralNumber(argument) {
if (Type(argument) !== 'Number' || $isNaN(argument) || !$isFinite(argument)) {
return false;
}
var absValue = abs(argument);
return floor(absValue) === absValue;
return isInteger(argument);
};

View file

@ -86,5 +86,5 @@ module.exports = function IsLessThan(x, y, LeftFirst) {
return false;
}
return nx < ny; // by now, these are both nonzero, finite, and not equal
return nx < ny; // by now, these are both finite, and the same type
};

View file

@ -6,7 +6,7 @@ var $PromiseThen = callBound('Promise.prototype.then', true);
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-ispromise
// https://262.ecma-international.org/6.0/#sec-ispromise
module.exports = function IsPromise(x) {
if (Type(x) !== 'Object') {

View file

@ -1,6 +1,6 @@
'use strict';
// https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
// https://262.ecma-international.org/6.0/#sec-ispropertykey
module.exports = function IsPropertyKey(argument) {
return typeof argument === 'string' || typeof argument === 'symbol';

View file

@ -8,7 +8,7 @@ var hasRegExpMatcher = require('is-regex');
var ToBoolean = require('./ToBoolean');
// https://ecma-international.org/ecma-262/6.0/#sec-isregexp
// https://262.ecma-international.org/6.0/#sec-isregexp
module.exports = function IsRegExp(argument) {
if (!argument || typeof argument !== 'object') {

33
node_modules/es-abstract/2022/IsValidIntegerIndex.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsIntegralNumber = require('./IsIntegralNumber');
var isNegativeZero = require('../helpers/isNegativeZero');
var typedArrayBuffer = require('typed-array-buffer');
// https://262.ecma-international.org/12.0/#sec-isvalidintegerindex
module.exports = function IsValidIntegerIndex(O, index) {
// Assert: O is an Integer-Indexed exotic object.
var buffer = typedArrayBuffer(O); // step 1
if (typeof index !== 'number') {
throw new $TypeError('Assertion failed: Type(index) is not Number');
}
if (IsDetachedBuffer(buffer)) { return false; } // step 2
if (!IsIntegralNumber(index)) { return false; } // step 3
if (isNegativeZero(index)) { return false; } // step 4
if (index < 0 || index >= O.length) { return false; } // step 5
return true; // step 6
};

48
node_modules/es-abstract/2022/IsWordChar.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var $indexOf = callBound('String.prototype.indexOf');
var IsArray = require('./IsArray');
var IsIntegralNumber = require('./IsIntegralNumber');
var Type = require('./Type');
var WordCharacters = require('./WordCharacters');
var every = require('../helpers/every');
var isChar = function isChar(c) {
return typeof c === 'string';
};
// https://262.ecma-international.org/12.0/#sec-runtime-semantics-iswordchar-abstract-operation
// note: prior to ES2023, this AO erroneously omitted the latter of its arguments.
module.exports = function IsWordChar(e, InputLength, Input, IgnoreCase, Unicode) {
if (!IsIntegralNumber(e)) {
throw new $TypeError('Assertion failed: `e` must be an integer');
}
if (!IsIntegralNumber(InputLength)) {
throw new $TypeError('Assertion failed: `InputLength` must be an integer');
}
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') {
throw new $TypeError('Assertion failed: `IgnoreCase` and `Unicode` must be booleans');
}
if (e === -1 || e === InputLength) {
return false; // step 1
}
var c = Input[e]; // step 2
var wordChars = WordCharacters(IgnoreCase, Unicode);
return $indexOf(wordChars, c) > -1; // steps 3-4
};

View file

@ -10,7 +10,7 @@ var GetMethod = require('./GetMethod');
var IsCallable = require('./IsCallable');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose
// https://262.ecma-international.org/6.0/#sec-iteratorclose
module.exports = function IteratorClose(iterator, completion) {
if (Type(iterator) !== 'Object') {

View file

@ -8,7 +8,7 @@ var Get = require('./Get');
var ToBoolean = require('./ToBoolean');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete
// https://262.ecma-international.org/6.0/#sec-iteratorcomplete
module.exports = function IteratorComplete(iterResult) {
if (Type(iterResult) !== 'Object') {

View file

@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var Invoke = require('./Invoke');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-iteratornext
// https://262.ecma-international.org/6.0/#sec-iteratornext
module.exports = function IteratorNext(iterator, value) {
var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);

View file

@ -3,7 +3,7 @@
var IteratorComplete = require('./IteratorComplete');
var IteratorNext = require('./IteratorNext');
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep
// https://262.ecma-international.org/6.0/#sec-iteratorstep
module.exports = function IteratorStep(iterator) {
var result = IteratorNext(iterator);

View file

@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var Get = require('./Get');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue
// https://262.ecma-international.org/6.0/#sec-iteratorvalue
module.exports = function IteratorValue(iterResult) {
if (Type(iterResult) !== 'Object') {

View file

@ -14,7 +14,7 @@ var MonthFromTime = require('./MonthFromTime');
var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
var YearFromTime = require('./YearFromTime');
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12
// https://262.ecma-international.org/5.1/#sec-15.9.1.12
module.exports = function MakeDay(year, month, date) {
if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) {

View file

@ -25,7 +25,7 @@ var isMatchRecordOrUndefined = function isMatchRecordOrUndefined(m) {
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
// https://ecma-international.org/ecma-262/13.0/#sec-getmatchindexpair
// https://262.ecma-international.org/13.0/#sec-getmatchindexpair
module.exports = function MakeMatchIndicesIndexPairArray(S, indices, groupNames, hasGroups) {
if (Type(S) !== 'String') {

View file

@ -8,7 +8,7 @@ var msPerHour = timeConstants.msPerHour;
var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11
// https://262.ecma-international.org/12.0/#sec-maketime
module.exports = function MakeTime(hour, min, sec, ms) {
if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) {

36
node_modules/es-abstract/2022/NewPromiseCapability.js generated vendored Normal file
View file

@ -0,0 +1,36 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var IsCallable = require('es-abstract/2022/IsCallable');
var IsConstructor = require('es-abstract/2022/IsConstructor');
// https://262.ecma-international.org/6.0/#sec-newpromisecapability
module.exports = function NewPromiseCapability(C) {
if (!IsConstructor(C)) {
throw new $TypeError('C must be a constructor'); // step 1
}
var resolvingFunctions = { '[[Resolve]]': void undefined, '[[Reject]]': void undefined }; // step 3
var promise = new C(function (resolve, reject) { // steps 4-5
if (typeof resolvingFunctions['[[Resolve]]'] !== 'undefined' || typeof resolvingFunctions['[[Reject]]'] !== 'undefined') {
throw new $TypeError('executor has already been called'); // step 4.a, 4.b
}
resolvingFunctions['[[Resolve]]'] = resolve; // step 4.c
resolvingFunctions['[[Reject]]'] = reject; // step 4.d
}); // step 4-6
if (!IsCallable(resolvingFunctions['[[Resolve]]']) || !IsCallable(resolvingFunctions['[[Reject]]'])) {
throw new $TypeError('executor must provide valid resolve and reject functions'); // steps 7-8
}
return {
'[[Promise]]': promise,
'[[Resolve]]': resolvingFunctions['[[Resolve]]'],
'[[Reject]]': resolvingFunctions['[[Reject]]']
}; // step 9
};

View file

@ -2,25 +2,8 @@
var GetIntrinsic = require('get-intrinsic');
var $floor = GetIntrinsic('%Math.floor%');
var $log = GetIntrinsic('%Math.log%');
var $log2E = GetIntrinsic('%Math.LOG2E%');
var $log2 = GetIntrinsic('%Math.log2%', true) || function log2(x) {
return $log(x) * $log2E;
};
var $parseInt = GetIntrinsic('%parseInt%');
var $pow = GetIntrinsic('%Math.pow%');
var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');
var $BigInt = GetIntrinsic('%BigInt%', true);
var callBound = require('call-bind/callBound');
var $reverse = callBound('Array.prototype.reverse');
var $numberToString = callBound('Number.prototype.toString');
var $strSlice = callBound('String.prototype.slice');
var abs = require('./abs');
var hasOwnProperty = require('./HasOwnProperty');
var ToBigInt64 = require('./ToBigInt64');
var ToBigUint64 = require('./ToBigUint64');
@ -33,8 +16,9 @@ var ToUint8 = require('./ToUint8');
var ToUint8Clamp = require('./ToUint8Clamp');
var Type = require('./Type');
var isNaN = require('../helpers/isNaN');
var isFinite = require('../helpers/isFinite');
var valueToFloat32Bytes = require('../helpers/valueToFloat32Bytes');
var valueToFloat64Bytes = require('../helpers/valueToFloat64Bytes');
var integerToNBytes = require('../helpers/integerToNBytes');
var keys = require('object-keys');
@ -80,105 +64,10 @@ module.exports = function NumericToRawBytes(type, value, isLittleEndian) {
throw new $TypeError('Assertion failed: `isLittleEndian` must be a Boolean');
}
var rawBytes = [];
var exponent;
if (type === 'Float32') { // step 1
if (isNaN(value)) {
return isLittleEndian ? [0, 0, 192, 127] : [127, 192, 0, 0]; // hardcoded
}
var leastSig;
if (value === 0) {
leastSig = Object.is(value, -0) ? 0x80 : 0;
return isLittleEndian ? [0, 0, 0, leastSig] : [leastSig, 0, 0, 0];
}
if (!isFinite(value)) {
leastSig = value < 0 ? 255 : 127;
return isLittleEndian ? [0, 0, 128, leastSig] : [leastSig, 128, 0, 0];
}
var sign = value < 0 ? 1 : 0;
value = abs(value); // eslint-disable-line no-param-reassign
exponent = 0;
while (value >= 2) {
exponent += 1;
value /= 2; // eslint-disable-line no-param-reassign
}
while (value < 1) {
exponent -= 1;
value *= 2; // eslint-disable-line no-param-reassign
}
var mantissa = value - 1;
mantissa *= $pow(2, 23);
mantissa = $floor(mantissa);
exponent += 127;
exponent = exponent << 23;
var result = sign << 31;
result |= exponent;
result |= mantissa;
var byte0 = result & 255;
result = result >> 8;
var byte1 = result & 255;
result = result >> 8;
var byte2 = result & 255;
result = result >> 8;
var byte3 = result & 255;
if (isLittleEndian) {
return [byte0, byte1, byte2, byte3];
}
return [byte3, byte2, byte1, byte0];
return valueToFloat32Bytes(value, isLittleEndian);
} else if (type === 'Float64') { // step 2
if (value === 0) {
leastSig = Object.is(value, -0) ? 0x80 : 0;
return isLittleEndian ? [0, 0, 0, 0, 0, 0, 0, leastSig] : [leastSig, 0, 0, 0, 0, 0, 0, 0];
}
if (isNaN(value)) {
return isLittleEndian ? [0, 0, 0, 0, 0, 0, 248, 127] : [127, 248, 0, 0, 0, 0, 0, 0];
}
if (!isFinite(value)) {
var infBytes = value < 0 ? [0, 0, 0, 0, 0, 0, 240, 255] : [0, 0, 0, 0, 0, 0, 240, 127];
return isLittleEndian ? infBytes : $reverse(infBytes);
}
var isNegative = value < 0;
if (isNegative) { value = -value; } // eslint-disable-line no-param-reassign
exponent = $floor($log2(value));
var significand = (value / $pow(2, exponent)) - 1;
var bitString = '';
for (var i = 0; i < 52; i++) {
significand *= 2;
if (significand >= 1) {
bitString += '1';
significand -= 1;
} else {
bitString += '0';
}
}
exponent += 1023;
var exponentBits = $numberToString(exponent, 2);
while (exponentBits.length < 11) { exponentBits = '0' + exponentBits; }
var fullBitString = (isNegative ? '1' : '0') + exponentBits + bitString;
while (fullBitString.length < 64) { fullBitString = '0' + fullBitString; }
for (i = 0; i < 8; i++) {
rawBytes[i] = $parseInt($strSlice(fullBitString, i * 8, (i + 1) * 8), 2);
}
return isLittleEndian ? $reverse(rawBytes) : rawBytes;
return valueToFloat64Bytes(value, isLittleEndian);
} // step 3
var n = TypeToSizes[type]; // step 3.a
@ -187,23 +76,5 @@ module.exports = function NumericToRawBytes(type, value, isLittleEndian) {
var intValue = convOp(value); // step 3.c
var isBigInt = type === 'BigInt64' || type === 'BigUint64';
/*
if (intValue >= 0) { // step 3.d
// Let rawBytes be a List containing the n-byte binary encoding of intValue. If isLittleEndian is false, the bytes are ordered in big endian order. Otherwise, the bytes are ordered in little endian order.
} else { // step 3.e
// Let rawBytes be a List containing the n-byte binary 2's complement encoding of intValue. If isLittleEndian is false, the bytes are ordered in big endian order. Otherwise, the bytes are ordered in little endian order.
}
*/
if (intValue < 0) {
intValue = intValue >>> 0;
}
var OxFF = isBigInt ? $BigInt(0xFF) : 0xFF;
var eight = isBigInt ? $BigInt(8) : 8;
for (i = 0; i < n; i++) {
rawBytes[isLittleEndian ? i : n - 1 - i] = $Number(intValue & OxFF);
intValue = intValue >> eight;
}
return rawBytes; // step 4
return integerToNBytes(intValue, n, isLittleEndian); // step 3.d, 3.e, 4
};

View file

@ -3,7 +3,6 @@
var callBound = require('call-bind/callBound');
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
var FromPropertyDescriptor = require('./FromPropertyDescriptor');
var Get = require('./Get');
var ToObject = require('./ToObject');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
@ -32,7 +31,6 @@ module.exports = function ObjectDefineProperties(O, Properties) {
forEach(descriptors, function (pair) { // step 5
var P = pair[0]; // step 5.a
var desc = pair[1]; // step 5.b
desc = FromPropertyDescriptor(desc); // TODO: remove this once DefinePropertyOrThrow is fixed
DefinePropertyOrThrow(O, P, desc); // step 5.c
});

View file

@ -17,7 +17,7 @@ var SameValue = require('./SameValue');
var Type = require('./Type');
var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor');
// https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty
// https://262.ecma-international.org/6.0/#sec-ordinarydefineownproperty
module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) {
if (Type(O) !== 'Object') {

View file

@ -17,7 +17,7 @@ var IsRegExp = require('./IsRegExp');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
// https://262.ecma-international.org/6.0/#sec-ordinarygetownproperty
module.exports = function OrdinaryGetOwnProperty(O, P) {
if (Type(O) !== 'Object') {

View file

@ -8,10 +8,10 @@ var Get = require('./Get');
var IsCallable = require('./IsCallable');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance
// https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
module.exports = function OrdinaryHasInstance(C, O) {
if (IsCallable(C) === false) {
if (!IsCallable(C)) {
return false;
}
if (Type(O) !== 'Object') {

View file

@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty
// https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty
module.exports = function OrdinaryHasProperty(O, P) {
if (Type(O) !== 'Object') {

View file

@ -18,7 +18,7 @@ var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint');
var has = require('has');
// https://ecma-international.org/ecma-262/12.0/#sec-quotejsonstring
// https://262.ecma-international.org/12.0/#sec-quotejsonstring
var escapes = {
'\u0008': '\\b',

View file

@ -3,7 +3,6 @@
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $pow = GetIntrinsic('%Math.pow%');
var $RangeError = GetIntrinsic('%RangeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
@ -15,6 +14,9 @@ var IsBigIntElementType = require('./IsBigIntElementType');
var IsUnsignedElementType = require('./IsUnsignedElementType');
var Type = require('./Type');
var bytesAsFloat32 = require('../helpers/bytesAsFloat32');
var bytesAsFloat64 = require('../helpers/bytesAsFloat64');
var bytesAsInteger = require('../helpers/bytesAsInteger');
var every = require('../helpers/every');
var isByteValue = require('../helpers/isByteValue');
@ -67,90 +69,16 @@ module.exports = function RawBytesToNumeric(type, rawBytes, isLittleEndian) {
// eslint-disable-next-line no-param-reassign
rawBytes = $slice(rawBytes, 0, elementSize);
if (!isLittleEndian) {
// eslint-disable-next-line no-param-reassign
rawBytes = $reverse(rawBytes); // step 2
$reverse(rawBytes); // step 2
}
/* eslint no-redeclare: 1 */
if (type === 'Float32') { // step 3
/*
Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2008 binary32 value.
If value is an IEEE 754-2008 binary32 NaN value, return the NaN Number value.
Return the Number value that corresponds to value.
*/
var sign = (rawBytes[3] & 0x80) >> 7; // first bit
var exponent = ((rawBytes[3] & 0x7F) << 1) // 7 bits from index 3
| ((rawBytes[2] & 0x80) >> 7); // 1 bit from index 2
var mantissa = ((rawBytes[2] & 0x7F) << 16) // 7 bits from index 2
| (rawBytes[1] << 8) // 8 bits from index 1
| rawBytes[0]; // 8 bits from index 0
if (exponent === 0 && mantissa === 0) {
return sign === 0 ? 0 : -0;
}
if (exponent === 0xFF && mantissa === 0) {
return sign === 0 ? Infinity : -Infinity;
}
if (exponent === 0xFF && mantissa !== 0) {
return NaN;
}
exponent -= 127; // subtract the bias
// return $pow(-1, sign) * mantissa / $pow(2, 23) * $pow(2, exponent);
// return $pow(-1, sign) * (mantissa + 0x1000000) * $pow(2, exponent - 23);
return $pow(-1, sign) * (1 + (mantissa / $pow(2, 23))) * $pow(2, exponent);
return bytesAsFloat32(rawBytes);
}
if (type === 'Float64') { // step 4
/*
Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2008 binary64 value.
If value is an IEEE 754-2008 binary64 NaN value, return the NaN Number value.
Return the Number value that corresponds to value.
*/
var sign = rawBytes[7] & 0x80 ? -1 : 1; // first bit
var exponent = ((rawBytes[7] & 0x7F) << 4) // 7 bits from index 7
| ((rawBytes[6] & 0xF0) >> 4); // 4 bits from index 6
var mantissa = ((rawBytes[6] & 0x0F) * 0x1000000000000) // 4 bits from index 6
+ (rawBytes[5] * 0x10000000000) // 8 bits from index 5
+ (rawBytes[4] * 0x100000000) // 8 bits from index 4
+ (rawBytes[3] * 0x1000000) // 8 bits from index 3
+ (rawBytes[2] * 0x10000) // 8 bits from index 2
+ (rawBytes[1] * 0x100) // 8 bits from index 1
+ rawBytes[0]; // 8 bits from index 0
if (exponent === 0 && mantissa === 0) {
return sign * 0;
}
if (exponent === 0x7FF && mantissa !== 0) {
return NaN;
}
if (exponent === 0x7FF && mantissa === 0) {
return sign * Infinity;
}
exponent -= 1023; // subtract the bias
return sign * (mantissa + 0x10000000000000) * $pow(2, exponent - 52);
return bytesAsFloat64(rawBytes);
}
// this is common to both branches
var intValue = isBigInt ? $BigInt(0) : 0;
for (var i = 0; i < rawBytes.length; i++) {
intValue |= isBigInt ? $BigInt(rawBytes[i]) << $BigInt(8 * i) : rawBytes[i] << (8 * i);
}
/*
Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of an unsigned little-endian binary number.
*/
if (!IsUnsignedElementType(type)) { // steps 5-6
// Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of a binary little-endian 2's complement number of bit length elementSize × 8.
var bitLength = elementSize * 8;
if (bitLength < 32) {
var x = isBigInt ? $BigInt(32 - bitLength) : 32 - bitLength;
intValue = (intValue << x) >> x;
}
}
return intValue; // step 7
return bytesAsInteger(rawBytes, elementSize, IsUnsignedElementType(type), isBigInt);
};

View file

@ -11,7 +11,7 @@ var Get = require('./Get');
var IsCallable = require('./IsCallable');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-regexpexec
// https://262.ecma-international.org/6.0/#sec-regexpexec
module.exports = function RegExpExec(R, S) {
if (Type(R) !== 'Object') {

View file

@ -2,7 +2,7 @@
var $isNaN = require('../helpers/isNaN');
// https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero
// https://262.ecma-international.org/6.0/#sec-samevaluezero
module.exports = function SameValueZero(x, y) {
return (x === y) || ($isNaN(x) && $isNaN(y));

View file

@ -18,7 +18,7 @@ var noThrowOnStrictViolation = (function () {
}
}());
// https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw
// https://262.ecma-international.org/6.0/#sec-set-o-p-v-throw
module.exports = function Set(O, P, V, Throw) {
if (Type(O) !== 'Object') {

View file

@ -7,10 +7,11 @@ var $TypeError = GetIntrinsic('%TypeError%');
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
var HasOwnProperty = require('./HasOwnProperty');
var IsExtensible = require('./IsExtensible');
var IsIntegralNumber = require('./IsIntegralNumber');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/12.0/#sec-setfunctionlength
var isInteger = require('../helpers/isInteger');
// https://262.ecma-international.org/12.0/#sec-setfunctionlength
module.exports = function SetFunctionLength(F, length) {
if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) {
@ -19,7 +20,7 @@ module.exports = function SetFunctionLength(F, length) {
if (Type(length) !== 'Number') {
throw new $TypeError('Assertion failed: `length` must be a Number');
}
if (length !== Infinity && (!IsIntegralNumber(length) || length < 0)) {
if (length !== Infinity && (!isInteger(length) || length < 0)) {
throw new $TypeError('Assertion failed: `length` must be ∞, or an integer >= 0');
}
return DefinePropertyOrThrow(F, 'length', {

View file

@ -12,7 +12,7 @@ var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
var IsExtensible = require('./IsExtensible');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname
// https://262.ecma-international.org/6.0/#sec-setfunctionname
module.exports = function SetFunctionName(F, name) {
if (typeof F !== 'function') {

View file

@ -15,7 +15,7 @@ var IsAccessorDescriptor = require('./IsAccessorDescriptor');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel
// https://262.ecma-international.org/6.0/#sec-setintegritylevel
module.exports = function SetIntegrityLevel(O, level) {
if (Type(O) !== 'Object') {

View file

@ -0,0 +1,96 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var isTypedArray = require('is-typed-array');
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 isInteger = require('../helpers/isInteger');
var Get = require('./Get');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var LengthOfArrayLike = require('./LengthOfArrayLike');
var SetValueInBuffer = require('./SetValueInBuffer');
var ToBigInt = require('./ToBigInt');
var ToNumber = require('./ToNumber');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var TypedArrayElementSize = require('./TypedArrayElementSize');
var TypedArrayElementType = require('./TypedArrayElementType');
// https://262.ecma-international.org/13.0/#sec-settypedarrayfromarraylike
module.exports = function SetTypedArrayFromArrayLike(target, targetOffset, source) {
var whichTarget = whichTypedArray(target);
if (!whichTarget) {
throw new $TypeError('Assertion failed: target must be a TypedArray instance');
}
if (targetOffset !== Infinity && (!isInteger(targetOffset) || targetOffset < 0)) {
throw new $TypeError('Assertion failed: targetOffset must be a non-negative integer or +Infinity');
}
if (isTypedArray(source)) {
throw new $TypeError('Assertion failed: source must not be a TypedArray instance');
}
var targetBuffer = typedArrayBuffer(target); // step 1
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('targets buffer is detached'); // step 2
}
var targetLength = typedArrayLength(target); // step 3
var targetElementSize = TypedArrayElementSize(target); // step 4
var targetType = TypedArrayElementType(target); // step 5
var targetByteOffset = typedArrayByteOffset(target); // step 6
var src = ToObject(source); // step 7
var srcLength = LengthOfArrayLike(src); // step 8
if (targetOffset === Infinity) {
throw new $RangeError('targetOffset must be a finite integer'); // step 9
}
if (srcLength + targetOffset > targetLength) {
throw new $RangeError('targetOffset + srcLength must be <= target.length'); // step 10
}
var targetByteIndex = (targetOffset * targetElementSize) + targetByteOffset; // step 11
var k = 0; // step 12
var limit = targetByteIndex + (targetElementSize * srcLength); // step 13
while (targetByteIndex < limit) { // step 14
var Pk = ToString(k); // step 14.a
var value = Get(src, Pk); // step 14.b
if (targetType === 'BigInt64' || targetType === 'BigUint64') {
value = ToBigInt(value); // step 14.c
} else {
value = ToNumber(value); // step 14.d
}
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('targets buffer is detached'); // step 14.e
}
SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value, true, 'Unordered'); // step 14.f
k += 1; // step 14.g
targetByteIndex += targetElementSize; // step 14.h
}
};

View file

@ -0,0 +1,135 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $RangeError = GetIntrinsic('%RangeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteLength = require('typed-array-byte-length');
var typedArrayByteOffset = require('typed-array-byte-offset');
var typedArrayLength = require('typed-array-length');
var whichTypedArray = require('which-typed-array');
var isInteger = require('../helpers/isInteger');
var CloneArrayBuffer = require('./CloneArrayBuffer');
var GetValueFromBuffer = require('./GetValueFromBuffer');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsSharedArrayBuffer = require('./IsSharedArrayBuffer');
var SameValue = require('./SameValue');
var SetValueInBuffer = require('./SetValueInBuffer');
var TypedArrayElementSize = require('./TypedArrayElementSize');
var TypedArrayElementType = require('./TypedArrayElementType');
// https://262.ecma-international.org/13.0/#sec-settypedarrayfromtypedarray
module.exports = function SetTypedArrayFromTypedArray(target, targetOffset, source) {
var whichTarget = whichTypedArray(target);
if (!whichTarget) {
throw new $TypeError('Assertion failed: target must be a TypedArray instance');
}
if (targetOffset !== Infinity && (!isInteger(targetOffset) || targetOffset < 0)) {
throw new $TypeError('Assertion failed: targetOffset must be a non-negative integer or +Infinity');
}
var whichSource = whichTypedArray(source);
if (!whichSource) {
throw new $TypeError('Assertion failed: source must be a TypedArray instance');
}
var targetBuffer = typedArrayBuffer(target); // step 1
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('targets buffer is detached'); // step 2
}
var targetLength = typedArrayLength(target); // step 3
var srcBuffer = typedArrayBuffer(source); // step 4
if (IsDetachedBuffer(srcBuffer)) {
throw new $TypeError('sources buffer is detached'); // step 5
}
var targetType = TypedArrayElementType(target); // step 6
var targetElementSize = TypedArrayElementSize(target); // step 7
var targetByteOffset = typedArrayByteOffset(target); // step 8
var srcType = TypedArrayElementType(source); // step 9
var srcElementSize = TypedArrayElementSize(source); // step 10
var srcLength = typedArrayLength(source); // step 11
var srcByteOffset = typedArrayByteOffset(source); // step 12
if (targetOffset === Infinity) {
throw new $RangeError('targetOffset must be a non-negative integer or +Infinity'); // step 13
}
if (srcLength + targetOffset > targetLength) {
throw new $RangeError('targetOffset + source.length must not be greater than target.length'); // step 14
}
var targetContentType = whichTarget === 'BigInt64Array' || whichTarget === 'BigUint64Array' ? 'BigInt' : 'Number';
var sourceContentType = whichSource === 'BigInt64Array' || whichSource === 'BigUint64Array' ? 'BigInt' : 'Number';
if (targetContentType !== sourceContentType) {
throw new $TypeError('source and target must have the same content type'); // step 15
}
var same;
if (IsSharedArrayBuffer(srcBuffer) && IsSharedArrayBuffer(targetBuffer)) { // step 16
// a. If srcBuffer.[[ArrayBufferData]] and targetBuffer.[[ArrayBufferData]] are the same Shared Data Block values, let same be true; else let same be false.
throw new $SyntaxError('SharedArrayBuffer is not supported by this implementation');
} else {
same = SameValue(srcBuffer, targetBuffer); // step 17
}
var srcByteIndex;
if (same) { // step 18
var srcByteLength = typedArrayByteLength(source); // step 18.a
srcBuffer = CloneArrayBuffer(srcBuffer, srcByteOffset, srcByteLength, $ArrayBuffer); // step 18.b
// c. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not have any observable side-effects.
srcByteIndex = 0; // step 18.d
} else {
srcByteIndex = srcByteOffset; // step 19
}
var targetByteIndex = (targetOffset * targetElementSize) + targetByteOffset; // step 20
var limit = targetByteIndex + (targetElementSize * srcLength); // step 21
var value;
if (srcType === targetType) { // step 22
// a. NOTE: If srcType and targetType are the same, the transfer must be performed in a manner that preserves the bit-level encoding of the source data.
while (targetByteIndex < limit) { // step 22.b
value = GetValueFromBuffer(srcBuffer, srcByteIndex, 'Uint8', true, 'Unordered'); // step 22.b.i
SetValueInBuffer(targetBuffer, targetByteIndex, 'Uint8', value, true, 'Unordered'); // step 22.b.ii
srcByteIndex += 1; // step 22.b.iii
targetByteIndex += 1; // step 22.b.iv
}
} else { // step 23
while (targetByteIndex < limit) { // step 23.a
value = GetValueFromBuffer(srcBuffer, srcByteIndex, srcType, true, 'Unordered'); // step 23.a.i
SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value, true, 'Unordered'); // step 23.a.ii
srcByteIndex += srcElementSize; // step 23.a.iii
targetByteIndex += targetElementSize; // step 23.a.iv
}
}
};

105
node_modules/es-abstract/2022/SetValueInBuffer.js generated vendored Normal file
View file

@ -0,0 +1,105 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var isInteger = require('../helpers/isInteger');
var IsBigIntElementType = require('./IsBigIntElementType');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var NumericToRawBytes = require('./NumericToRawBytes');
var isArrayBuffer = require('is-array-buffer');
var isSharedArrayBuffer = require('is-shared-array-buffer');
var has = require('has');
var table60 = {
__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 defaultEndianness = require('../helpers/defaultEndianness');
var forEach = require('../helpers/forEach');
// https://262.ecma-international.org/12.0/#sec-setvalueinbuffer
/* eslint max-params: 0 */
module.exports = function SetValueInBuffer(arrayBuffer, byteIndex, type, value, isTypedArray, order) {
var isSAB = isSharedArrayBuffer(arrayBuffer);
if (!isArrayBuffer(arrayBuffer) && !isSAB) {
throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer');
}
if (!isInteger(byteIndex) || byteIndex < 0) {
throw new $TypeError('Assertion failed: `byteIndex` must be a non-negative integer');
}
if (typeof type !== 'string' || !has(table60, type)) {
throw new $TypeError('Assertion failed: `type` must be a Typed Array Element Type');
}
if (typeof value !== 'number' && typeof value !== 'bigint') {
throw new $TypeError('Assertion failed: `value` must be a Number or a BigInt');
}
if (typeof isTypedArray !== 'boolean') {
throw new $TypeError('Assertion failed: `isTypedArray` must be a boolean');
}
if (order !== 'SeqCst' && order !== 'Unordered' && order !== 'Init') {
throw new $TypeError('Assertion failed: `order` must be `"SeqCst"`, `"Unordered"`, or `"Init"`');
}
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
throw new $TypeError('Assertion failed: `isLittleEndian` must be a boolean, if present');
}
if (IsDetachedBuffer(arrayBuffer)) {
throw new $TypeError('Assertion failed: ArrayBuffer is detached'); // step 1
}
// 2. Assert: There are sufficient bytes in arrayBuffer starting at byteIndex to represent a value of type.
if (IsBigIntElementType(type) ? typeof value !== 'bigint' : typeof value !== 'number') { // step 3
throw new $TypeError('Assertion failed: `value` must be a BigInt if type is BigInt64 or BigUint64, otherwise a Number');
}
// 4. Let block be arrayBuffers [[ArrayBufferData]] internal slot.
var elementSize = table60[type]; // step 5
// 6. If isLittleEndian is not present, set isLittleEndian to either true or false. The choice is implementation dependent and should be the alternative that is most efficient for the implementation. An implementation must use the same value each time this step is executed and the same value must be used for the corresponding step in the GetValueFromBuffer abstract operation.
var isLittleEndian = arguments.length > 6 ? arguments[6] : defaultEndianness === 'little'; // step 6
var rawBytes = NumericToRawBytes(type, value, isLittleEndian); // step 7
if (isSAB) { // step 8
/*
Let execution be the [[CandidateExecution]] field of the surrounding agent's Agent Record.
Let eventList be the [[EventList]] field of the element in execution.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier().
If isTypedArray is true and IsNoTearConfiguration(type, order) is true, let noTear be true; otherwise let noTear be false.
Append WriteSharedMemory { [[Order]]: order, [[NoTear]]: noTear, [[Block]]: block, [[ByteIndex]]: byteIndex, [[ElementSize]]: elementSize, [[Payload]]: rawBytes } to eventList.
*/
throw new $SyntaxError('SharedArrayBuffer is not supported by this implementation');
} else {
// 9. Store the individual bytes of rawBytes into block, in order, starting at block[byteIndex].
var arr = new Uint8Array(arrayBuffer, byteIndex, elementSize);
forEach(rawBytes, function (rawByte, i) {
arr[i] = rawByte;
});
}
// 10. Return NormalCompletion(undefined).
};

View file

@ -8,23 +8,23 @@ var $TypeError = GetIntrinsic('%TypeError%');
var DeletePropertyOrThrow = require('./DeletePropertyOrThrow');
var Get = require('./Get');
var HasProperty = require('./HasProperty');
var IsIntegralNumber = require('./IsIntegralNumber');
var Set = require('./Set');
var ToString = require('./ToString');
var Type = require('./Type');
var isAbstractClosure = require('../helpers/isAbstractClosure');
var isInteger = require('../helpers/isInteger');
var $push = callBound('Array.prototype.push');
var $sort = callBound('Array.prototype.sort');
// https://ecma-international.org/ecma-262/13.0/#sec-sortindexedproperties
// https://262.ecma-international.org/13.0/#sec-sortindexedproperties
module.exports = function SortIndexedProperties(obj, len, SortCompare) {
if (Type(obj) !== 'Object') {
throw new $TypeError('Assertion failed: Type(obj) is not Object');
}
if (!IsIntegralNumber(len) || len < 0) {
if (!isInteger(len) || len < 0) {
throw new $TypeError('Assertion failed: `len` must be an integer >= 0');
}
if (!isAbstractClosure(SortCompare) || SortCompare.length !== 2) {

View file

@ -8,7 +8,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
var IsConstructor = require('./IsConstructor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor
// https://262.ecma-international.org/6.0/#sec-speciesconstructor
module.exports = function SpeciesConstructor(O, defaultConstructor) {
if (Type(O) !== 'Object') {

View file

@ -15,7 +15,7 @@ var Type = require('./Type');
var isNegativeZero = require('is-negative-zero');
// https://ecma-international.org/ecma-262/12.0/#sec-stringgetownproperty
// https://262.ecma-international.org/12.0/#sec-stringgetownproperty
module.exports = function StringGetOwnProperty(S, P) {
var str;

View file

@ -5,12 +5,13 @@ var callBound = require('call-bind/callBound');
var $TypeError = GetIntrinsic('%TypeError%');
var IsIntegralNumber = require('./IsIntegralNumber');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var $slice = callBound('String.prototype.slice');
// https://ecma-international.org/ecma-262/12.0/#sec-stringindexof
// https://262.ecma-international.org/12.0/#sec-stringindexof
module.exports = function StringIndexOf(string, searchValue, fromIndex) {
if (Type(string) !== 'String') {
@ -19,7 +20,7 @@ module.exports = function StringIndexOf(string, searchValue, fromIndex) {
if (Type(searchValue) !== 'String') {
throw new $TypeError('Assertion failed: `searchValue` must be a String');
}
if (!IsIntegralNumber(fromIndex) || fromIndex < 0) {
if (!isInteger(fromIndex) || fromIndex < 0) {
throw new $TypeError('Assertion failed: `fromIndex` must be a non-negative integer');
}

View file

@ -11,7 +11,7 @@ var $push = callBound('Array.prototype.push');
var CodePointAt = require('./CodePointAt');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/12.0/#sec-stringtocodepoints
// https://262.ecma-international.org/12.0/#sec-stringtocodepoints
module.exports = function StringToCodePoints(string) {
if (Type(string) !== 'String') {

View file

@ -18,22 +18,11 @@ var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
var hasNonWS = regexTester(nonWSregex);
// whitespace from: https://es5.github.io/#x15.5.4.20
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
var ws = [
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
'\u2029\uFEFF'
].join('');
var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
var $replace = callBound('String.prototype.replace');
var $trim = function (value) {
return $replace(value, trimRegex, '');
};
var $trim = require('string.prototype.trim');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/13.0/#sec-stringtonumber
// https://262.ecma-international.org/13.0/#sec-stringtonumber
module.exports = function StringToNumber(argument) {
if (Type(argument) !== 'String') {

View file

@ -10,7 +10,7 @@ var $SymbolToString = callBound('Symbol.prototype.toString', true);
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring
// https://262.ecma-international.org/6.0/#sec-symboldescriptivestring
module.exports = function SymbolDescriptiveString(sym) {
if (Type(sym) !== 'Symbol') {

View file

@ -13,7 +13,7 @@ var IsExtensible = require('./IsExtensible');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel
// https://262.ecma-international.org/6.0/#sec-testintegritylevel
module.exports = function TestIntegrityLevel(O, level) {
if (Type(O) !== 'Object') {

View file

@ -3,12 +3,15 @@
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $asIntN = GetIntrinsic('%BigInt.asIntN%', true);
var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var StringToBigInt = require('./StringToBigInt');
var ToPrimitive = require('./ToPrimitive');
var isNaN = require('../helpers/isNaN');
// https://262.ecma-international.org/11.0/#sec-tobigint
module.exports = function ToBigInt(argument) {
@ -18,8 +21,33 @@ module.exports = function ToBigInt(argument) {
var prim = ToPrimitive(argument, $Number);
if (typeof prim === 'number') {
return $asIntN(0, prim);
if (prim == null) {
throw new $TypeError('Cannot convert null or undefined to a BigInt');
}
return $BigInt(prim);
if (typeof prim === 'boolean') {
return prim ? $BigInt(1) : $BigInt(0);
}
if (typeof prim === 'number') {
throw new $TypeError('Cannot convert a Number value to a BigInt');
}
if (typeof prim === 'string') {
var n = StringToBigInt(prim);
if (isNaN(n)) {
throw new $TypeError('Failed to parse String to BigInt');
}
return n;
}
if (typeof prim === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a BigInt');
}
if (typeof prim !== 'bigint') {
throw new $SyntaxError('Assertion failed: unknown primitive type');
}
return prim;
};

View file

@ -4,12 +4,13 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $Date = GetIntrinsic('%Date%');
var $String = GetIntrinsic('%String%');
var $isNaN = require('../helpers/isNaN');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-todatestring
// https://262.ecma-international.org/6.0/#sec-todatestring
module.exports = function ToDateString(tv) {
if (Type(tv) !== 'Number') {
@ -18,5 +19,5 @@ module.exports = function ToDateString(tv) {
if ($isNaN(tv)) {
return 'Invalid Date';
}
return $Date(tv);
return $String(new $Date(tv));
};

View file

@ -8,7 +8,7 @@ var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
var ToLength = require('./ToLength');
var SameValue = require('./SameValue');
// https://www.ecma-international.org/ecma-262/8.0/#sec-toindex
// https://262.ecma-international.org/8.0/#sec-toindex
module.exports = function ToIndex(value) {
if (typeof value === 'undefined') {

View file

@ -2,7 +2,7 @@
var ToUint16 = require('./ToUint16');
// https://ecma-international.org/ecma-262/6.0/#sec-toint16
// https://262.ecma-international.org/6.0/#sec-toint16
module.exports = function ToInt16(argument) {
var int16bit = ToUint16(argument);

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