Spaces:
Paused
Paused
Include updated package-lock.json (part 19)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/es-abstract-get/.github/FUNDING.yml +12 -0
- node_modules/es-abstract-get/.nycrc +9 -0
- node_modules/es-abstract-get/CHANGELOG.md +15 -0
- node_modules/es-abstract-get/Get.d.ts +11 -0
- node_modules/es-abstract-get/Get.js +26 -0
- node_modules/es-abstract-get/GetMethod.d.ts +13 -0
- node_modules/es-abstract-get/GetMethod.js +36 -0
- node_modules/es-abstract-get/GetV.d.ts +11 -0
- node_modules/es-abstract-get/GetV.js +23 -0
- node_modules/es-abstract-get/LICENSE +21 -0
- node_modules/es-abstract-get/README.md +67 -0
- node_modules/es-abstract-get/eslint.config.mjs +42 -0
- node_modules/es-abstract-get/isPropertyKey.d.ts +9 -0
- node_modules/es-abstract-get/isPropertyKey.js +6 -0
- node_modules/es-abstract-get/package.json +95 -0
- node_modules/es-abstract-get/test/Get.js +43 -0
- node_modules/es-abstract-get/test/GetMethod.js +42 -0
- node_modules/es-abstract-get/test/GetV.js +43 -0
- node_modules/es-abstract-get/test/isPropertyKey.js +26 -0
- node_modules/es-abstract-get/tsconfig.json +6 -0
- node_modules/es-abstract/2023/thisTimeValue.js +9 -0
- node_modules/es-abstract/2023/truncate.js +15 -0
- node_modules/es-abstract/2024/AddEntriesFromIterable.js +44 -0
- node_modules/es-abstract/2024/AddToKeptObjects.js +18 -0
- node_modules/es-abstract/2024/AddValueToKeyedGroup.js +45 -0
- node_modules/es-abstract/2024/AdvanceStringIndex.js +30 -0
- node_modules/es-abstract/2024/AllCharacters.js +29 -0
- node_modules/es-abstract/2024/ApplyStringOrNumericBinaryOperator.js +77 -0
- node_modules/es-abstract/2024/ArrayBufferByteLength.js +41 -0
- node_modules/es-abstract/2024/ArrayBufferCopyAndDetach.js +101 -0
- node_modules/es-abstract/2024/ArrayCreate.js +42 -0
- node_modules/es-abstract/2024/ArraySetLength.js +77 -0
- node_modules/es-abstract/2024/ArraySpeciesCreate.js +48 -0
- node_modules/es-abstract/2024/AsyncFromSyncIteratorContinuation.js +45 -0
- node_modules/es-abstract/2024/AsyncIteratorClose.js +70 -0
- node_modules/es-abstract/2024/BigInt/add.js +14 -0
- node_modules/es-abstract/2024/BigInt/bitwiseAND.js +14 -0
- node_modules/es-abstract/2024/BigInt/bitwiseNOT.js +15 -0
- node_modules/es-abstract/2024/BigInt/bitwiseOR.js +14 -0
- node_modules/es-abstract/2024/BigInt/bitwiseXOR.js +14 -0
- node_modules/es-abstract/2024/BigInt/divide.js +20 -0
- node_modules/es-abstract/2024/BigInt/equal.js +13 -0
- node_modules/es-abstract/2024/BigInt/exponentiate.js +29 -0
- node_modules/es-abstract/2024/BigInt/index.js +39 -0
- node_modules/es-abstract/2024/BigInt/leftShift.js +14 -0
- node_modules/es-abstract/2024/BigInt/lessThan.js +14 -0
- node_modules/es-abstract/2024/BigInt/multiply.js +14 -0
- node_modules/es-abstract/2024/BigInt/remainder.js +28 -0
- node_modules/es-abstract/2024/BigInt/signedRightShift.js +15 -0
- node_modules/es-abstract/2024/BigInt/subtract.js +14 -0
node_modules/es-abstract-get/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# These are supported funding model platforms
|
| 2 |
+
|
| 3 |
+
github: [ljharb]
|
| 4 |
+
patreon: # Replace with a single Patreon username
|
| 5 |
+
open_collective: # Replace with a single Open Collective username
|
| 6 |
+
ko_fi: # Replace with a single Ko-fi username
|
| 7 |
+
tidelift: npm/es-abstract-get
|
| 8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
| 9 |
+
liberapay: # Replace with a single Liberapay username
|
| 10 |
+
issuehunt: # Replace with a single IssueHunt username
|
| 11 |
+
otechie: # Replace with a single Otechie username
|
| 12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/es-abstract-get/.nycrc
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"all": true,
|
| 3 |
+
"check-coverage": false,
|
| 4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
| 5 |
+
"exclude": [
|
| 6 |
+
"coverage",
|
| 7 |
+
"test"
|
| 8 |
+
]
|
| 9 |
+
}
|
node_modules/es-abstract-get/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file.
|
| 4 |
+
|
| 5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
| 6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
| 7 |
+
|
| 8 |
+
## v1.0.0 - 2026-06-15
|
| 9 |
+
|
| 10 |
+
### Commits
|
| 11 |
+
|
| 12 |
+
- Initial implementation, readme, tests, types, etc [`3e77971`](https://github.com/ljharb/es-abstract-get/commit/3e77971f2503a0db5232da5943e251353025dabb)
|
| 13 |
+
- Initial commit [`a267b43`](https://github.com/ljharb/es-abstract-get/commit/a267b430bba77c1e5f7efea3f5af73f33ec19d9d)
|
| 14 |
+
- npm init [`2751874`](https://github.com/ljharb/es-abstract-get/commit/2751874f7a511bcd5fa35864aa1cf180131ff175)
|
| 15 |
+
- Only apps should have lockfiles [`bade6ef`](https://github.com/ljharb/es-abstract-get/commit/bade6ef08f687091545bd6c41517424d989853a5)
|
node_modules/es-abstract-get/Get.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PropertyKey } from './isPropertyKey';
|
| 2 |
+
|
| 3 |
+
declare function Get<
|
| 4 |
+
T extends object,
|
| 5 |
+
K extends keyof T & PropertyKey,
|
| 6 |
+
>(
|
| 7 |
+
O: T,
|
| 8 |
+
P: K,
|
| 9 |
+
): T[keyof T] | undefined;
|
| 10 |
+
|
| 11 |
+
export = Get;
|
node_modules/es-abstract-get/Get.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var inspect = require('object-inspect');
|
| 6 |
+
|
| 7 |
+
var isObject = require('es-object-atoms/isObject');
|
| 8 |
+
|
| 9 |
+
var isPropertyKey = require('./isPropertyKey');
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/6.0/#sec-get-o-p
|
| 12 |
+
|
| 13 |
+
/** @type {import('./Get')} */
|
| 14 |
+
module.exports = function Get(O, P) {
|
| 15 |
+
// 7.3.1.1
|
| 16 |
+
var isObj = isObject(O);
|
| 17 |
+
if (!isObj) {
|
| 18 |
+
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
| 19 |
+
}
|
| 20 |
+
// 7.3.1.2
|
| 21 |
+
if (!isPropertyKey(P)) {
|
| 22 |
+
throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P));
|
| 23 |
+
}
|
| 24 |
+
// 7.3.1.3
|
| 25 |
+
return O[P];
|
| 26 |
+
};
|
node_modules/es-abstract-get/GetMethod.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PropertyKey } from './isPropertyKey';
|
| 2 |
+
|
| 3 |
+
type GoodMethodKey<O, K extends PropertyKey> =
|
| 4 |
+
K extends keyof O
|
| 5 |
+
? (O[K] extends Function | null | undefined ? K : never)
|
| 6 |
+
: K;
|
| 7 |
+
|
| 8 |
+
declare function GetMethod<O extends {}, K extends PropertyKey>(
|
| 9 |
+
V: O,
|
| 10 |
+
P: K & GoodMethodKey<O, K>,
|
| 11 |
+
): Function | undefined;
|
| 12 |
+
|
| 13 |
+
export = GetMethod;
|
node_modules/es-abstract-get/GetMethod.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var isCallable = require('is-callable');
|
| 6 |
+
|
| 7 |
+
var inspect = require('object-inspect');
|
| 8 |
+
|
| 9 |
+
var GetV = require('./GetV');
|
| 10 |
+
var isPropertyKey = require('./isPropertyKey');
|
| 11 |
+
|
| 12 |
+
// https://262.ecma-international.org/6.0/#sec-getmethod
|
| 13 |
+
|
| 14 |
+
/** @type {import('./GetMethod')} */
|
| 15 |
+
module.exports = function GetMethod(O, P) {
|
| 16 |
+
// 7.3.9.1
|
| 17 |
+
if (!isPropertyKey(P)) {
|
| 18 |
+
throw new $TypeError('Assertion failed: P is not a Property Key');
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
// 7.3.9.2
|
| 22 |
+
var func = GetV(O, P);
|
| 23 |
+
|
| 24 |
+
// 7.3.9.4
|
| 25 |
+
if (func == null) {
|
| 26 |
+
return void 0;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
// 7.3.9.5
|
| 30 |
+
if (!isCallable(func)) {
|
| 31 |
+
throw new $TypeError(inspect(P) + ' is not a function: ' + inspect(func));
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
// 7.3.9.6
|
| 35 |
+
return func;
|
| 36 |
+
};
|
node_modules/es-abstract-get/GetV.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare function GetV<T extends {}, K extends keyof T>(
|
| 2 |
+
V: T,
|
| 3 |
+
P: K,
|
| 4 |
+
): T[K];
|
| 5 |
+
|
| 6 |
+
declare function GetV<T extends {}, K extends keyof T>(
|
| 7 |
+
V: T,
|
| 8 |
+
P: PropertyKey,
|
| 9 |
+
): unknown;
|
| 10 |
+
|
| 11 |
+
export = GetV;
|
node_modules/es-abstract-get/GetV.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var inspect = require('object-inspect');
|
| 6 |
+
|
| 7 |
+
var isPropertyKey = require('./isPropertyKey');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/6.0/#sec-getv
|
| 10 |
+
|
| 11 |
+
/** @type {import('./GetV')} */
|
| 12 |
+
module.exports = function GetV(V, P) {
|
| 13 |
+
// 7.3.2.1
|
| 14 |
+
if (!isPropertyKey(P)) {
|
| 15 |
+
throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P));
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
// 7.3.2.2-3
|
| 19 |
+
// var O = ToObject(V);
|
| 20 |
+
|
| 21 |
+
// 7.3.2.4
|
| 22 |
+
return /** @type {Record<typeof P, unknown>} */ (V)[P]; // O.[[Get]](P, V)
|
| 23 |
+
};
|
node_modules/es-abstract-get/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Jordan Harband
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/es-abstract-get/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# es-abstract-get <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
| 2 |
+
|
| 3 |
+
[![github actions][actions-image]][actions-url]
|
| 4 |
+
[![coverage][codecov-image]][codecov-url]
|
| 5 |
+
[![License][license-image]][license-url]
|
| 6 |
+
[![Downloads][downloads-image]][downloads-url]
|
| 7 |
+
|
| 8 |
+
[![npm badge][npm-badge-png]][package-url]
|
| 9 |
+
|
| 10 |
+
The ECMAScript “getting properties” abstract operations — [`Get`][Get], [`GetV`][GetV], and [`GetMethod`][GetMethod] — plus the [`isPropertyKey`][isPropertyKey] helper they share, with TypeScript types.
|
| 11 |
+
|
| 12 |
+
## Motivation
|
| 13 |
+
|
| 14 |
+
These operations are also available in [`es-abstract`][es-abstract],
|
| 15 |
+
but `es-abstract` ships every abstract operation for every spec edition,
|
| 16 |
+
so depending on it to use one or two of them pulls in a very large dependency graph.
|
| 17 |
+
These three operations (and `isPropertyKey`) historically never differ between spec editions,
|
| 18 |
+
so they’re split out here:
|
| 19 |
+
a package that only needs `Get`, `GetV`, `GetMethod`, or `isPropertyKey` can depend on this instead and get a far smaller install.
|
| 20 |
+
|
| 21 |
+
Each operation is its own entry point - there is intentionally no main (`.`) export - so you only pay for what you import.
|
| 22 |
+
|
| 23 |
+
## Example
|
| 24 |
+
|
| 25 |
+
```js
|
| 26 |
+
var Get = require('es-abstract-get/Get');
|
| 27 |
+
var GetV = require('es-abstract-get/GetV');
|
| 28 |
+
var GetMethod = require('es-abstract-get/GetMethod');
|
| 29 |
+
var isPropertyKey = require('es-abstract-get/isPropertyKey');
|
| 30 |
+
var assert = require('assert');
|
| 31 |
+
|
| 32 |
+
// Get(O, P): O must be an Object
|
| 33 |
+
assert.equal(Get({ a: 1 }, 'a'), 1);
|
| 34 |
+
|
| 35 |
+
// GetV(V, P): V may be a primitive (it is coerced to an object for the lookup,
|
| 36 |
+
// but the original value is the receiver)
|
| 37 |
+
assert.equal(GetV('abc', 'length'), 3);
|
| 38 |
+
|
| 39 |
+
// GetMethod(O, P): returns undefined for null/undefined, throws if not callable
|
| 40 |
+
assert.equal(GetMethod({}, 'toString'), Object.prototype.toString);
|
| 41 |
+
assert.equal(GetMethod({ a: null }, 'a'), undefined);
|
| 42 |
+
|
| 43 |
+
// isPropertyKey(argument): true for strings and symbols
|
| 44 |
+
assert.equal(isPropertyKey('a'), true);
|
| 45 |
+
assert.equal(isPropertyKey(Symbol.iterator), true);
|
| 46 |
+
assert.equal(isPropertyKey(1), false);
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Tests
|
| 50 |
+
Simply clone the repo, `npm install`, and run `npm test`
|
| 51 |
+
|
| 52 |
+
[package-url]: https://npmjs.org/package/es-abstract-get
|
| 53 |
+
[npm-version-svg]: https://versionbadg.es/ljharb/es-abstract-get.svg
|
| 54 |
+
[npm-badge-png]: https://nodei.co/npm/es-abstract-get.png?downloads=true&stars=true
|
| 55 |
+
[license-image]: https://img.shields.io/npm/l/es-abstract-get.svg
|
| 56 |
+
[license-url]: LICENSE
|
| 57 |
+
[downloads-image]: https://img.shields.io/npm/dm/es-abstract-get.svg
|
| 58 |
+
[downloads-url]: https://npm-stat.com/charts.html?package=es-abstract-get
|
| 59 |
+
[codecov-image]: https://codecov.io/gh/ljharb/es-abstract-get/branch/main/graphs/badge.svg
|
| 60 |
+
[codecov-url]: https://app.codecov.io/gh/ljharb/es-abstract-get/
|
| 61 |
+
[actions-image]: https://img.shields.io/github/check-runs/ljharb/es-abstract-get/main
|
| 62 |
+
[actions-url]: https://github.com/ljharb/es-abstract-get/actions
|
| 63 |
+
[es-abstract]: https://npmjs.org/package/es-abstract
|
| 64 |
+
[Get]: https://tc39.es/ecma262/#sec-get-o-p
|
| 65 |
+
[GetV]: https://tc39.es/ecma262/#sec-getv
|
| 66 |
+
[GetMethod]: https://tc39.es/ecma262/#sec-getmethod
|
| 67 |
+
[isPropertyKey]: https://tc39.es/ecma262/#sec-ispropertykey
|
node_modules/es-abstract-get/eslint.config.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ljharb from '@ljharb/eslint-config/flat';
|
| 2 |
+
import ljharbTests from '@ljharb/eslint-config/flat/tests';
|
| 3 |
+
|
| 4 |
+
export default [
|
| 5 |
+
{
|
| 6 |
+
ignores: [
|
| 7 |
+
'coverage',
|
| 8 |
+
'.nyc_output',
|
| 9 |
+
],
|
| 10 |
+
},
|
| 11 |
+
...ljharb,
|
| 12 |
+
{
|
| 13 |
+
rules: {
|
| 14 |
+
eqeqeq: ['error', 'allow-null'],
|
| 15 |
+
'func-style': ['error', 'declaration'],
|
| 16 |
+
'id-length': [
|
| 17 |
+
'error', {
|
| 18 |
+
max: 24,
|
| 19 |
+
min: 1,
|
| 20 |
+
properties: 'never',
|
| 21 |
+
},
|
| 22 |
+
],
|
| 23 |
+
'multiline-comment-style': 'off',
|
| 24 |
+
'new-cap': [
|
| 25 |
+
'error', {
|
| 26 |
+
capIsNewExceptions: [
|
| 27 |
+
'Get',
|
| 28 |
+
'GetMethod',
|
| 29 |
+
'GetV',
|
| 30 |
+
'ToObject',
|
| 31 |
+
],
|
| 32 |
+
},
|
| 33 |
+
],
|
| 34 |
+
'no-extra-parens': 'off',
|
| 35 |
+
'no-magic-numbers': 'off',
|
| 36 |
+
},
|
| 37 |
+
},
|
| 38 |
+
...ljharbTests.map((c) => ({
|
| 39 |
+
...c,
|
| 40 |
+
files: ['test/**'],
|
| 41 |
+
})),
|
| 42 |
+
];
|
node_modules/es-abstract-get/isPropertyKey.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare function isPropertyKey(
|
| 2 |
+
argument: unknown,
|
| 3 |
+
): argument is isPropertyKey.PropertyKey;
|
| 4 |
+
|
| 5 |
+
declare namespace isPropertyKey {
|
| 6 |
+
export type PropertyKey = string | symbol;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export = isPropertyKey;
|
node_modules/es-abstract-get/isPropertyKey.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
/** @type {import('./isPropertyKey')} */
|
| 4 |
+
module.exports = function isPropertyKey(argument) {
|
| 5 |
+
return typeof argument === 'string' || typeof argument === 'symbol';
|
| 6 |
+
};
|
node_modules/es-abstract-get/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "es-abstract-get",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "ECMAScript Abstract Operations for \"getting properties\" (Get, GetV, GetMethod)",
|
| 5 |
+
"main": false,
|
| 6 |
+
"exports": {
|
| 7 |
+
"./Get": "./Get.js",
|
| 8 |
+
"./GetV": "./GetV.js",
|
| 9 |
+
"./GetMethod": "./GetMethod.js",
|
| 10 |
+
"./isPropertyKey": "./isPropertyKey.js",
|
| 11 |
+
"./package.json": "./package.json"
|
| 12 |
+
},
|
| 13 |
+
"sideEffects": false,
|
| 14 |
+
"scripts": {
|
| 15 |
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
| 16 |
+
"prepublishOnly": "safe-publish-latest",
|
| 17 |
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
| 18 |
+
"pretest": "npm run lint",
|
| 19 |
+
"test": "npm run tests-only",
|
| 20 |
+
"posttest": "npx npm@\">=10.2\" audit --production",
|
| 21 |
+
"tests-only": "nyc tape 'test/**/*.js'",
|
| 22 |
+
"lint": "eslint .",
|
| 23 |
+
"postlint": "tsc && attw -P",
|
| 24 |
+
"version": "auto-changelog && git add CHANGELOG.md",
|
| 25 |
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
| 26 |
+
},
|
| 27 |
+
"repository": {
|
| 28 |
+
"type": "git",
|
| 29 |
+
"url": "git+https://github.com/ljharb/es-abstract-get.git"
|
| 30 |
+
},
|
| 31 |
+
"keywords": [
|
| 32 |
+
"ECMAScript",
|
| 33 |
+
"ES",
|
| 34 |
+
"AO",
|
| 35 |
+
"abstract operation",
|
| 36 |
+
"GetMethod",
|
| 37 |
+
"GetV",
|
| 38 |
+
"Get",
|
| 39 |
+
"isPropertyKey",
|
| 40 |
+
"property",
|
| 41 |
+
"properties"
|
| 42 |
+
],
|
| 43 |
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
| 44 |
+
"funding": {
|
| 45 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 46 |
+
},
|
| 47 |
+
"license": "MIT",
|
| 48 |
+
"dependencies": {
|
| 49 |
+
"es-errors": "^1.3.0",
|
| 50 |
+
"es-object-atoms": "^1.1.2",
|
| 51 |
+
"is-callable": "^1.2.7",
|
| 52 |
+
"object-inspect": "^1.13.4"
|
| 53 |
+
},
|
| 54 |
+
"devDependencies": {
|
| 55 |
+
"@arethetypeswrong/cli": "^0.18.3",
|
| 56 |
+
"@ljharb/eslint-config": "^22.2.3",
|
| 57 |
+
"@ljharb/tsconfig": "^0.3.2",
|
| 58 |
+
"@types/for-each": "^0.3.3",
|
| 59 |
+
"@types/is-callable": "^1.1.2",
|
| 60 |
+
"@types/object-inspect": "^1.13.0",
|
| 61 |
+
"@types/tape": "^5.8.1",
|
| 62 |
+
"auto-changelog": "^2.6.0",
|
| 63 |
+
"es-define-property": "^1.0.1",
|
| 64 |
+
"es-value-fixtures": "^1.7.1",
|
| 65 |
+
"eslint": "^10.5.0",
|
| 66 |
+
"for-each": "^0.3.5",
|
| 67 |
+
"jiti": "^0.0.0",
|
| 68 |
+
"mock-property": "^1.1.0",
|
| 69 |
+
"npmignore": "^0.3.5",
|
| 70 |
+
"nyc": "^10.3.2",
|
| 71 |
+
"safe-publish-latest": "^2.0.0",
|
| 72 |
+
"tape": "^5.10.1",
|
| 73 |
+
"typescript": "next"
|
| 74 |
+
},
|
| 75 |
+
"engines": {
|
| 76 |
+
"node": ">= 0.4"
|
| 77 |
+
},
|
| 78 |
+
"auto-changelog": {
|
| 79 |
+
"output": "CHANGELOG.md",
|
| 80 |
+
"template": "keepachangelog",
|
| 81 |
+
"unreleased": false,
|
| 82 |
+
"commitLimit": false,
|
| 83 |
+
"backfillLimit": false,
|
| 84 |
+
"hideCredit": true
|
| 85 |
+
},
|
| 86 |
+
"publishConfig": {
|
| 87 |
+
"ignore": [
|
| 88 |
+
".github/workflows"
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
"bugs": {
|
| 92 |
+
"url": "https://github.com/ljharb/es-abstract-get/issues"
|
| 93 |
+
},
|
| 94 |
+
"homepage": "https://github.com/ljharb/es-abstract-get#readme"
|
| 95 |
+
}
|
node_modules/es-abstract-get/test/Get.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var test = require('tape');
|
| 4 |
+
var v = require('es-value-fixtures');
|
| 5 |
+
|
| 6 |
+
var Get = require('../Get');
|
| 7 |
+
|
| 8 |
+
test('Get', function (t) {
|
| 9 |
+
t['throws'](
|
| 10 |
+
// @ts-expect-error
|
| 11 |
+
function () { return Get('a', 'a'); },
|
| 12 |
+
TypeError,
|
| 13 |
+
'Throws a TypeError if `O` is not an Object'
|
| 14 |
+
);
|
| 15 |
+
t['throws'](
|
| 16 |
+
// @ts-expect-error
|
| 17 |
+
function () { return Get({ 7: 7 }, 7); },
|
| 18 |
+
TypeError,
|
| 19 |
+
'Throws a TypeError if `P` is not a property key'
|
| 20 |
+
);
|
| 21 |
+
|
| 22 |
+
var sentinel = {};
|
| 23 |
+
|
| 24 |
+
t.test('Symbols', { skip: !v.hasSymbols }, function (st) {
|
| 25 |
+
var sym = Symbol('sym');
|
| 26 |
+
var obj = /** @type {Record<symbol, unknown>} */ ({});
|
| 27 |
+
obj[sym] = sentinel;
|
| 28 |
+
|
| 29 |
+
st.equal(Get(obj, sym), sentinel, 'returns property `P` if it exists on object `O`');
|
| 30 |
+
|
| 31 |
+
st.end();
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
t.equal(Get({ a: sentinel }, 'a'), sentinel, 'returns property `P` if it exists on object `O`');
|
| 35 |
+
t.equal(
|
| 36 |
+
// @ts-expect-error
|
| 37 |
+
Get({}, 'a'),
|
| 38 |
+
undefined,
|
| 39 |
+
'returns undefined if property `P` does not exist on object `O`'
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
t.end();
|
| 43 |
+
});
|
node_modules/es-abstract-get/test/GetMethod.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var test = require('tape');
|
| 4 |
+
var forEach = require('for-each');
|
| 5 |
+
var v = require('es-value-fixtures');
|
| 6 |
+
var debug = require('object-inspect');
|
| 7 |
+
|
| 8 |
+
var GetMethod = require('../GetMethod');
|
| 9 |
+
|
| 10 |
+
test('GetMethod', function (t) {
|
| 11 |
+
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
|
| 12 |
+
t['throws'](
|
| 13 |
+
// @ts-expect-error
|
| 14 |
+
function () { return GetMethod({}, nonPropertyKey); },
|
| 15 |
+
TypeError,
|
| 16 |
+
debug(nonPropertyKey) + ' is not a Property Key'
|
| 17 |
+
);
|
| 18 |
+
});
|
| 19 |
+
|
| 20 |
+
t['throws'](
|
| 21 |
+
// @ts-expect-error
|
| 22 |
+
function () { return GetMethod({ 7: 7 }, 7); },
|
| 23 |
+
TypeError,
|
| 24 |
+
'Throws a TypeError if `P` is not a property key'
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
t.equal(GetMethod({}, 'a'), undefined, 'returns undefined if property is undefined');
|
| 28 |
+
t.equal(GetMethod({ a: null }, 'a'), undefined, 'returns undefined if property is null');
|
| 29 |
+
t.equal(GetMethod({ a: undefined }, 'a'), undefined, 'returns undefined if property is undefined');
|
| 30 |
+
|
| 31 |
+
var obj = { a: function () {} };
|
| 32 |
+
t['throws'](
|
| 33 |
+
// @ts-expect-error
|
| 34 |
+
function () { GetMethod({ a: 'b' }, 'a'); },
|
| 35 |
+
TypeError,
|
| 36 |
+
'throws a TypeError if property exists and is not callable'
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
t.equal(GetMethod(obj, 'a'), obj.a, 'returns property if it is callable');
|
| 40 |
+
|
| 41 |
+
t.end();
|
| 42 |
+
});
|
node_modules/es-abstract-get/test/GetV.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var test = require('tape');
|
| 4 |
+
var $defineProperty = require('es-define-property');
|
| 5 |
+
var mockProperty = require('mock-property');
|
| 6 |
+
|
| 7 |
+
var GetV = require('../GetV');
|
| 8 |
+
|
| 9 |
+
test('GetV', function (t) {
|
| 10 |
+
t['throws'](
|
| 11 |
+
function () { return GetV({ 7: 7 }, 7); },
|
| 12 |
+
TypeError,
|
| 13 |
+
'Throws a TypeError if `P` is not a property key'
|
| 14 |
+
);
|
| 15 |
+
|
| 16 |
+
var obj = { a: function () {} };
|
| 17 |
+
t.equal(GetV(obj, 'a'), obj.a, 'returns property if it exists');
|
| 18 |
+
t.equal(GetV(obj, 'b'), undefined, 'returns undefined if property does not exist');
|
| 19 |
+
|
| 20 |
+
t.test(
|
| 21 |
+
'getter observability of the receiver',
|
| 22 |
+
{ skip: !$defineProperty || !Object.isExtensible(Number.prototype) },
|
| 23 |
+
function (st) {
|
| 24 |
+
/** @type {unknown[]} */
|
| 25 |
+
var receivers = [];
|
| 26 |
+
|
| 27 |
+
st.teardown(mockProperty(/** @type {Record<PropertyKey, unknown>} */ (/** @type {unknown} */ (Number.prototype)), 'foo', {
|
| 28 |
+
get: /** @this {number | Number} */ function () {
|
| 29 |
+
receivers.push(this);
|
| 30 |
+
}
|
| 31 |
+
}));
|
| 32 |
+
|
| 33 |
+
GetV(42, 'foo');
|
| 34 |
+
GetV(Object(42), 'foo');
|
| 35 |
+
|
| 36 |
+
st.deepEqual(receivers, [42, Object(42)]);
|
| 37 |
+
|
| 38 |
+
st.end();
|
| 39 |
+
}
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
t.end();
|
| 43 |
+
});
|
node_modules/es-abstract-get/test/isPropertyKey.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var test = require('tape');
|
| 4 |
+
var forEach = require('for-each');
|
| 5 |
+
var v = require('es-value-fixtures');
|
| 6 |
+
var debug = require('object-inspect');
|
| 7 |
+
|
| 8 |
+
var isPropertyKey = require('../isPropertyKey');
|
| 9 |
+
|
| 10 |
+
/** @import { PropertyKey } from '../isPropertyKey' */
|
| 11 |
+
|
| 12 |
+
test('isPropertyKey', function (t) {
|
| 13 |
+
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
|
| 14 |
+
t.equal(isPropertyKey(nonPropertyKey), false, debug(nonPropertyKey) + ' is not a Property Key');
|
| 15 |
+
});
|
| 16 |
+
|
| 17 |
+
var propertyKeys = /** @type {PropertyKey[]} */ ([]).concat(
|
| 18 |
+
v.strings,
|
| 19 |
+
v.hasSymbols ? v.symbols : []
|
| 20 |
+
);
|
| 21 |
+
forEach(propertyKeys, function (propertyKey) {
|
| 22 |
+
t.equal(isPropertyKey(propertyKey), true, debug(propertyKey) + ' is a Property Key');
|
| 23 |
+
});
|
| 24 |
+
|
| 25 |
+
t.end();
|
| 26 |
+
});
|
node_modules/es-abstract-get/tsconfig.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extends": "@ljharb/tsconfig",
|
| 3 |
+
"exclude": [
|
| 4 |
+
"coverage",
|
| 5 |
+
],
|
| 6 |
+
}
|
node_modules/es-abstract/2023/thisTimeValue.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var timeValue = require('../helpers/timeValue');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/6.0/#sec-properties-of-the-date-prototype-object
|
| 6 |
+
|
| 7 |
+
module.exports = function thisTimeValue(value) {
|
| 8 |
+
return timeValue(value);
|
| 9 |
+
};
|
node_modules/es-abstract/2023/truncate.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var floor = require('./floor');
|
| 4 |
+
|
| 5 |
+
var $TypeError = require('es-errors/type');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/14.0/#eqn-truncate
|
| 8 |
+
|
| 9 |
+
module.exports = function truncate(x) {
|
| 10 |
+
if (typeof x !== 'number' && typeof x !== 'bigint') {
|
| 11 |
+
throw new $TypeError('argument must be a Number or a BigInt');
|
| 12 |
+
}
|
| 13 |
+
var result = x < 0 ? -floor(-x) : floor(x);
|
| 14 |
+
return result === 0 ? 0 : result; // in the spec, these are math values, so we filter out -0 here
|
| 15 |
+
};
|
node_modules/es-abstract/2024/AddEntriesFromIterable.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
var isObject = require('es-object-atoms/isObject');
|
| 5 |
+
var inspect = require('object-inspect');
|
| 6 |
+
|
| 7 |
+
var Call = require('./Call');
|
| 8 |
+
var Get = require('./Get');
|
| 9 |
+
var GetIterator = require('./GetIterator');
|
| 10 |
+
var IsCallable = require('./IsCallable');
|
| 11 |
+
var IteratorClose = require('./IteratorClose');
|
| 12 |
+
var IteratorStep = require('./IteratorStep');
|
| 13 |
+
var IteratorValue = require('./IteratorValue');
|
| 14 |
+
var ThrowCompletion = require('./ThrowCompletion');
|
| 15 |
+
|
| 16 |
+
// https://262.ecma-international.org/15.0/#sec-add-entries-from-iterable
|
| 17 |
+
|
| 18 |
+
module.exports = function AddEntriesFromIterable(target, iterable, adder) {
|
| 19 |
+
if (!IsCallable(adder)) {
|
| 20 |
+
throw new $TypeError('Assertion failed: `adder` is not callable');
|
| 21 |
+
}
|
| 22 |
+
if (iterable == null) {
|
| 23 |
+
throw new $TypeError('Assertion failed: `iterable` is present, and not nullish');
|
| 24 |
+
}
|
| 25 |
+
var iteratorRecord = GetIterator(iterable, 'SYNC');
|
| 26 |
+
while (true) {
|
| 27 |
+
var next = IteratorStep(iteratorRecord);
|
| 28 |
+
if (!next) {
|
| 29 |
+
return target;
|
| 30 |
+
}
|
| 31 |
+
var nextItem = IteratorValue(next);
|
| 32 |
+
if (!isObject(nextItem)) {
|
| 33 |
+
var error = ThrowCompletion(new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)));
|
| 34 |
+
return IteratorClose(iteratorRecord, error);
|
| 35 |
+
}
|
| 36 |
+
try {
|
| 37 |
+
var k = Get(nextItem, '0');
|
| 38 |
+
var v = Get(nextItem, '1');
|
| 39 |
+
Call(adder, target, [k, v]);
|
| 40 |
+
} catch (e) {
|
| 41 |
+
return IteratorClose(iteratorRecord, ThrowCompletion(e));
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
};
|
node_modules/es-abstract/2024/AddToKeptObjects.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var SLOT = require('internal-slot');
|
| 4 |
+
|
| 5 |
+
var $TypeError = require('es-errors/type');
|
| 6 |
+
var isObject = require('es-object-atoms/isObject');
|
| 7 |
+
|
| 8 |
+
var ClearKeptObjects = require('./ClearKeptObjects');
|
| 9 |
+
|
| 10 |
+
// https://262.ecma-international.org/12.0/#sec-addtokeptobjects
|
| 11 |
+
|
| 12 |
+
module.exports = function AddToKeptObjects(object) {
|
| 13 |
+
if (!isObject(object)) {
|
| 14 |
+
throw new $TypeError('Assertion failed: `object` must be an Object');
|
| 15 |
+
}
|
| 16 |
+
var arr = SLOT.get(ClearKeptObjects, '[[es-abstract internal: KeptAlive]]');
|
| 17 |
+
arr[arr.length] = object;
|
| 18 |
+
};
|
node_modules/es-abstract/2024/AddValueToKeyedGroup.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var SameValue = require('./SameValue');
|
| 6 |
+
|
| 7 |
+
var IsArray = require('../helpers/IsArray');
|
| 8 |
+
var every = require('../helpers/every');
|
| 9 |
+
var forEach = require('../helpers/forEach');
|
| 10 |
+
|
| 11 |
+
var hasOwn = require('hasown');
|
| 12 |
+
|
| 13 |
+
var isKeyedGroup = function (group) {
|
| 14 |
+
return hasOwn(group, '[[Key]]')
|
| 15 |
+
&& hasOwn(group, '[[Elements]]')
|
| 16 |
+
&& IsArray(group['[[Elements]]']);
|
| 17 |
+
};
|
| 18 |
+
|
| 19 |
+
// https://262.ecma-international.org/15.0/#sec-add-value-to-keyed-group
|
| 20 |
+
|
| 21 |
+
module.exports = function AddValueToKeyedGroup(groups, key, value) {
|
| 22 |
+
if (!IsArray(groups) || (groups.length > 0 && !every(groups, isKeyedGroup))) {
|
| 23 |
+
throw new $TypeError('Assertion failed: `groups` must be a List of Records with [[Key]] and [[Elements]]');
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
var matched = 0;
|
| 27 |
+
forEach(groups, function (g) { // step 1
|
| 28 |
+
if (SameValue(g['[[Key]]'], key)) { // step 2
|
| 29 |
+
matched += 1;
|
| 30 |
+
if (matched > 1) {
|
| 31 |
+
throw new $TypeError('Assertion failed: Exactly one element of groups meets this criterion'); // step 2.a
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
var arr = g['[[Elements]]'];
|
| 35 |
+
arr[arr.length] = value; // step 2.b
|
| 36 |
+
}
|
| 37 |
+
});
|
| 38 |
+
|
| 39 |
+
if (matched === 0) {
|
| 40 |
+
var group = { '[[Key]]': key, '[[Elements]]': [value] }; // step 2
|
| 41 |
+
|
| 42 |
+
// eslint-disable-next-line no-param-reassign
|
| 43 |
+
groups[groups.length] = group; // step 3
|
| 44 |
+
}
|
| 45 |
+
};
|
node_modules/es-abstract/2024/AdvanceStringIndex.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var CodePointAt = require('./CodePointAt');
|
| 4 |
+
|
| 5 |
+
var $TypeError = require('es-errors/type');
|
| 6 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 7 |
+
var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/12.0/#sec-advancestringindex
|
| 10 |
+
|
| 11 |
+
module.exports = function AdvanceStringIndex(S, index, unicode) {
|
| 12 |
+
if (typeof S !== 'string') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `S` must be a String');
|
| 14 |
+
}
|
| 15 |
+
if (!isInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
|
| 16 |
+
throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53');
|
| 17 |
+
}
|
| 18 |
+
if (typeof unicode !== 'boolean') {
|
| 19 |
+
throw new $TypeError('Assertion failed: `unicode` must be a Boolean');
|
| 20 |
+
}
|
| 21 |
+
if (!unicode) {
|
| 22 |
+
return index + 1;
|
| 23 |
+
}
|
| 24 |
+
var length = S.length;
|
| 25 |
+
if ((index + 1) >= length) {
|
| 26 |
+
return index + 1;
|
| 27 |
+
}
|
| 28 |
+
var cp = CodePointAt(S, index);
|
| 29 |
+
return index + cp['[[CodeUnitCount]]'];
|
| 30 |
+
};
|
node_modules/es-abstract/2024/AllCharacters.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var HasEitherUnicodeFlag = require('./HasEitherUnicodeFlag');
|
| 6 |
+
|
| 7 |
+
var isRegExpRecord = require('../helpers/records/regexp-record');
|
| 8 |
+
|
| 9 |
+
var CharSet = require('../helpers/CharSet');
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/15.0/#sec-allcharacters
|
| 12 |
+
|
| 13 |
+
module.exports = function AllCharacters(rer) {
|
| 14 |
+
if (!isRegExpRecord(rer)) {
|
| 15 |
+
throw new $TypeError('Assertion failed: `rer` must be a RegExp Record');
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
if (rer['[[UnicodeSets]]'] && rer['[[IgnoreCase]]']) { // step 1
|
| 19 |
+
// 1. Return the CharSet containing all Unicode code points _c_ that do not have a <a href="https://www.unicode.org/reports/tr44/#Simple_Case_Folding">Simple Case Folding</a> mapping (that is, scf(_c_)=_c_).
|
| 20 |
+
return CharSet.getNonSimpleCaseFoldingCodePoints(); // step 1.a
|
| 21 |
+
} else if (HasEitherUnicodeFlag(rer)) { // step 2
|
| 22 |
+
// 1. Return the CharSet containing all code point values.
|
| 23 |
+
return CharSet.getCodePoints(); // step 3.a
|
| 24 |
+
// eslint-disable-next-line no-else-return
|
| 25 |
+
} else { // step 3
|
| 26 |
+
// 1. Return the CharSet containing all code unit values.
|
| 27 |
+
return CharSet.getCodeUnits(); // step 3.a
|
| 28 |
+
}
|
| 29 |
+
};
|
node_modules/es-abstract/2024/ApplyStringOrNumericBinaryOperator.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var HasOwnProperty = require('./HasOwnProperty');
|
| 6 |
+
var ToNumeric = require('./ToNumeric');
|
| 7 |
+
var ToPrimitive = require('./ToPrimitive');
|
| 8 |
+
var ToString = require('./ToString');
|
| 9 |
+
var Type = require('./Type');
|
| 10 |
+
|
| 11 |
+
var NumberAdd = require('./Number/add');
|
| 12 |
+
var NumberBitwiseAND = require('./Number/bitwiseAND');
|
| 13 |
+
var NumberBitwiseOR = require('./Number/bitwiseOR');
|
| 14 |
+
var NumberBitwiseXOR = require('./Number/bitwiseXOR');
|
| 15 |
+
var NumberDivide = require('./Number/divide');
|
| 16 |
+
var NumberExponentiate = require('./Number/exponentiate');
|
| 17 |
+
var NumberLeftShift = require('./Number/leftShift');
|
| 18 |
+
var NumberMultiply = require('./Number/multiply');
|
| 19 |
+
var NumberRemainder = require('./Number/remainder');
|
| 20 |
+
var NumberSignedRightShift = require('./Number/signedRightShift');
|
| 21 |
+
var NumberSubtract = require('./Number/subtract');
|
| 22 |
+
var NumberUnsignedRightShift = require('./Number/unsignedRightShift');
|
| 23 |
+
var BigIntAdd = require('./BigInt/add');
|
| 24 |
+
var BigIntBitwiseAND = require('./BigInt/bitwiseAND');
|
| 25 |
+
var BigIntBitwiseOR = require('./BigInt/bitwiseOR');
|
| 26 |
+
var BigIntBitwiseXOR = require('./BigInt/bitwiseXOR');
|
| 27 |
+
var BigIntDivide = require('./BigInt/divide');
|
| 28 |
+
var BigIntExponentiate = require('./BigInt/exponentiate');
|
| 29 |
+
var BigIntLeftShift = require('./BigInt/leftShift');
|
| 30 |
+
var BigIntMultiply = require('./BigInt/multiply');
|
| 31 |
+
var BigIntRemainder = require('./BigInt/remainder');
|
| 32 |
+
var BigIntSignedRightShift = require('./BigInt/signedRightShift');
|
| 33 |
+
var BigIntSubtract = require('./BigInt/subtract');
|
| 34 |
+
var BigIntUnsignedRightShift = require('./BigInt/unsignedRightShift');
|
| 35 |
+
|
| 36 |
+
// https://262.ecma-international.org/12.0/#sec-applystringornumericbinaryoperator
|
| 37 |
+
|
| 38 |
+
// https://262.ecma-international.org/12.0/#step-applystringornumericbinaryoperator-operations-table
|
| 39 |
+
var table = {
|
| 40 |
+
'**': [NumberExponentiate, BigIntExponentiate],
|
| 41 |
+
'*': [NumberMultiply, BigIntMultiply],
|
| 42 |
+
'/': [NumberDivide, BigIntDivide],
|
| 43 |
+
'%': [NumberRemainder, BigIntRemainder],
|
| 44 |
+
'+': [NumberAdd, BigIntAdd],
|
| 45 |
+
'-': [NumberSubtract, BigIntSubtract],
|
| 46 |
+
'<<': [NumberLeftShift, BigIntLeftShift],
|
| 47 |
+
'>>': [NumberSignedRightShift, BigIntSignedRightShift],
|
| 48 |
+
'>>>': [NumberUnsignedRightShift, BigIntUnsignedRightShift],
|
| 49 |
+
'&': [NumberBitwiseAND, BigIntBitwiseAND],
|
| 50 |
+
'^': [NumberBitwiseXOR, BigIntBitwiseXOR],
|
| 51 |
+
'|': [NumberBitwiseOR, BigIntBitwiseOR]
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
module.exports = function ApplyStringOrNumericBinaryOperator(lval, opText, rval) {
|
| 55 |
+
if (typeof opText !== 'string' || !HasOwnProperty(table, opText)) {
|
| 56 |
+
throw new $TypeError('Assertion failed: `opText` must be a valid operation string');
|
| 57 |
+
}
|
| 58 |
+
if (opText === '+') {
|
| 59 |
+
var lprim = ToPrimitive(lval);
|
| 60 |
+
var rprim = ToPrimitive(rval);
|
| 61 |
+
if (typeof lprim === 'string' || typeof rprim === 'string') {
|
| 62 |
+
var lstr = ToString(lprim);
|
| 63 |
+
var rstr = ToString(rprim);
|
| 64 |
+
return lstr + rstr;
|
| 65 |
+
}
|
| 66 |
+
/* eslint no-param-reassign: 1 */
|
| 67 |
+
lval = lprim;
|
| 68 |
+
rval = rprim;
|
| 69 |
+
}
|
| 70 |
+
var lnum = ToNumeric(lval);
|
| 71 |
+
var rnum = ToNumeric(rval);
|
| 72 |
+
if (Type(lnum) !== Type(rnum)) {
|
| 73 |
+
throw new $TypeError('types of ' + lnum + ' and ' + rnum + ' differ');
|
| 74 |
+
}
|
| 75 |
+
var Operation = table[opText][typeof lnum === 'bigint' ? 1 : 0];
|
| 76 |
+
return Operation(lnum, rnum);
|
| 77 |
+
};
|
node_modules/es-abstract/2024/ArrayBufferByteLength.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/15.0/#sec-arraybufferbytelength
|
| 6 |
+
|
| 7 |
+
var IsDetachedBuffer = require('./IsDetachedBuffer');
|
| 8 |
+
|
| 9 |
+
var isArrayBuffer = require('is-array-buffer');
|
| 10 |
+
var isSharedArrayBuffer = require('is-shared-array-buffer');
|
| 11 |
+
var arrayBufferByteLength = require('array-buffer-byte-length');
|
| 12 |
+
|
| 13 |
+
var callBound = require('call-bound');
|
| 14 |
+
var $sabByteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);
|
| 15 |
+
|
| 16 |
+
var isGrowable = false; // TODO: support this
|
| 17 |
+
|
| 18 |
+
module.exports = function ArrayBufferByteLength(arrayBuffer, order) {
|
| 19 |
+
var isSAB = isSharedArrayBuffer(arrayBuffer);
|
| 20 |
+
if (!isArrayBuffer(arrayBuffer) && !isSAB) {
|
| 21 |
+
throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer');
|
| 22 |
+
}
|
| 23 |
+
if (order !== 'SEQ-CST' && order !== 'UNORDERED') {
|
| 24 |
+
throw new $TypeError('Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// 1. If IsSharedArrayBuffer(arrayBuffer) is true and arrayBuffer has an [[ArrayBufferByteLengthData]] internal slot, then
|
| 28 |
+
// TODO: see if IsFixedLengthArrayBuffer can be used here in the spec instead
|
| 29 |
+
if (isSAB && isGrowable) { // step 1
|
| 30 |
+
// a. Let bufferByteLengthBlock be arrayBuffer.[[ArrayBufferByteLengthData]].
|
| 31 |
+
// b. Let rawLength be GetRawBytesFromSharedBlock(bufferByteLengthBlock, 0, BIGUINT64, true, order).
|
| 32 |
+
// c. Let isLittleEndian be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record.
|
| 33 |
+
// d. Return ℝ(RawBytesToNumeric(BIGUINT64, rawLength, isLittleEndian)).
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (IsDetachedBuffer(arrayBuffer)) {
|
| 37 |
+
throw new $TypeError('Assertion failed: `arrayBuffer` must not be detached'); // step 2
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return isSAB ? $sabByteLength(arrayBuffer) : arrayBufferByteLength(arrayBuffer);
|
| 41 |
+
};
|
node_modules/es-abstract/2024/ArrayBufferCopyAndDetach.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var min = require('math-intrinsics/min');
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);
|
| 8 |
+
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
| 9 |
+
|
| 10 |
+
var callBound = require('call-bound');
|
| 11 |
+
|
| 12 |
+
var byteLength = require('array-buffer-byte-length');
|
| 13 |
+
var $maxByteLength = callBound('%ArrayBuffer.prototype.maxByteLength%', true);
|
| 14 |
+
var copy = function copyAB(src, start, end) {
|
| 15 |
+
var that = new $Uint8Array(src);
|
| 16 |
+
if (typeof end === 'undefined') {
|
| 17 |
+
end = that.length; // eslint-disable-line no-param-reassign
|
| 18 |
+
}
|
| 19 |
+
var result = new $ArrayBuffer(end - start);
|
| 20 |
+
var resultArray = new $Uint8Array(result);
|
| 21 |
+
for (var i = 0; i < resultArray.length; i++) {
|
| 22 |
+
resultArray[i] = that[i + start];
|
| 23 |
+
}
|
| 24 |
+
return result;
|
| 25 |
+
};
|
| 26 |
+
var $abSlice = callBound('%ArrayBuffer.prototype.slice%', true)
|
| 27 |
+
|| function slice(ab, a, b) { // in node < 0.11, slice is an own nonconfigurable property
|
| 28 |
+
return ab.slice ? ab.slice(a, b) : copy(ab, a, b); // node 0.8 lacks `slice`
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
var DetachArrayBuffer = require('./DetachArrayBuffer');
|
| 32 |
+
var IsDetachedBuffer = require('./IsDetachedBuffer');
|
| 33 |
+
var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');
|
| 34 |
+
var ToIndex = require('./ToIndex');
|
| 35 |
+
|
| 36 |
+
var isArrayBuffer = require('is-array-buffer');
|
| 37 |
+
var isSharedArrayBuffer = require('is-shared-array-buffer');
|
| 38 |
+
|
| 39 |
+
// https://262.ecma-international.org/15.0/#sec-arraybuffercopyanddetach
|
| 40 |
+
|
| 41 |
+
module.exports = function ArrayBufferCopyAndDetach(arrayBuffer, newLength, preserveResizability) {
|
| 42 |
+
if (preserveResizability !== 'PRESERVE-RESIZABILITY' && preserveResizability !== 'FIXED-LENGTH') {
|
| 43 |
+
throw new $TypeError('`preserveResizability` must be ~PRESERVE-RESIZABILITY~ or ~FIXED-LENGTH~');
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if (!isArrayBuffer(arrayBuffer) || isSharedArrayBuffer(arrayBuffer)) {
|
| 47 |
+
throw new $TypeError('`arrayBuffer` must be a non-shared ArrayBuffer'); // steps 1 - 2
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
var abByteLength;
|
| 51 |
+
|
| 52 |
+
var newByteLength;
|
| 53 |
+
if (typeof newLength === 'undefined') { // step 3
|
| 54 |
+
newByteLength = byteLength(arrayBuffer); // step 3.a
|
| 55 |
+
abByteLength = newByteLength;
|
| 56 |
+
} else { // step 4
|
| 57 |
+
newByteLength = ToIndex(newLength); // step 4.a
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
if (IsDetachedBuffer(arrayBuffer)) {
|
| 61 |
+
throw new $TypeError('`arrayBuffer` must not be detached'); // step 5
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
var newMaxByteLength;
|
| 65 |
+
if (preserveResizability === 'PRESERVE-RESIZABILITY' && !IsFixedLengthArrayBuffer(arrayBuffer)) { // step 6
|
| 66 |
+
newMaxByteLength = $maxByteLength(arrayBuffer); // step 6.a
|
| 67 |
+
} else { // step 7
|
| 68 |
+
newMaxByteLength = 'EMPTY'; // step 7.a
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// commented out since there's no way to set or access this key
|
| 72 |
+
|
| 73 |
+
// 8. If arrayBuffer.[[ArrayBufferDetachKey]] is not undefined, throw a TypeError exception.
|
| 74 |
+
|
| 75 |
+
// 9. Let newBuffer be ? AllocateArrayBuffer(%ArrayBuffer%, newByteLength, newMaxByteLength).
|
| 76 |
+
var newBuffer = newMaxByteLength === 'EMPTY' ? new $ArrayBuffer(newByteLength) : new $ArrayBuffer(newByteLength, { maxByteLength: newMaxByteLength });
|
| 77 |
+
|
| 78 |
+
if (typeof abByteLength !== 'number') {
|
| 79 |
+
abByteLength = byteLength(arrayBuffer);
|
| 80 |
+
}
|
| 81 |
+
var copyLength = min(newByteLength, abByteLength); // step 10
|
| 82 |
+
if (newByteLength > copyLength || newMaxByteLength !== 'EMPTY') {
|
| 83 |
+
var taNew = new $Uint8Array(newBuffer);
|
| 84 |
+
var taOld = new $Uint8Array(arrayBuffer);
|
| 85 |
+
for (var i = 0; i < copyLength; i++) {
|
| 86 |
+
taNew[i] = taOld[i];
|
| 87 |
+
}
|
| 88 |
+
} else {
|
| 89 |
+
newBuffer = $abSlice(arrayBuffer, 0, copyLength); // ? optimization for when the new buffer will not be larger than the old one
|
| 90 |
+
}
|
| 91 |
+
/*
|
| 92 |
+
11. Let fromBlock be arrayBuffer.[[ArrayBufferData]].
|
| 93 |
+
12. Let toBlock be newBuffer.[[ArrayBufferData]].
|
| 94 |
+
13. Perform CopyDataBlockBytes(toBlock, 0, fromBlock, 0, copyLength).
|
| 95 |
+
14. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a realloc.
|
| 96 |
+
*/
|
| 97 |
+
|
| 98 |
+
DetachArrayBuffer(arrayBuffer); // step 15
|
| 99 |
+
|
| 100 |
+
return newBuffer; // step 16
|
| 101 |
+
};
|
node_modules/es-abstract/2024/ArrayCreate.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $ArrayPrototype = GetIntrinsic('%Array.prototype%');
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 8 |
+
var $TypeError = require('es-errors/type');
|
| 9 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 10 |
+
var MAX_ARRAY_LENGTH = require('math-intrinsics/constants/maxArrayLength');
|
| 11 |
+
var $setProto = require('set-proto');
|
| 12 |
+
|
| 13 |
+
// https://262.ecma-international.org/12.0/#sec-arraycreate
|
| 14 |
+
|
| 15 |
+
module.exports = function ArrayCreate(length) {
|
| 16 |
+
if (!isInteger(length) || length < 0) {
|
| 17 |
+
throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0');
|
| 18 |
+
}
|
| 19 |
+
if (length > MAX_ARRAY_LENGTH) {
|
| 20 |
+
throw new $RangeError('length is greater than (2**32 - 1)');
|
| 21 |
+
}
|
| 22 |
+
var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype;
|
| 23 |
+
var A = []; // steps 3, 5
|
| 24 |
+
if (proto !== $ArrayPrototype) { // step 4
|
| 25 |
+
if (!$setProto) {
|
| 26 |
+
throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]');
|
| 27 |
+
}
|
| 28 |
+
$setProto(A, proto);
|
| 29 |
+
}
|
| 30 |
+
if (length !== 0) { // bypasses the need for step 6
|
| 31 |
+
A.length = length;
|
| 32 |
+
}
|
| 33 |
+
/* step 6, the above as a shortcut for the below
|
| 34 |
+
OrdinaryDefineOwnProperty(A, 'length', {
|
| 35 |
+
'[[Configurable]]': false,
|
| 36 |
+
'[[Enumerable]]': false,
|
| 37 |
+
'[[Value]]': length,
|
| 38 |
+
'[[Writable]]': true
|
| 39 |
+
});
|
| 40 |
+
*/
|
| 41 |
+
return A;
|
| 42 |
+
};
|
node_modules/es-abstract/2024/ArraySetLength.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $RangeError = require('es-errors/range');
|
| 4 |
+
var $TypeError = require('es-errors/type');
|
| 5 |
+
|
| 6 |
+
var assign = require('object.assign');
|
| 7 |
+
|
| 8 |
+
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
|
| 9 |
+
|
| 10 |
+
var IsArray = require('./IsArray');
|
| 11 |
+
var IsDataDescriptor = require('./IsDataDescriptor');
|
| 12 |
+
var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty');
|
| 13 |
+
var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty');
|
| 14 |
+
var ToNumber = require('./ToNumber');
|
| 15 |
+
var ToString = require('./ToString');
|
| 16 |
+
var ToUint32 = require('./ToUint32');
|
| 17 |
+
|
| 18 |
+
// https://262.ecma-international.org/6.0/#sec-arraysetlength
|
| 19 |
+
|
| 20 |
+
// eslint-disable-next-line max-statements, max-lines-per-function
|
| 21 |
+
module.exports = function ArraySetLength(A, Desc) {
|
| 22 |
+
if (!IsArray(A)) {
|
| 23 |
+
throw new $TypeError('Assertion failed: A must be an Array');
|
| 24 |
+
}
|
| 25 |
+
if (!isPropertyDescriptor(Desc)) {
|
| 26 |
+
throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
|
| 27 |
+
}
|
| 28 |
+
if (!('[[Value]]' in Desc)) {
|
| 29 |
+
return OrdinaryDefineOwnProperty(A, 'length', Desc);
|
| 30 |
+
}
|
| 31 |
+
var newLenDesc = assign({}, Desc);
|
| 32 |
+
var newLen = ToUint32(Desc['[[Value]]']);
|
| 33 |
+
var numberLen = ToNumber(Desc['[[Value]]']);
|
| 34 |
+
if (newLen !== numberLen) {
|
| 35 |
+
throw new $RangeError('Invalid array length');
|
| 36 |
+
}
|
| 37 |
+
newLenDesc['[[Value]]'] = newLen;
|
| 38 |
+
var oldLenDesc = OrdinaryGetOwnProperty(A, 'length');
|
| 39 |
+
if (!IsDataDescriptor(oldLenDesc)) {
|
| 40 |
+
throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`');
|
| 41 |
+
}
|
| 42 |
+
var oldLen = oldLenDesc['[[Value]]'];
|
| 43 |
+
if (newLen >= oldLen) {
|
| 44 |
+
return OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
| 45 |
+
}
|
| 46 |
+
if (!oldLenDesc['[[Writable]]']) {
|
| 47 |
+
return false;
|
| 48 |
+
}
|
| 49 |
+
var newWritable;
|
| 50 |
+
if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) {
|
| 51 |
+
newWritable = true;
|
| 52 |
+
} else {
|
| 53 |
+
newWritable = false;
|
| 54 |
+
newLenDesc['[[Writable]]'] = true;
|
| 55 |
+
}
|
| 56 |
+
var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
| 57 |
+
if (!succeeded) {
|
| 58 |
+
return false;
|
| 59 |
+
}
|
| 60 |
+
while (newLen < oldLen) {
|
| 61 |
+
oldLen -= 1;
|
| 62 |
+
// eslint-disable-next-line no-param-reassign
|
| 63 |
+
var deleteSucceeded = delete A[ToString(oldLen)];
|
| 64 |
+
if (!deleteSucceeded) {
|
| 65 |
+
newLenDesc['[[Value]]'] = oldLen + 1;
|
| 66 |
+
if (!newWritable) {
|
| 67 |
+
newLenDesc['[[Writable]]'] = false;
|
| 68 |
+
OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
| 69 |
+
return false;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
if (!newWritable) {
|
| 74 |
+
return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false });
|
| 75 |
+
}
|
| 76 |
+
return true;
|
| 77 |
+
};
|
node_modules/es-abstract/2024/ArraySpeciesCreate.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $species = GetIntrinsic('%Symbol.species%', true);
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var isInteger = require('math-intrinsics/isInteger');
|
| 8 |
+
var isObject = require('es-object-atoms/isObject');
|
| 9 |
+
|
| 10 |
+
var ArrayCreate = require('./ArrayCreate');
|
| 11 |
+
var Get = require('./Get');
|
| 12 |
+
var IsArray = require('./IsArray');
|
| 13 |
+
var IsConstructor = require('./IsConstructor');
|
| 14 |
+
|
| 15 |
+
// https://262.ecma-international.org/12.0/#sec-arrayspeciescreate
|
| 16 |
+
|
| 17 |
+
module.exports = function ArraySpeciesCreate(originalArray, length) {
|
| 18 |
+
if (!isInteger(length) || length < 0) {
|
| 19 |
+
throw new $TypeError('Assertion failed: length must be an integer >= 0');
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
var isArray = IsArray(originalArray);
|
| 23 |
+
if (!isArray) {
|
| 24 |
+
return ArrayCreate(length);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
var C = Get(originalArray, 'constructor');
|
| 28 |
+
// TODO: figure out how to make a cross-realm normal Array, a same-realm Array
|
| 29 |
+
// if (IsConstructor(C)) {
|
| 30 |
+
// if C is another realm's Array, C = undefined
|
| 31 |
+
// Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
|
| 32 |
+
// }
|
| 33 |
+
if ($species && isObject(C)) {
|
| 34 |
+
C = Get(C, $species);
|
| 35 |
+
if (C === null) {
|
| 36 |
+
C = void 0;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
if (typeof C === 'undefined') {
|
| 41 |
+
return ArrayCreate(length);
|
| 42 |
+
}
|
| 43 |
+
if (!IsConstructor(C)) {
|
| 44 |
+
throw new $TypeError('C must be a constructor');
|
| 45 |
+
}
|
| 46 |
+
return new C(length); // Construct(C, length);
|
| 47 |
+
};
|
| 48 |
+
|
node_modules/es-abstract/2024/AsyncFromSyncIteratorContinuation.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var isObject = require('es-object-atoms/isObject');
|
| 8 |
+
var $Promise = GetIntrinsic('%Promise%', true);
|
| 9 |
+
|
| 10 |
+
var callBound = require('call-bound');
|
| 11 |
+
|
| 12 |
+
var CreateIterResultObject = require('./CreateIterResultObject');
|
| 13 |
+
var IteratorComplete = require('./IteratorComplete');
|
| 14 |
+
var IteratorValue = require('./IteratorValue');
|
| 15 |
+
var PromiseResolve = require('./PromiseResolve');
|
| 16 |
+
|
| 17 |
+
var $then = callBound('Promise.prototype.then', true);
|
| 18 |
+
|
| 19 |
+
// https://262.ecma-international.org/10.0/#sec-asyncfromsynciteratorcontinuation
|
| 20 |
+
|
| 21 |
+
module.exports = function AsyncFromSyncIteratorContinuation(result) {
|
| 22 |
+
if (!isObject(result)) {
|
| 23 |
+
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if (arguments.length > 1) {
|
| 27 |
+
throw new $SyntaxError('although AsyncFromSyncIteratorContinuation should take a second argument, it is not used in this implementation');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
if (!$Promise) {
|
| 31 |
+
throw new $SyntaxError('This environment does not support Promises.');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
return new $Promise(function (resolve) {
|
| 35 |
+
var done = IteratorComplete(result); // step 2
|
| 36 |
+
var value = IteratorValue(result); // step 4
|
| 37 |
+
var valueWrapper = PromiseResolve($Promise, value); // step 6
|
| 38 |
+
|
| 39 |
+
// eslint-disable-next-line no-shadow
|
| 40 |
+
var onFulfilled = function (value) { // steps 8-9
|
| 41 |
+
return CreateIterResultObject(value, done); // step 8.a
|
| 42 |
+
};
|
| 43 |
+
resolve($then(valueWrapper, onFulfilled)); // step 11
|
| 44 |
+
}); // step 12
|
| 45 |
+
};
|
node_modules/es-abstract/2024/AsyncIteratorClose.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
var isObject = require('es-object-atoms/isObject');
|
| 8 |
+
var $Promise = GetIntrinsic('%Promise%', true);
|
| 9 |
+
|
| 10 |
+
var Call = require('./Call');
|
| 11 |
+
var CompletionRecord = require('./CompletionRecord');
|
| 12 |
+
var GetMethod = require('./GetMethod');
|
| 13 |
+
|
| 14 |
+
var isIteratorRecord = require('../helpers/records/iterator-record');
|
| 15 |
+
|
| 16 |
+
var callBound = require('call-bound');
|
| 17 |
+
|
| 18 |
+
var $then = callBound('Promise.prototype.then', true);
|
| 19 |
+
|
| 20 |
+
// https://262.ecma-international.org/15.0/#sec-asynciteratorclose
|
| 21 |
+
|
| 22 |
+
module.exports = function AsyncIteratorClose(iteratorRecord, completion) {
|
| 23 |
+
if (!isIteratorRecord(iteratorRecord)) {
|
| 24 |
+
throw new $TypeError('Assertion failed: `iteratorRecord` must be an Iterator Record'); // step 1
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
if (!(completion instanceof CompletionRecord)) {
|
| 28 |
+
throw new $TypeError('Assertion failed: completion is not a Completion Record instance'); // step 2
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (!$then) {
|
| 32 |
+
throw new $SyntaxError('This environment does not support Promises.');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
var iterator = iteratorRecord['[[Iterator]]']; // step 3
|
| 36 |
+
|
| 37 |
+
return $then(
|
| 38 |
+
$then(
|
| 39 |
+
$then(
|
| 40 |
+
new $Promise(function (resolve) {
|
| 41 |
+
resolve(GetMethod(iterator, 'return')); // step 4
|
| 42 |
+
// resolve(Call(ret, iterator, [])); // step 6
|
| 43 |
+
}),
|
| 44 |
+
function (returnV) { // step 5.a
|
| 45 |
+
if (typeof returnV === 'undefined') {
|
| 46 |
+
return completion; // step 5.b
|
| 47 |
+
}
|
| 48 |
+
return Call(returnV, iterator); // step 5.c, 5.d.
|
| 49 |
+
}
|
| 50 |
+
),
|
| 51 |
+
null,
|
| 52 |
+
function (e) {
|
| 53 |
+
if (completion.type() === 'throw') {
|
| 54 |
+
completion['?'](); // step 6
|
| 55 |
+
} else {
|
| 56 |
+
throw e; // step 7
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
),
|
| 60 |
+
function (innerResult) { // step 8
|
| 61 |
+
if (completion.type() === 'throw') {
|
| 62 |
+
completion['?'](); // step 6
|
| 63 |
+
}
|
| 64 |
+
if (!isObject(innerResult)) {
|
| 65 |
+
throw new $TypeError('`innerResult` must be an Object'); // step 10
|
| 66 |
+
}
|
| 67 |
+
return completion;
|
| 68 |
+
}
|
| 69 |
+
);
|
| 70 |
+
};
|
node_modules/es-abstract/2024/BigInt/add.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntAdd(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// shortcut for the actual spec mechanics
|
| 13 |
+
return x + y;
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/bitwiseAND.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND
|
| 8 |
+
|
| 9 |
+
module.exports = function BigIntBitwiseAND(x, y) {
|
| 10 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 12 |
+
}
|
| 13 |
+
return BigIntBitwiseOp('&', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/bitwiseNOT.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
|
| 8 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT
|
| 9 |
+
|
| 10 |
+
module.exports = function BigIntBitwiseNOT(x) {
|
| 11 |
+
if (typeof x !== 'bigint') {
|
| 12 |
+
throw new $TypeError('Assertion failed: `x` argument must be a BigInt');
|
| 13 |
+
}
|
| 14 |
+
return -x - $BigInt(1);
|
| 15 |
+
};
|
node_modules/es-abstract/2024/BigInt/bitwiseOR.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR
|
| 8 |
+
|
| 9 |
+
module.exports = function BigIntBitwiseOR(x, y) {
|
| 10 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 12 |
+
}
|
| 13 |
+
return BigIntBitwiseOp('|', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/bitwiseXOR.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var BigIntBitwiseOp = require('../BigIntBitwiseOp');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR
|
| 8 |
+
|
| 9 |
+
module.exports = function BigIntBitwiseXOR(x, y) {
|
| 10 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 12 |
+
}
|
| 13 |
+
return BigIntBitwiseOp('^', x, y);
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/divide.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $TypeError = require('es-errors/type');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide
|
| 10 |
+
|
| 11 |
+
module.exports = function BigIntDivide(x, y) {
|
| 12 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 14 |
+
}
|
| 15 |
+
if (y === $BigInt(0)) {
|
| 16 |
+
throw new $RangeError('Division by zero');
|
| 17 |
+
}
|
| 18 |
+
// shortcut for the actual spec mechanics
|
| 19 |
+
return x / y;
|
| 20 |
+
};
|
node_modules/es-abstract/2024/BigInt/equal.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntEqual(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
// shortcut for the actual spec mechanics
|
| 12 |
+
return x === y;
|
| 13 |
+
};
|
node_modules/es-abstract/2024/BigInt/exponentiate.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $TypeError = require('es-errors/type');
|
| 8 |
+
|
| 9 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate
|
| 10 |
+
|
| 11 |
+
module.exports = function BigIntExponentiate(base, exponent) {
|
| 12 |
+
if (typeof base !== 'bigint' || typeof exponent !== 'bigint') {
|
| 13 |
+
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts');
|
| 14 |
+
}
|
| 15 |
+
if (exponent < $BigInt(0)) {
|
| 16 |
+
throw new $RangeError('Exponent must be positive');
|
| 17 |
+
}
|
| 18 |
+
if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) {
|
| 19 |
+
return $BigInt(1);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
var square = base;
|
| 23 |
+
var remaining = exponent;
|
| 24 |
+
while (remaining > $BigInt(0)) {
|
| 25 |
+
square += exponent;
|
| 26 |
+
--remaining; // eslint-disable-line no-plusplus
|
| 27 |
+
}
|
| 28 |
+
return square;
|
| 29 |
+
};
|
node_modules/es-abstract/2024/BigInt/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var add = require('./add');
|
| 4 |
+
var bitwiseAND = require('./bitwiseAND');
|
| 5 |
+
var bitwiseNOT = require('./bitwiseNOT');
|
| 6 |
+
var bitwiseOR = require('./bitwiseOR');
|
| 7 |
+
var bitwiseXOR = require('./bitwiseXOR');
|
| 8 |
+
var divide = require('./divide');
|
| 9 |
+
var equal = require('./equal');
|
| 10 |
+
var exponentiate = require('./exponentiate');
|
| 11 |
+
var leftShift = require('./leftShift');
|
| 12 |
+
var lessThan = require('./lessThan');
|
| 13 |
+
var multiply = require('./multiply');
|
| 14 |
+
var remainder = require('./remainder');
|
| 15 |
+
var signedRightShift = require('./signedRightShift');
|
| 16 |
+
var subtract = require('./subtract');
|
| 17 |
+
var toString = require('./toString');
|
| 18 |
+
var unaryMinus = require('./unaryMinus');
|
| 19 |
+
var unsignedRightShift = require('./unsignedRightShift');
|
| 20 |
+
|
| 21 |
+
module.exports = {
|
| 22 |
+
add: add,
|
| 23 |
+
bitwiseAND: bitwiseAND,
|
| 24 |
+
bitwiseNOT: bitwiseNOT,
|
| 25 |
+
bitwiseOR: bitwiseOR,
|
| 26 |
+
bitwiseXOR: bitwiseXOR,
|
| 27 |
+
divide: divide,
|
| 28 |
+
equal: equal,
|
| 29 |
+
exponentiate: exponentiate,
|
| 30 |
+
leftShift: leftShift,
|
| 31 |
+
lessThan: lessThan,
|
| 32 |
+
multiply: multiply,
|
| 33 |
+
remainder: remainder,
|
| 34 |
+
signedRightShift: signedRightShift,
|
| 35 |
+
subtract: subtract,
|
| 36 |
+
toString: toString,
|
| 37 |
+
unaryMinus: unaryMinus,
|
| 38 |
+
unsignedRightShift: unsignedRightShift
|
| 39 |
+
};
|
node_modules/es-abstract/2024/BigInt/leftShift.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntLeftShift(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// shortcut for the actual spec mechanics
|
| 13 |
+
return x << y;
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/lessThan.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntLessThan(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// shortcut for the actual spec mechanics
|
| 13 |
+
return x < y;
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/multiply.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntMultiply(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// shortcut for the actual spec mechanics
|
| 13 |
+
return x * y;
|
| 14 |
+
};
|
node_modules/es-abstract/2024/BigInt/remainder.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var GetIntrinsic = require('get-intrinsic');
|
| 4 |
+
|
| 5 |
+
var $BigInt = GetIntrinsic('%BigInt%', true);
|
| 6 |
+
var $RangeError = require('es-errors/range');
|
| 7 |
+
var $TypeError = require('es-errors/type');
|
| 8 |
+
|
| 9 |
+
var zero = $BigInt && $BigInt(0);
|
| 10 |
+
|
| 11 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder
|
| 12 |
+
|
| 13 |
+
module.exports = function BigIntRemainder(n, d) {
|
| 14 |
+
if (typeof n !== 'bigint' || typeof d !== 'bigint') {
|
| 15 |
+
throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts');
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
if (d === zero) {
|
| 19 |
+
throw new $RangeError('Division by zero');
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
if (n === zero) {
|
| 23 |
+
return zero;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
// shortcut for the actual spec mechanics
|
| 27 |
+
return n % d;
|
| 28 |
+
};
|
node_modules/es-abstract/2024/BigInt/signedRightShift.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
var BigIntLeftShift = require('./leftShift');
|
| 6 |
+
|
| 7 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift
|
| 8 |
+
|
| 9 |
+
module.exports = function BigIntSignedRightShift(x, y) {
|
| 10 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 11 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
return BigIntLeftShift(x, -y);
|
| 15 |
+
};
|
node_modules/es-abstract/2024/BigInt/subtract.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $TypeError = require('es-errors/type');
|
| 4 |
+
|
| 5 |
+
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract
|
| 6 |
+
|
| 7 |
+
module.exports = function BigIntSubtract(x, y) {
|
| 8 |
+
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
|
| 9 |
+
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// shortcut for the actual spec mechanics
|
| 13 |
+
return x - y;
|
| 14 |
+
};
|