paradiego
This commit is contained in:
67
node_modules/es-iterator-helpers/.eslintrc
generated
vendored
Normal file
67
node_modules/es-iterator-helpers/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"plugins": [
|
||||
"import",
|
||||
],
|
||||
|
||||
"globals": {
|
||||
"Iterator": false,
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"func-name-matching": 0,
|
||||
"id-length": 0,
|
||||
"max-lines-per-function": 0,
|
||||
"max-statements": 0,
|
||||
"multiline-comment-style": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"Call",
|
||||
"CreateIteratorFromClosure",
|
||||
"CreateIterResultObject",
|
||||
"GeneratorResume",
|
||||
"GeneratorResumeAbrupt",
|
||||
"GeneratorStart",
|
||||
"GeneratorValidate",
|
||||
"Get",
|
||||
"GetIntrinsic",
|
||||
"GetIteratorDirect",
|
||||
"GetIteratorFlattenable",
|
||||
"GetMethod",
|
||||
"IsArray",
|
||||
"IsCallable",
|
||||
"IteratorClose",
|
||||
"IteratorStepValue",
|
||||
"IteratorStep",
|
||||
"NormalCompletion",
|
||||
"OrdinaryHasInstance",
|
||||
"OrdinaryObjectCreate",
|
||||
"StringToCodePoints",
|
||||
"ThrowCompletion",
|
||||
"ToBoolean",
|
||||
"ToIntegerOrInfinity",
|
||||
"ToNumber",
|
||||
"Type",
|
||||
],
|
||||
}],
|
||||
"no-negated-condition": 1,
|
||||
"object-curly-newline": 0,
|
||||
"sort-keys": 0,
|
||||
"import/no-extraneous-dependencies": 2,
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"eqeqeq": ["error", "allow-null"],
|
||||
"max-params": 0,
|
||||
"import/no-extraneous-dependencies": [2, { "devDependencies": true }],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
12
node_modules/es-iterator-helpers/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/es-iterator-helpers/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/es-iterator-helpers
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
13
node_modules/es-iterator-helpers/.nycrc
generated
vendored
Normal file
13
node_modules/es-iterator-helpers/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"lines": 86,
|
||||
"statements": 85.93,
|
||||
"functions": 82.43,
|
||||
"branches": 76.06,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
171
node_modules/es-iterator-helpers/CHANGELOG.md
generated
vendored
Normal file
171
node_modules/es-iterator-helpers/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.19](https://github.com/es-shims/iterator-helpers/compare/v1.0.18...v1.0.19) - 2024-04-24
|
||||
|
||||
### Commits
|
||||
|
||||
- [patch] remove unused AOs [`698cef7`](https://github.com/es-shims/iterator-helpers/commit/698cef79757378a74500690d5a5dc2a6b86cd304)
|
||||
- [Fix] `drop`, `filter`, `flatMap`, `map`: rpatch a v8 bug when polyfilling [`3670395`](https://github.com/es-shims/iterator-helpers/commit/36703956321c201933c4c701c78304669a46947b)
|
||||
- [Deps] update `es-abstract` [`d2b47a5`](https://github.com/es-shims/iterator-helpers/commit/d2b47a5f46d3f874aad67375346cb58bf8c9e8b2)
|
||||
|
||||
## [v1.0.18](https://github.com/es-shims/iterator-helpers/compare/v1.0.17...v1.0.18) - 2024-03-15
|
||||
|
||||
### Commits
|
||||
|
||||
- [Deps] update `es-abstract` [`6b45f15`](https://github.com/es-shims/iterator-helpers/commit/6b45f150e939cfbf93b816431a407c0838250e85)
|
||||
- [Deps] update `es-set-tostringtag`, `has-proto`, `safe-array-concat` [`6350106`](https://github.com/es-shims/iterator-helpers/commit/6350106c9e5c18a67754ced3fd90465b0032f1e3)
|
||||
- [Dev Deps] update `tape` [`5509b40`](https://github.com/es-shims/iterator-helpers/commit/5509b408791402d2f7d7882f905741e5a5dd805b)
|
||||
- [Deps] remove an unused dep [`78e34a5`](https://github.com/es-shims/iterator-helpers/commit/78e34a5452e7b7ef3dc239a62dd8a7324fbb2305)
|
||||
|
||||
## [v1.0.17](https://github.com/es-shims/iterator-helpers/compare/v1.0.16...v1.0.17) - 2024-02-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Fix] avoid use of internal `assertRecord` helper from `es-abstract` [`#5`](https://github.com/es-shims/iterator-helpers/issues/5)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Deps] update `call-bind`, `es-abstract`, `has-property-descriptors` [`e563ee7`](https://github.com/es-shims/iterator-helpers/commit/e563ee7230897c41f7f3623a11fc0ecc6862ee1c)
|
||||
|
||||
## [v1.0.16](https://github.com/es-shims/iterator-helpers/compare/v1.0.15...v1.0.16) - 2024-02-09
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use `IteratorStepValue` [`aa62d72`](https://github.com/es-shims/iterator-helpers/commit/aa62d72c52d86218942b4792c7131f72d939b733)
|
||||
- [Refactor] use `es-errors` instead of `get-intrinsic` where possible [`05a25ae`](https://github.com/es-shims/iterator-helpers/commit/05a25aeccd0523df86b401c771d88fbea06558c9)
|
||||
- [Deps] update `call-bind`, `es-abstract`, `es-set-tostringtag`, `function-bind`, `get-intrinsic`, `has-property-descriptors`, `internal-slot`, `safe-array-concat` [`6aeee43`](https://github.com/es-shims/iterator-helpers/commit/6aeee435ed5956b7c5ee66a51b86c26827874eae)
|
||||
- [Dev Deps] update `aud`, `eslint-plugin-import`, `mock-property`, `npmignore`, `object-inspect`, `tape` [`0a21fdb`](https://github.com/es-shims/iterator-helpers/commit/0a21fdb4a59d25c248561b7f476fc9670b411855)
|
||||
- [Deps] update `call-bind`, `es-errors`, `get-intrinsic`, `internal-slot` [`5b10625`](https://github.com/es-shims/iterator-helpers/commit/5b106251dad4252a744b2e0aa0d1be4c1c62b779)
|
||||
- [meta] add missing `engines.node` [`1534039`](https://github.com/es-shims/iterator-helpers/commit/1534039eca062429c0df68dcc3459ce9ba7c69be)
|
||||
- [Deps] update `get-intrinsic` [`37da5f2`](https://github.com/es-shims/iterator-helpers/commit/37da5f201940c78526de647ef9ba84d9152349c1)
|
||||
- [Dev Deps] update `has-tostringtag` [`a7cac51`](https://github.com/es-shims/iterator-helpers/commit/a7cac51cc027e6274918cb1ea0cf1fa1a194fcd9)
|
||||
|
||||
## [v1.0.15](https://github.com/es-shims/iterator-helpers/compare/v1.0.14...v1.0.15) - 2023-09-13
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add `Iterator.prototype` shim [`c4a6203`](https://github.com/es-shims/iterator-helpers/commit/c4a6203a0ac87bf0a33835e775c207ff1911225d)
|
||||
- [Tests] add passing tests for native generators [`57bae8c`](https://github.com/es-shims/iterator-helpers/commit/57bae8ccbeb27ed0e6c449f35cddbda6cf6757e8)
|
||||
- [Deps] update `define-properties`, `iterator.prototype`, `safe-array-concat` [`56ca087`](https://github.com/es-shims/iterator-helpers/commit/56ca087f924dbefee47f0a1cb3b8468de76cd234)
|
||||
|
||||
## [v1.0.14](https://github.com/es-shims/iterator-helpers/compare/v1.0.13...v1.0.14) - 2023-08-26
|
||||
|
||||
### Commits
|
||||
|
||||
- [Deps] update `es-abstract` [`477b123`](https://github.com/es-shims/iterator-helpers/commit/477b1233acd36fdbbccd79fbb69cde325bc3e6a9)
|
||||
- [Dev Deps] update `aud`, `eslint-plugin-import`, `tape` [`e4ea414`](https://github.com/es-shims/iterator-helpers/commit/e4ea4146feffb72fd828e5d883e960e0ad589a35)
|
||||
|
||||
## [v1.0.13](https://github.com/es-shims/iterator-helpers/compare/v1.0.12...v1.0.13) - 2023-08-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Deps] add missing deps; add eslint-plugin-import [`#3`](https://github.com/es-shims/iterator-helpers/issues/3)
|
||||
|
||||
## [v1.0.12](https://github.com/es-shims/iterator-helpers/compare/v1.0.11...v1.0.12) - 2023-07-14
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] avoid creating string wrapper objects with sloppy mode flatMap mappers [`db16b34`](https://github.com/es-shims/iterator-helpers/commit/db16b34aec554934ec2bfd62629fb66cebc311f8)
|
||||
- [Deps] update `es-abstract` [`f002147`](https://github.com/es-shims/iterator-helpers/commit/f002147f0afbb2cd7c2d2e1207685f52e33abf0f)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud [`42064e8`](https://github.com/es-shims/iterator-helpers/commit/42064e80e0cc37f5e4676c2133dacae7456e313f)
|
||||
- [meta] fix tidelift funding identifier [`896fd4f`](https://github.com/es-shims/iterator-helpers/commit/896fd4f2e4b419945bfbd85024a2c96248323151)
|
||||
|
||||
## [v1.0.11](https://github.com/es-shims/iterator-helpers/compare/v1.0.10...v1.0.11) - 2023-05-22
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] iterator helpers are not a constructor [`8a7f999`](https://github.com/es-shims/iterator-helpers/commit/8a7f9996ba3600ef30f3a9c75f9f994e88d075c6)
|
||||
|
||||
## [v1.0.10](https://github.com/es-shims/iterator-helpers/compare/v1.0.9...v1.0.10) - 2023-05-18
|
||||
|
||||
### Commits
|
||||
|
||||
- [patch] remove IsCallable check on NextMethod, deferring errors to callsite [`bbb7efa`](https://github.com/es-shims/iterator-helpers/commit/bbb7efac8349273fe17c86194ef13af45bcb8e24)
|
||||
- [patch] change Symbol.iterator fallback from callable check to nullish check [`ec3e255`](https://github.com/es-shims/iterator-helpers/commit/ec3e255dfe30ea6650d8a697e6c4f16fa393e923)
|
||||
- [Tests] add test cases [`5117c47`](https://github.com/es-shims/iterator-helpers/commit/5117c477348407ebdfc9410dd437a68634c39a8e)
|
||||
- [Dev Deps] update `@es-shims/api` [`9fa13a0`](https://github.com/es-shims/iterator-helpers/commit/9fa13a0739f353536de58b2b648aa9eacfa49479)
|
||||
- [Dev Deps] update `@es-shims/api` [`b74b0ac`](https://github.com/es-shims/iterator-helpers/commit/b74b0ac2bd7e920f760bae7ba7c6c5310f5123d8)
|
||||
|
||||
## [v1.0.9](https://github.com/es-shims/iterator-helpers/compare/v1.0.8...v1.0.9) - 2023-05-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use 2022 AO instead of 2015 AO [`75ee5c4`](https://github.com/es-shims/iterator-helpers/commit/75ee5c4dea0037f02a61c240114bb6bd8c8b48f1)
|
||||
|
||||
## [v1.0.8](https://github.com/es-shims/iterator-helpers/compare/v1.0.7...v1.0.8) - 2023-05-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] `flatMap`: close the inner iterator when applicable [`4dc94e0`](https://github.com/es-shims/iterator-helpers/commit/4dc94e0117e34b4c99f9ed96c4fe306896c47da1)
|
||||
|
||||
## [v1.0.7](https://github.com/es-shims/iterator-helpers/compare/v1.0.6...v1.0.7) - 2023-05-01
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] `flatMap`: properly handle yielded iterables [`3a78767`](https://github.com/es-shims/iterator-helpers/commit/3a78767e86394d45b212a225e4253745f8b1dc8d)
|
||||
- [Fix] `flatMap`: only increment the count when iterating the outer iterator [`955d0b0`](https://github.com/es-shims/iterator-helpers/commit/955d0b00f5660db0d9febef2a16426dfc32e8be4)
|
||||
|
||||
## [v1.0.6](https://github.com/es-shims/iterator-helpers/compare/v1.0.5...v1.0.6) - 2023-04-20
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] `GetIteratorFlattenable`: remove hint [`781fc7c`](https://github.com/es-shims/iterator-helpers/commit/781fc7c28615aaaef139cbcd9e6ade513419bea1)
|
||||
- [Refactor] `GetIteratorFlattenable`: use `GetIteratorDirect` [`026118b`](https://github.com/es-shims/iterator-helpers/commit/026118b8c884adaee5ab0eb12de838ef9abdbb6f)
|
||||
- [Refactor] use `safe-array-concat` [`1d985a4`](https://github.com/es-shims/iterator-helpers/commit/1d985a449be212523f05ba4a359a162931ddf3d3)
|
||||
|
||||
## [v1.0.5](https://github.com/es-shims/iterator-helpers/compare/v1.0.4...v1.0.5) - 2023-03-22
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] add passing tests for 4240029 [`c2082fe`](https://github.com/es-shims/iterator-helpers/commit/c2082fee3e73dc1998a67fbe0014e3ebdceb8ec0)
|
||||
- [Fix] properly allow subclasses of Iterator to be constructed [`5cebe2a`](https://github.com/es-shims/iterator-helpers/commit/5cebe2a5767393696d0ce4e9325edf78c300f938)
|
||||
|
||||
## [v1.0.4](https://github.com/es-shims/iterator-helpers/compare/v1.0.3...v1.0.4) - 2023-03-21
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] validate arguments first [`4240029`](https://github.com/es-shims/iterator-helpers/commit/42400297454909ddccc899a012dc55bbd403eb8b)
|
||||
- [Fix] close underlying iterator when helper is closed [`f5372c7`](https://github.com/es-shims/iterator-helpers/commit/f5372c78cafff64bfda5849386538f806916049a)
|
||||
- [Tests] `Iterator`: remove an unnecessary call-bind [`7d0ba59`](https://github.com/es-shims/iterator-helpers/commit/7d0ba59f672e690b189f91e0348f6b5e00f934e1)
|
||||
|
||||
## [v1.0.3](https://github.com/es-shims/iterator-helpers/compare/v1.0.2...v1.0.3) - 2023-03-17
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] `drop`/`filter`/`flatMap`/`map`/`take`: properly IfAbruptCloseIterator [`ff643a0`](https://github.com/es-shims/iterator-helpers/commit/ff643a0b7c4e5c2b00e794ba9b988b47e783f235)
|
||||
- [Refactor] use `NormalCompletion`/`ThrowCompletion` instead of thunks [`68fd937`](https://github.com/es-shims/iterator-helpers/commit/68fd937b53c107481a9f868bda5b2bd5cbc00142)
|
||||
- [Fix] `filter`: IteratorClose needs to rethrow the error [`200474f`](https://github.com/es-shims/iterator-helpers/commit/200474ff289dea77c696c0c025f4602405cf3fff)
|
||||
- [Fix] `filter`: properly increment the counter [`14aa2d8`](https://github.com/es-shims/iterator-helpers/commit/14aa2d8b75fd16378c2be183fd5b008712547ed4)
|
||||
- [Fix] `Iterator` can not be `new`ed or invoked directly [`6fbd68e`](https://github.com/es-shims/iterator-helpers/commit/6fbd68e778dd455c4aa63f4e1f39e0b583610509)
|
||||
- [Fix] `Iterator.prototype` should be non-writable [`1080288`](https://github.com/es-shims/iterator-helpers/commit/108028858067e40ea56dca9a68dd6cea4966e904)
|
||||
- [Deps] update `es-abstract` [`b7913da`](https://github.com/es-shims/iterator-helpers/commit/b7913da9cddef1ec40b4827821c6069019b79093)
|
||||
- [Dev Deps] update `@es-shims/api` [`0071bed`](https://github.com/es-shims/iterator-helpers/commit/0071bed9e13231317d2cdb9ae0ecb6603784ad1f)
|
||||
|
||||
## [v1.0.2](https://github.com/es-shims/iterator-helpers/compare/v1.0.1...v1.0.2) - 2023-02-09
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] inline 2023 impls of Iterator AOs until es-abstract is published with them [`b9c80c5`](https://github.com/es-shims/iterator-helpers/commit/b9c80c5aba0deaaabef7e650fe7ec231fdc695e3)
|
||||
- [Fix] ensure calling `.return` does not invoke the next iteration [`9e28ed5`](https://github.com/es-shims/iterator-helpers/commit/9e28ed5af44a660a0d2e80684cb9a4bf3d86e09a)
|
||||
- [Fix] `map`: pass the proper index argument to the mapper [`125e3ca`](https://github.com/es-shims/iterator-helpers/commit/125e3cac192ef650a88f774a5a2dd9afe395a5b8)
|
||||
- [Deps] update `internal-slot` [`43351b6`](https://github.com/es-shims/iterator-helpers/commit/43351b63545e3698f54daf5dc0652a7b2fb7cb28)
|
||||
|
||||
## [v1.0.1](https://github.com/es-shims/iterator-helpers/compare/v1.0.0...v1.0.1) - 2023-02-07
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] `Iterator`: throw when Iterator() is called without new [`a6fc7e7`](https://github.com/es-shims/iterator-helpers/commit/a6fc7e768cbf4d43117365ec2f1bd300247d8dfd)
|
||||
|
||||
## v1.0.0 - 2023-02-05
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`650713e`](https://github.com/es-shims/iterator-helpers/commit/650713eecc9d4dab28d5ba3dc5afcbdb8ff99b5a)
|
||||
- Initial commit [`2379dfd`](https://github.com/es-shims/iterator-helpers/commit/2379dfdad70f64efb31e342a4a7779b1140b2481)
|
||||
- npm init [`f77411a`](https://github.com/es-shims/iterator-helpers/commit/f77411a443f1a103dbb92a69210228d4fc1e6d04)
|
||||
- Only apps should have lockfiles [`313dcf5`](https://github.com/es-shims/iterator-helpers/commit/313dcf5211e99569ad275885728b5ac7af30f4ec)
|
||||
3
node_modules/es-iterator-helpers/Iterator.from/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.from/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
32
node_modules/es-iterator-helpers/Iterator.from/implementation.js
generated
vendored
Normal file
32
node_modules/es-iterator-helpers/Iterator.from/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var GetIteratorFlattenable = require('../aos/GetIteratorFlattenable');
|
||||
var OrdinaryHasInstance = require('es-abstract/2024/OrdinaryHasInstance');
|
||||
var OrdinaryObjectCreate = require('es-abstract/2024/OrdinaryObjectCreate');
|
||||
|
||||
var $Iterator = require('../Iterator/polyfill')();
|
||||
var $WrapForValidIteratorPrototype = require('../WrapForValidIteratorPrototype');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function from(O) {
|
||||
if (this instanceof from) {
|
||||
throw new $TypeError('`Iterator.from` is not a constructor');
|
||||
}
|
||||
|
||||
var iteratorRecord = GetIteratorFlattenable(O, 'iterate-strings'); // step 1
|
||||
|
||||
var hasInstance = OrdinaryHasInstance($Iterator, iteratorRecord['[[Iterator]]']); // step 2
|
||||
|
||||
if (hasInstance) { // step 3
|
||||
return iteratorRecord['[[Iterator]]']; // step 3.a
|
||||
}
|
||||
|
||||
var wrapper = OrdinaryObjectCreate($WrapForValidIteratorPrototype); // , ['[[Iterated]]']); // step 4
|
||||
|
||||
SLOT.set(wrapper, '[[Iterated]]', iteratorRecord); // step 5
|
||||
|
||||
return wrapper; // step 6
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.from/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.from/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var callBind = require('call-bind');
|
||||
var define = require('define-properties');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var bound = callBind(getPolyfill(), null);
|
||||
|
||||
define(bound, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = bound;
|
||||
9
node_modules/es-iterator-helpers/Iterator.from/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.from/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
var $Iterator = require('../Iterator');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof $Iterator.from === 'function' ? $Iterator.from : implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.from/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.from/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
var define = require('define-properties');
|
||||
|
||||
var getIteratorPolyfill = require('../Iterator/polyfill');
|
||||
|
||||
module.exports = function shimIteratorFrom() {
|
||||
var $Iterator = getIteratorPolyfill();
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
$Iterator,
|
||||
{ from: polyfill },
|
||||
{ from: function () { return $Iterator.from !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.constructor/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.constructor/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
5
node_modules/es-iterator-helpers/Iterator.prototype.constructor/implementation.js
generated
vendored
Normal file
5
node_modules/es-iterator-helpers/Iterator.prototype.constructor/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var $Iterator = require('../Iterator/polyfill')();
|
||||
|
||||
module.exports = $Iterator;
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.constructor/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.constructor/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var bind = require('function-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = bind.call(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
7
node_modules/es-iterator-helpers/Iterator.prototype.constructor/polyfill.js
generated
vendored
Normal file
7
node_modules/es-iterator-helpers/Iterator.prototype.constructor/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return implementation;
|
||||
};
|
||||
20
node_modules/es-iterator-helpers/Iterator.prototype.constructor/shim.js
generated
vendored
Normal file
20
node_modules/es-iterator-helpers/Iterator.prototype.constructor/shim.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
var $Iterator = require('./implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeCtor() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ constructor: $Iterator },
|
||||
{ constructor: function () { return $Iterator.constructor !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.drop/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.drop/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
93
node_modules/es-iterator-helpers/Iterator.prototype.drop/implementation.js
generated
vendored
Normal file
93
node_modules/es-iterator-helpers/Iterator.prototype.drop/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
|
||||
var $RangeError = require('es-errors/range');
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIteratorFromClosure = require('../aos/CreateIteratorFromClosure');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStep = require('es-abstract/2024/IteratorStep');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity');
|
||||
var ToNumber = require('es-abstract/2024/ToNumber');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var iterHelperProto = require('../IteratorHelperPrototype');
|
||||
|
||||
var isNaN = require('es-abstract/helpers/isNaN');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function drop(limit) {
|
||||
if (this instanceof drop) {
|
||||
throw new $TypeError('`drop` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
var numLimit = ToNumber(limit); // step 2
|
||||
if (isNaN(numLimit)) {
|
||||
throw new $RangeError('`limit` must be a non-NaN number'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var integerLimit = ToIntegerOrInfinity(numLimit); // step 4
|
||||
if (integerLimit < 0) {
|
||||
throw new $RangeError('`limit` must be a >= 0'); // step 5
|
||||
}
|
||||
|
||||
var closeIfAbrupt = function (abruptCompletion) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('`abruptCompletion` must be a Completion Record');
|
||||
}
|
||||
IteratorClose(
|
||||
iterated,
|
||||
abruptCompletion
|
||||
);
|
||||
};
|
||||
|
||||
var sentinel = {};
|
||||
var remaining = integerLimit; // step 6.a
|
||||
var closure = function () { // step 6
|
||||
var next;
|
||||
while (remaining > 0) { // step 6.b
|
||||
if (remaining !== Infinity) { // step 6.b.i
|
||||
remaining -= 1; // step 6.b.i.1
|
||||
}
|
||||
|
||||
next = IteratorStep(iterated); // step 6.b.ii
|
||||
if (!next) {
|
||||
// return void undefined; // step 6.b.iii
|
||||
return sentinel;
|
||||
}
|
||||
}
|
||||
// while (true) { // step 6.c
|
||||
try {
|
||||
var value = IteratorStepValue(iterated); // step 6.b.i
|
||||
if (iterated['[[Done]]']) {
|
||||
return sentinel; // step 6.b.ii
|
||||
}
|
||||
return value;
|
||||
} catch (e) {
|
||||
// close iterator // step 6.c.icv
|
||||
closeIfAbrupt(ThrowCompletion(e));
|
||||
throw e;
|
||||
}
|
||||
// }
|
||||
// return void undefined;
|
||||
};
|
||||
SLOT.set(closure, '[[Sentinel]]', sentinel); // for the userland implementation
|
||||
SLOT.set(closure, '[[CloseIfAbrupt]]', closeIfAbrupt); // for the userland implementation
|
||||
|
||||
var result = CreateIteratorFromClosure(closure, 'Iterator Helper', iterHelperProto, ['[[UnderlyingIterator]]']); // step 4
|
||||
|
||||
SLOT.set(result, '[[UnderlyingIterator]]', iterated); // step 5
|
||||
|
||||
return result; // step 6
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.drop/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.drop/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
15
node_modules/es-iterator-helpers/Iterator.prototype.drop/polyfill.js
generated
vendored
Normal file
15
node_modules/es-iterator-helpers/Iterator.prototype.drop/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (typeof Iterator === 'function' && typeof Iterator.prototype.drop === 'function') {
|
||||
try {
|
||||
// https://issues.chromium.org/issues/336839115
|
||||
Iterator.prototype.drop.call({ next: null }, 0).next();
|
||||
} catch (e) {
|
||||
return Iterator.prototype.drop;
|
||||
}
|
||||
}
|
||||
return implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.drop/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.drop/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeDrop() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ drop: polyfill },
|
||||
{ drop: function () { return $IteratorPrototype.drop !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.every/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.every/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
58
node_modules/es-iterator-helpers/Iterator.prototype.every/implementation.js
generated
vendored
Normal file
58
node_modules/es-iterator-helpers/Iterator.prototype.every/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var ToBoolean = require('es-abstract/2024/ToBoolean');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function every(predicate) {
|
||||
if (this instanceof every) {
|
||||
throw new $TypeError('`every` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(predicate)) {
|
||||
throw new $TypeError('`predicate` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var counter = 0; // step 5
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 6
|
||||
var value = IteratorStepValue(iterated); // step 6.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return true; // step 6.b
|
||||
}
|
||||
var result;
|
||||
try {
|
||||
result = Call(predicate, void undefined, [value, counter]); // step 6.c
|
||||
} catch (e) {
|
||||
// close iterator // step 6.d
|
||||
IteratorClose(
|
||||
iterated,
|
||||
ThrowCompletion(e)
|
||||
);
|
||||
} finally {
|
||||
counter += 1; // step 6.f
|
||||
}
|
||||
if (!ToBoolean(result)) {
|
||||
return IteratorClose(
|
||||
iterated,
|
||||
NormalCompletion(false)
|
||||
); // step 6.e
|
||||
}
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.every/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.every/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.every/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.every/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.every === 'function'
|
||||
? Iterator.prototype.every
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.every/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.every/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeEvery() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ every: polyfill },
|
||||
{ every: function () { return $IteratorPrototype.every !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.filter/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.filter/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
80
node_modules/es-iterator-helpers/Iterator.prototype.filter/implementation.js
generated
vendored
Normal file
80
node_modules/es-iterator-helpers/Iterator.prototype.filter/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIteratorFromClosure = require('../aos/CreateIteratorFromClosure');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var ToBoolean = require('es-abstract/2024/ToBoolean');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var iterHelperProto = require('../IteratorHelperPrototype');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function filter(predicate) {
|
||||
if (this instanceof filter) {
|
||||
throw new $TypeError('`filter` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(predicate)) {
|
||||
throw new $TypeError('`predicate` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var closeIfAbrupt = function (abruptCompletion) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('`abruptCompletion` must be a Completion Record');
|
||||
}
|
||||
IteratorClose(
|
||||
iterated,
|
||||
abruptCompletion
|
||||
);
|
||||
};
|
||||
|
||||
var sentinel = {};
|
||||
var counter = 0; // step 6.a
|
||||
var closure = function () {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 6.b
|
||||
var value = IteratorStepValue(iterated); // step 6.b.i
|
||||
if (iterated['[[Done]]']) {
|
||||
return sentinel; // step 6.b.ii
|
||||
}
|
||||
|
||||
var selected;
|
||||
try {
|
||||
selected = Call(predicate, void undefined, [value, counter]); // step 6.b.iv
|
||||
// yield mapped // step 6.b.vi
|
||||
if (ToBoolean(selected)) {
|
||||
return value;
|
||||
}
|
||||
} catch (e) {
|
||||
// close iterator // step 6.b.v, 6.b.vii
|
||||
closeIfAbrupt(ThrowCompletion(e));
|
||||
throw e;
|
||||
} finally {
|
||||
counter += 1; // step 6.b.viii
|
||||
}
|
||||
}
|
||||
};
|
||||
SLOT.set(closure, '[[Sentinel]]', sentinel); // for the userland implementation
|
||||
SLOT.set(closure, '[[CloseIfAbrupt]]', closeIfAbrupt); // for the userland implementation
|
||||
|
||||
var result = CreateIteratorFromClosure(closure, 'Iterator Helper', iterHelperProto, ['[[UnderlyingIterator]]']); // step 7
|
||||
|
||||
SLOT.set(result, '[[UnderlyingIterator]]', iterated); // step 8
|
||||
|
||||
return result; // step 9
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.filter/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.filter/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
15
node_modules/es-iterator-helpers/Iterator.prototype.filter/polyfill.js
generated
vendored
Normal file
15
node_modules/es-iterator-helpers/Iterator.prototype.filter/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (typeof Iterator === 'function' && typeof Iterator.prototype.filter === 'function') {
|
||||
try {
|
||||
// https://issues.chromium.org/issues/336839115
|
||||
Iterator.prototype.filter.call({ next: null }, function () {}).next();
|
||||
} catch (e) {
|
||||
return Iterator.prototype.filter;
|
||||
}
|
||||
}
|
||||
return implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.filter/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.filter/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeFilter() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ filter: polyfill },
|
||||
{ filter: function () { return $IteratorPrototype.filter !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.find/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.find/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
59
node_modules/es-iterator-helpers/Iterator.prototype.find/implementation.js
generated
vendored
Normal file
59
node_modules/es-iterator-helpers/Iterator.prototype.find/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var ToBoolean = require('es-abstract/2024/ToBoolean');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function find(predicate) {
|
||||
if (this instanceof find) {
|
||||
throw new $TypeError('`find` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(predicate)) {
|
||||
throw new $TypeError('`predicate` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var counter = 0; // step 5
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 6
|
||||
var value = IteratorStepValue(iterated); // step 6.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return void undefined; // step 6.b
|
||||
}
|
||||
var result;
|
||||
try {
|
||||
result = Call(predicate, void undefined, [value, counter]); // step 6.c
|
||||
} catch (e) {
|
||||
// close iterator // step 6.d
|
||||
IteratorClose(
|
||||
iterated,
|
||||
ThrowCompletion(e)
|
||||
);
|
||||
} finally {
|
||||
counter += 1; // step 6.f
|
||||
}
|
||||
if (ToBoolean(result)) {
|
||||
return IteratorClose(
|
||||
iterated,
|
||||
NormalCompletion(value)
|
||||
); // step 6.e
|
||||
}
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.find/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.find/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.find/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.find/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.find === 'function'
|
||||
? Iterator.prototype.find
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.find/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.find/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeFind() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ find: polyfill },
|
||||
{ find: function () { return $IteratorPrototype.find !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
118
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/implementation.js
generated
vendored
Normal file
118
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIteratorFromClosure = require('../aos/CreateIteratorFromClosure');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var GetIteratorFlattenable = require('../aos/GetIteratorFlattenable');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var iterHelperProto = require('../IteratorHelperPrototype');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function flatMap(mapper) {
|
||||
if (this instanceof flatMap) {
|
||||
throw new $TypeError('`flatMap` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(mapper)) {
|
||||
throw new $TypeError('`mapper` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var sentinel = { sentinel: true };
|
||||
var innerIterator = sentinel;
|
||||
|
||||
var closeIfAbrupt = function (abruptCompletion) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('`abruptCompletion` must be a Completion Record');
|
||||
}
|
||||
try {
|
||||
if (innerIterator !== sentinel) {
|
||||
IteratorClose(
|
||||
innerIterator,
|
||||
abruptCompletion
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
innerIterator = sentinel;
|
||||
|
||||
IteratorClose(
|
||||
iterated,
|
||||
abruptCompletion
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var counter = 0; // step 5.a
|
||||
var innerAlive = false;
|
||||
var closure = function () {
|
||||
// while (true) { // step 5.b
|
||||
if (innerIterator === sentinel) {
|
||||
var value = IteratorStepValue(iterated); // step 5.b.i
|
||||
if (iterated['[[Done]]']) {
|
||||
innerAlive = false;
|
||||
innerIterator = sentinel;
|
||||
// return void undefined; // step 5.b.ii
|
||||
return sentinel;
|
||||
}
|
||||
}
|
||||
|
||||
if (innerIterator === sentinel) {
|
||||
innerAlive = true; // step 5.b.viii
|
||||
try {
|
||||
var mapped = Call(mapper, void undefined, [value, counter]); // step 5.b.iv
|
||||
// yield mapped // step 5.b.vi
|
||||
innerIterator = GetIteratorFlattenable(mapped, 'reject-strings'); // step 5.b.vi
|
||||
} catch (e) {
|
||||
innerAlive = false;
|
||||
innerIterator = sentinel;
|
||||
closeIfAbrupt(ThrowCompletion(e)); // steps 5.b.v, 5.b.vii
|
||||
} finally {
|
||||
counter += 1; // step 5.b.x
|
||||
}
|
||||
}
|
||||
// while (innerAlive) { // step 5.b.ix
|
||||
if (innerAlive) {
|
||||
// step 5.b.ix.4
|
||||
var innerValue;
|
||||
try {
|
||||
innerValue = IteratorStepValue(innerIterator); // step 5.b.ix.4.a
|
||||
} catch (e) {
|
||||
innerAlive = false;
|
||||
innerIterator = sentinel;
|
||||
closeIfAbrupt(ThrowCompletion(e)); // step 5.b.ix.4.b
|
||||
}
|
||||
if (innerIterator['[[Done]]']) {
|
||||
innerAlive = false;
|
||||
innerIterator = sentinel;
|
||||
return closure();
|
||||
}
|
||||
return innerValue; // step 5.b.ix.4.c
|
||||
}
|
||||
// }
|
||||
// return void undefined;
|
||||
return sentinel;
|
||||
};
|
||||
SLOT.set(closure, '[[Sentinel]]', sentinel); // for the userland implementation
|
||||
SLOT.set(closure, '[[CloseIfAbrupt]]', closeIfAbrupt); // for the userland implementation
|
||||
|
||||
var result = CreateIteratorFromClosure(closure, 'Iterator Helper', iterHelperProto, ['[[UnderlyingIterator]]']); // step 7
|
||||
|
||||
SLOT.set(result, '[[UnderlyingIterator]]', iterated); // step 8
|
||||
|
||||
return result; // step 9
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
15
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/polyfill.js
generated
vendored
Normal file
15
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (typeof Iterator === 'function' && typeof Iterator.prototype.flatMap === 'function') {
|
||||
try {
|
||||
// https://issues.chromium.org/issues/336839115
|
||||
Iterator.prototype.flatMap.call({ next: null }, function () {}).next();
|
||||
} catch (e) {
|
||||
return Iterator.prototype.flatMap;
|
||||
}
|
||||
}
|
||||
return implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.flatMap/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeFlatMap() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ flatMap: polyfill },
|
||||
{ flatMap: function () { return $IteratorPrototype.flatMap !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.forEach/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.forEach/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
49
node_modules/es-iterator-helpers/Iterator.prototype.forEach/implementation.js
generated
vendored
Normal file
49
node_modules/es-iterator-helpers/Iterator.prototype.forEach/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function forEach(fn) {
|
||||
if (this instanceof forEach) {
|
||||
throw new $TypeError('`forEach` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(fn)) {
|
||||
throw new $TypeError('`fn` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var counter = 0; // step 5
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 6
|
||||
var value = IteratorStepValue(iterated); // step 6.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return void undefined; // step 6.b
|
||||
}
|
||||
try {
|
||||
Call(fn, void undefined, [value, counter]); // step 6.c
|
||||
} catch (e) {
|
||||
IteratorClose(
|
||||
iterated,
|
||||
ThrowCompletion(e)
|
||||
); // steps 6.d
|
||||
throw e;
|
||||
} finally {
|
||||
counter += 1; // step 6.e
|
||||
}
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.forEach/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.forEach/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.forEach/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.forEach/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.forEach === 'function'
|
||||
? Iterator.prototype.forEach
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.forEach/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.forEach/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeForEach() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ forEach: polyfill },
|
||||
{ forEach: function () { return $IteratorPrototype.forEach !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.map/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.map/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
76
node_modules/es-iterator-helpers/Iterator.prototype.map/implementation.js
generated
vendored
Normal file
76
node_modules/es-iterator-helpers/Iterator.prototype.map/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIteratorFromClosure = require('../aos/CreateIteratorFromClosure');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var iterHelperProto = require('../IteratorHelperPrototype');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function map(mapper) {
|
||||
if (this instanceof map) {
|
||||
throw new $TypeError('`map` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(mapper)) {
|
||||
throw new $TypeError('`mapper` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var closeIfAbrupt = function (abruptCompletion) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('`abruptCompletion` must be a Completion Record');
|
||||
}
|
||||
IteratorClose(
|
||||
iterated,
|
||||
abruptCompletion
|
||||
);
|
||||
};
|
||||
|
||||
var sentinel = {};
|
||||
var counter = 0; // step 6.a
|
||||
var closure = function () {
|
||||
// while (true) { // step 6.b
|
||||
var value = IteratorStepValue(iterated); // step 6.b.i
|
||||
if (iterated['[[Done]]']) {
|
||||
return sentinel; // step 6.b.ii
|
||||
}
|
||||
|
||||
var mapped;
|
||||
try {
|
||||
mapped = Call(mapper, void undefined, [value, counter]); // step 6.b.iii
|
||||
// yield mapped // step 6.b.vi
|
||||
return mapped;
|
||||
} catch (e) {
|
||||
// close iterator // step 6.b.v, 6.b.vii
|
||||
closeIfAbrupt(ThrowCompletion(e));
|
||||
throw e;
|
||||
} finally {
|
||||
counter += 1; // step 6.b.viii
|
||||
}
|
||||
// }
|
||||
};
|
||||
SLOT.set(closure, '[[Sentinel]]', sentinel); // for the userland implementation
|
||||
SLOT.set(closure, '[[CloseIfAbrupt]]', closeIfAbrupt); // for the userland implementation
|
||||
|
||||
var result = CreateIteratorFromClosure(closure, 'Iterator Helper', iterHelperProto, ['[[UnderlyingIterator]]']); // step 7
|
||||
|
||||
SLOT.set(result, '[[UnderlyingIterator]]', iterated); // step 8
|
||||
|
||||
return result; // step 9
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.map/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.map/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
15
node_modules/es-iterator-helpers/Iterator.prototype.map/polyfill.js
generated
vendored
Normal file
15
node_modules/es-iterator-helpers/Iterator.prototype.map/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (typeof Iterator === 'function' && typeof Iterator.prototype.map === 'function') {
|
||||
try {
|
||||
// https://issues.chromium.org/issues/336839115
|
||||
Iterator.prototype.map.call({ next: null }, function () {}).next();
|
||||
} catch (e) {
|
||||
return Iterator.prototype.map;
|
||||
}
|
||||
}
|
||||
return implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.map/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.map/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeMap() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ map: polyfill },
|
||||
{ map: function () { return $IteratorPrototype.map !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.reduce/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.reduce/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
60
node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js
generated
vendored
Normal file
60
node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function reduce(reducer) {
|
||||
if (this instanceof reduce) {
|
||||
throw new $TypeError('`reduce` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(reducer)) {
|
||||
throw new $TypeError('`reducer` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var accumulator;
|
||||
var counter;
|
||||
if (arguments.length < 2) { // step 6
|
||||
accumulator = IteratorStepValue(iterated); // step 6.a
|
||||
if (iterated['[[Done]]']) {
|
||||
throw new $TypeError('Reduce of empty iterator with no initial value');
|
||||
}
|
||||
counter = 1;
|
||||
} else { // step 7
|
||||
accumulator = arguments[1]; // step 7.a
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 8
|
||||
var value = IteratorStepValue(iterated); // step 8.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return accumulator; // step 8.b
|
||||
}
|
||||
try {
|
||||
var result = Call(reducer, void undefined, [accumulator, value, counter]); // step 8.d
|
||||
accumulator = result; // step 8.f
|
||||
} catch (e) {
|
||||
// close iterator // step 8.e
|
||||
IteratorClose(
|
||||
iterated,
|
||||
ThrowCompletion(e)
|
||||
);
|
||||
}
|
||||
counter += 1; // step 8.g
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.reduce/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.reduce/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.reduce === 'function'
|
||||
? Iterator.prototype.reduce
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeReduce() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ reduce: polyfill },
|
||||
{ reduce: function () { return $IteratorPrototype.reduce !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.some/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.some/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
58
node_modules/es-iterator-helpers/Iterator.prototype.some/implementation.js
generated
vendored
Normal file
58
node_modules/es-iterator-helpers/Iterator.prototype.some/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
var ThrowCompletion = require('es-abstract/2024/ThrowCompletion');
|
||||
var ToBoolean = require('es-abstract/2024/ToBoolean');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function some(predicate) {
|
||||
if (this instanceof some) {
|
||||
throw new $TypeError('`some` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
if (!IsCallable(predicate)) {
|
||||
throw new $TypeError('`predicate` must be a function'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var counter = 0; // step 5
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 6
|
||||
var value = IteratorStepValue(iterated); // step 6.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return false; // step 6.b
|
||||
}
|
||||
var result;
|
||||
try {
|
||||
result = Call(predicate, void undefined, [value, counter]); // step 6.c
|
||||
} catch (e) {
|
||||
// close iterator // step 6.d
|
||||
IteratorClose(
|
||||
iterated,
|
||||
ThrowCompletion(e)
|
||||
);
|
||||
} finally {
|
||||
counter += 1; // step 6.f
|
||||
}
|
||||
if (ToBoolean(result)) {
|
||||
return IteratorClose(
|
||||
iterated,
|
||||
NormalCompletion(true)
|
||||
); // step 6.e
|
||||
}
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.some/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.some/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.some/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.some/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.some === 'function'
|
||||
? Iterator.prototype.some
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.some/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.some/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeSome() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ some: polyfill },
|
||||
{ some: function () { return $IteratorPrototype.some !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.take/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.take/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
84
node_modules/es-iterator-helpers/Iterator.prototype.take/implementation.js
generated
vendored
Normal file
84
node_modules/es-iterator-helpers/Iterator.prototype.take/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
'use strict';
|
||||
|
||||
var $RangeError = require('es-errors/range');
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIteratorFromClosure = require('../aos/CreateIteratorFromClosure');
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity');
|
||||
var ToNumber = require('es-abstract/2024/ToNumber');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var iterHelperProto = require('../IteratorHelperPrototype');
|
||||
|
||||
var isNaN = require('es-abstract/helpers/isNaN');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function take(limit) {
|
||||
if (this instanceof take) {
|
||||
throw new $TypeError('`take` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
var numLimit = ToNumber(limit); // step 2
|
||||
if (isNaN(numLimit)) {
|
||||
throw new $RangeError('`limit` must be a non-NaN number'); // step 3
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 4
|
||||
|
||||
var integerLimit = ToIntegerOrInfinity(numLimit); // step 7
|
||||
if (integerLimit < 0) {
|
||||
throw new $RangeError('`limit` must be a >= 0'); // step 8
|
||||
}
|
||||
|
||||
var closeIfAbrupt = function (abruptCompletion) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('`abruptCompletion` must be a Completion Record');
|
||||
}
|
||||
IteratorClose(
|
||||
iterated,
|
||||
abruptCompletion
|
||||
);
|
||||
};
|
||||
|
||||
var sentinel = {};
|
||||
var remaining = integerLimit; // step 9.a
|
||||
var closure = function () { // step 9
|
||||
// while (true) { // step 9.b
|
||||
if (remaining === 0) { // step 9.b.i
|
||||
return IteratorClose( // step 9.b.i.1
|
||||
iterated,
|
||||
NormalCompletion(sentinel)
|
||||
);
|
||||
}
|
||||
if (remaining !== Infinity) { // step 9.b.ii
|
||||
remaining -= 1; // step 9.b.ii.1
|
||||
}
|
||||
|
||||
var value = IteratorStepValue(iterated); // step 6.b.i
|
||||
if (iterated['[[Done]]']) {
|
||||
return sentinel; // step 6.b.ii
|
||||
}
|
||||
|
||||
return value; // step 9.b.iv
|
||||
// }
|
||||
};
|
||||
SLOT.set(closure, '[[Sentinel]]', sentinel); // for the userland implementation
|
||||
SLOT.set(closure, '[[CloseIfAbrupt]]', closeIfAbrupt); // for the userland implementation
|
||||
|
||||
var result = CreateIteratorFromClosure(closure, 'Iterator Helper', iterHelperProto, ['[[UnderlyingIterator]]']); // step 7
|
||||
|
||||
SLOT.set(result, '[[UnderlyingIterator]]', iterated); // step 8
|
||||
|
||||
return result; // step 9
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.take/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.take/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.take/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.take/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.take === 'function'
|
||||
? Iterator.prototype.take
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.take/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.take/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeTake() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ take: polyfill },
|
||||
{ take: function () { return $IteratorPrototype.take !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype.toArray/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype.toArray/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
36
node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js
generated
vendored
Normal file
36
node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var GetIteratorDirect = require('../aos/GetIteratorDirect');
|
||||
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $push = callBound('Array.prototype.push');
|
||||
|
||||
module.exports = function toArray() {
|
||||
if (this instanceof toArray) {
|
||||
throw new $TypeError('`toArray` is not a constructor');
|
||||
}
|
||||
|
||||
var O = this; // step 1
|
||||
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('`this` value must be an Object'); // step 2
|
||||
}
|
||||
|
||||
var iterated = GetIteratorDirect(O); // step 3
|
||||
|
||||
var items = []; // step 4
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { // step 5
|
||||
var value = IteratorStepValue(iterated); // step 5.a
|
||||
if (iterated['[[Done]]']) {
|
||||
return items; // step 5.b
|
||||
}
|
||||
$push(items, value); // step 5.d
|
||||
}
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.toArray/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.toArray/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js
generated
vendored
Normal file
9
node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof Iterator === 'function' && typeof Iterator.prototype.toArray === 'function'
|
||||
? Iterator.prototype.toArray
|
||||
: implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
var $IteratorPrototype = require('../Iterator.prototype/implementation');
|
||||
|
||||
module.exports = function shimIteratorPrototypeToArray() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
$IteratorPrototype,
|
||||
{ toArray: polyfill },
|
||||
{ toArray: function () { return $IteratorPrototype.toArray !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
3
node_modules/es-iterator-helpers/Iterator.prototype/implementation.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator.prototype/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('iterator.prototype');
|
||||
12
node_modules/es-iterator-helpers/Iterator.prototype/index.js
generated
vendored
Normal file
12
node_modules/es-iterator-helpers/Iterator.prototype/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
module.exports = {
|
||||
__proto__: getPolyfill(),
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
};
|
||||
7
node_modules/es-iterator-helpers/Iterator.prototype/polyfill.js
generated
vendored
Normal file
7
node_modules/es-iterator-helpers/Iterator.prototype/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return implementation;
|
||||
};
|
||||
20
node_modules/es-iterator-helpers/Iterator.prototype/shim.js
generated
vendored
Normal file
20
node_modules/es-iterator-helpers/Iterator.prototype/shim.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
var define = require('define-properties');
|
||||
|
||||
var getIteratorPolyfill = require('../Iterator/polyfill');
|
||||
|
||||
module.exports = function shimIteratorFrom() {
|
||||
var $Iterator = getIteratorPolyfill();
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
$Iterator,
|
||||
{ prototype: polyfill },
|
||||
{ prototype: function () { return $Iterator.prototype !== polyfill; } }
|
||||
);
|
||||
|
||||
// TODO: install Symbol.toStringTag if needed, once https://bugs.chromium.org/p/chromium/issues/detail?id=1477372 is fixed?
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/Iterator/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/Iterator/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
29
node_modules/es-iterator-helpers/Iterator/implementation.js
generated
vendored
Normal file
29
node_modules/es-iterator-helpers/Iterator/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
|
||||
|
||||
var iterProto = require('iterator.prototype');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $isPrototypeOf = callBound('Object.prototype.isPrototypeOf');
|
||||
|
||||
var $Iterator = typeof Iterator === 'function' ? Iterator : function Iterator() {
|
||||
if (
|
||||
!(this instanceof Iterator)
|
||||
|| this.constructor === Iterator
|
||||
|| !$isPrototypeOf(Iterator, this.constructor)
|
||||
) {
|
||||
throw new $TypeError('`Iterator` can not be called or constructed directly');
|
||||
}
|
||||
};
|
||||
|
||||
if ($Iterator.prototype !== iterProto) {
|
||||
$Iterator.prototype = iterProto;
|
||||
}
|
||||
$defineProperty($Iterator, 'prototype', { writable: false });
|
||||
|
||||
module.exports = $Iterator;
|
||||
18
node_modules/es-iterator-helpers/Iterator/index.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind(getPolyfill());
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
8
node_modules/es-iterator-helpers/Iterator/polyfill.js
generated
vendored
Normal file
8
node_modules/es-iterator-helpers/Iterator/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var globalThis = require('globalthis')();
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return typeof globalThis.Iterator === 'function' ? globalThis.Iterator : implementation;
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/Iterator/shim.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/Iterator/shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var globalThis = require('globalthis')();
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimIterator() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
globalThis,
|
||||
{ Iterator: polyfill },
|
||||
{ Iterator: function () { return Iterator !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
55
node_modules/es-iterator-helpers/IteratorHelperPrototype/index.js
generated
vendored
Normal file
55
node_modules/es-iterator-helpers/IteratorHelperPrototype/index.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
var setToStringTag = require('es-set-tostringtag');
|
||||
var hasProto = require('has-proto')();
|
||||
var iterProto = require('../Iterator.prototype/implementation');
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIterResultObject = require('es-abstract/2024/CreateIterResultObject');
|
||||
var GeneratorResume = require('../aos/GeneratorResume');
|
||||
var GeneratorResumeAbrupt = require('../aos/GeneratorResumeAbrupt');
|
||||
var IteratorClose = require('es-abstract/2024/IteratorClose');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
|
||||
var implementation;
|
||||
if (hasProto) {
|
||||
implementation = {
|
||||
__proto__: iterProto,
|
||||
next: function next() {
|
||||
return GeneratorResume(this, void undefined, 'Iterator Helper');
|
||||
},
|
||||
'return': function () {
|
||||
var O = this; // step 1
|
||||
|
||||
SLOT.assert(O, '[[UnderlyingIterator]]'); // step 2
|
||||
|
||||
SLOT.assert(O, '[[GeneratorState]]'); // step 3
|
||||
|
||||
if (SLOT.get(O, '[[GeneratorState]]') === 'suspendedStart') { // step 4
|
||||
SLOT.set(O, '[[GeneratorState]]', 'completed'); // step 4.a
|
||||
IteratorClose(SLOT.get(O, '[[UnderlyingIterator]]'), NormalCompletion('unused')); // step 4.c
|
||||
return CreateIterResultObject(void undefined, true); // step 4.d
|
||||
}
|
||||
|
||||
var C = new CompletionRecord('return', void undefined); // step 5
|
||||
|
||||
return GeneratorResumeAbrupt(O, C, 'Iterator Helper'); // step 6
|
||||
}
|
||||
};
|
||||
setToStringTag(implementation, 'Iterator Helper');
|
||||
} else {
|
||||
var IteratorHelper = function IteratorHelper() {};
|
||||
IteratorHelper.prototype = iterProto;
|
||||
implementation = new IteratorHelper();
|
||||
delete implementation.constructor;
|
||||
implementation.next = function next() {
|
||||
return GeneratorResume(this, void undefined, 'Iterator Helper');
|
||||
};
|
||||
implementation['return'] = function () {
|
||||
var C = new CompletionRecord('return', void undefined); // step 1
|
||||
return GeneratorResumeAbrupt(this, C, 'Iterator Helper');
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = implementation;
|
||||
21
node_modules/es-iterator-helpers/LICENSE
generated
vendored
Normal file
21
node_modules/es-iterator-helpers/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 ECMAScript Shims
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
93
node_modules/es-iterator-helpers/README.md
generated
vendored
Normal file
93
node_modules/es-iterator-helpers/README.md
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
# es-iterator-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
An ESnext spec-compliant sync iterator helpers shim/polyfill/replacement that works as far down as ES3.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) “multi” interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-additional-properties-of-the-string.prototype-object).
|
||||
|
||||
Because the `Iterator.prototype` methods depend on a receiver (the `this` value), the main export in each subdirectory takes the string to operate on as the first argument.
|
||||
|
||||
The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.
|
||||
|
||||
## Supported things
|
||||
|
||||
- [`Iterator` constructor](https://tc39.es/proposal-iterator-helpers/#sec-iterator-constructor)
|
||||
- [`Iterator.prototype`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.prototype)
|
||||
- [`Iterator.from`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.from)
|
||||
- [`Iterator.prototype.constructor`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.constructor)
|
||||
- [`Iterator.prototype.drop`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.drop)
|
||||
- [`Iterator.prototype.every`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.every)
|
||||
- [`Iterator.prototype.filter`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.filter)
|
||||
- [`Iterator.prototype.find`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.find)
|
||||
- [`Iterator.prototype.flatMap`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.flatmap)
|
||||
- [`Iterator.prototype.forEach`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.foreach)
|
||||
- [`Iterator.prototype.map`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.map)
|
||||
- [`Iterator.prototype.reduce`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.reduce)
|
||||
- [`Iterator.prototype.some`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.some)
|
||||
- [`Iterator.prototype.take`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.take)
|
||||
- [`Iterator.prototype.toArray`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.toarray)
|
||||
|
||||
## Environments where this is needed
|
||||
|
||||
- node v22, Chrome >= v122: has a [bug](https://issues.chromium.org/issues/336839115)
|
||||
- node < v22, Chrome < v122, Safari <= v17.1, Firefox <= v125: not implemented
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save es-iterator-helpers
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
const map = require('es-iterator-helpers/Iterator.prototype.map');
|
||||
const toArray = require('es-iterator-helpers/Iterator.prototype.toArray');
|
||||
const assert = require('assert');
|
||||
|
||||
const iterator = [1, 2, 3].values();
|
||||
|
||||
const mapped = map(iterator, (x) => x + 10);
|
||||
assert.deepEqual(
|
||||
mapped.next(),
|
||||
{
|
||||
done: false,
|
||||
value: 11,
|
||||
}
|
||||
);
|
||||
assert.deepEqual(
|
||||
toArray(mapped),
|
||||
[12, 13]
|
||||
);
|
||||
```
|
||||
|
||||
```js
|
||||
require('./auto'); // shim all of the methods
|
||||
|
||||
require('./Iterator.prototype.map/auto'); // shim the “map” method
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/es-iterator-helpers
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/iterator-helpers.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/iterator-helpers.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/iterator-helpers
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/iterator-helpers/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/iterator-helpers#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/es-iterator-helpers.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/es-iterator-helpers.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/es-iterator-helpers.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=es-iterator-helpers
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/iterator-helpers/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/iterator-helpers/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/iterator-helpers
|
||||
[actions-url]: https://github.com/es-shims/iterator-helpers/actions
|
||||
46
node_modules/es-iterator-helpers/WrapForValidIteratorPrototype/index.js
generated
vendored
Normal file
46
node_modules/es-iterator-helpers/WrapForValidIteratorPrototype/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var CreateIterResultObject = require('es-abstract/2024/CreateIterResultObject');
|
||||
var GetMethod = require('es-abstract/2024/GetMethod');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
var iterProto = require('../Iterator.prototype/implementation');
|
||||
|
||||
// https://tc39.es/proposal-iterator-helpers/#sec-wrapforvaliditeratorprototype-object
|
||||
|
||||
module.exports = /* GetIntrinsic('%WrapForValidIteratorPrototype%', true) || */ {
|
||||
__proto__: iterProto,
|
||||
next: function next() {
|
||||
var O = this; // step 1
|
||||
|
||||
// RequireInternalSlot(O, [[Iterated]]); // step 2
|
||||
SLOT.assert(O, '[[Iterated]]');
|
||||
|
||||
var iteratorRecord = SLOT.get(O, '[[Iterated]]'); // step 3
|
||||
|
||||
return Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]']); // step 4
|
||||
},
|
||||
'return': function () {
|
||||
var O = this; // step 1
|
||||
|
||||
// RequireInternalSlot(O, [[Iterated]]); // step 2
|
||||
SLOT.assert(O, '[[Iterated]]');
|
||||
|
||||
var iterator = SLOT.get(O, '[[Iterated]]')['[[Iterator]]']; // step 3
|
||||
|
||||
if (Type(iterator) !== 'Object') {
|
||||
throw new $TypeError('iterator must be an Object'); // step 4
|
||||
}
|
||||
|
||||
var returnMethod = GetMethod(iterator, 'return'); // step 5
|
||||
|
||||
if (typeof returnMethod === 'undefined') { // step 6
|
||||
return CreateIterResultObject(undefined, true); // step 6.a
|
||||
}
|
||||
return Call(returnMethod, iterator); // step 7
|
||||
}
|
||||
};
|
||||
45
node_modules/es-iterator-helpers/aos/CreateIteratorFromClosure.js
generated
vendored
Normal file
45
node_modules/es-iterator-helpers/aos/CreateIteratorFromClosure.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var GeneratorStart = require('./GeneratorStart');
|
||||
var IsArray = require('es-abstract/2024/IsArray');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var OrdinaryObjectCreate = require('es-abstract/2024/OrdinaryObjectCreate');
|
||||
|
||||
var every = require('es-abstract/helpers/every');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
var safeConcat = require('safe-array-concat');
|
||||
|
||||
var isString = function isString(slot) {
|
||||
return typeof slot === 'string';
|
||||
};
|
||||
|
||||
module.exports = function CreateIteratorFromClosure(closure, generatorBrand, proto) {
|
||||
if (!IsCallable(closure)) {
|
||||
throw new $TypeError('`closure` must be a function');
|
||||
}
|
||||
if (typeof generatorBrand !== 'string') {
|
||||
throw new $TypeError('`generatorBrand` must be a string');
|
||||
}
|
||||
var extraSlots = arguments.length > 3 ? arguments[3] : [];
|
||||
if (arguments.length > 3) {
|
||||
if (!IsArray(extraSlots) || !every(extraSlots, isString)) {
|
||||
throw new $TypeError('`extraSlots` must be a List of String internal slot names');
|
||||
}
|
||||
}
|
||||
var internalSlotsList = safeConcat(extraSlots, ['[[GeneratorContext]]', '[[GeneratorBrand]]', '[[GeneratorState]]']); // step 3
|
||||
var generator = OrdinaryObjectCreate(proto, internalSlotsList); // steps 4, 6
|
||||
SLOT.set(generator, '[[GeneratorBrand]]', generatorBrand); // step 5
|
||||
|
||||
SLOT.assert(closure, '[[Sentinel]]'); // our userland slot
|
||||
SLOT.set(generator, '[[Sentinel]]', SLOT.get(closure, '[[Sentinel]]')); // our userland slot
|
||||
SLOT.assert(closure, '[[CloseIfAbrupt]]'); // our second userland slot
|
||||
SLOT.set(generator, '[[CloseIfAbrupt]]', SLOT.get(closure, '[[CloseIfAbrupt]]')); // our second userland slot
|
||||
|
||||
GeneratorStart(generator, closure); // step 13
|
||||
|
||||
return generator; // step 15
|
||||
};
|
||||
27
node_modules/es-iterator-helpers/aos/GeneratorResume.js
generated
vendored
Normal file
27
node_modules/es-iterator-helpers/aos/GeneratorResume.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var CreateIterResultObject = require('es-abstract/2024/CreateIterResultObject');
|
||||
var GeneratorValidate = require('./GeneratorValidate');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function GeneratorResume(generator, value, generatorBrand) {
|
||||
var state = GeneratorValidate(generator, generatorBrand); // step 1
|
||||
if (state === 'completed') {
|
||||
return CreateIterResultObject(void undefined, true); // step 2
|
||||
}
|
||||
|
||||
if (state !== 'suspendedStart' && state !== 'suspendedYield') {
|
||||
throw new $TypeError('Assertion failed: generator state is unexpected: ' + state); // step 3
|
||||
}
|
||||
|
||||
var genContext = SLOT.get(generator, '[[GeneratorContext]]');
|
||||
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'executing'); // step 7
|
||||
|
||||
var result = genContext(value); // steps 5-6, 8-10
|
||||
|
||||
return result;
|
||||
};
|
||||
46
node_modules/es-iterator-helpers/aos/GeneratorResumeAbrupt.js
generated
vendored
Normal file
46
node_modules/es-iterator-helpers/aos/GeneratorResumeAbrupt.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var CompletionRecord = require('es-abstract/2024/CompletionRecord');
|
||||
var CreateIterResultObject = require('es-abstract/2024/CreateIterResultObject');
|
||||
var GeneratorValidate = require('./GeneratorValidate');
|
||||
var NormalCompletion = require('es-abstract/2024/NormalCompletion');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function GeneratorResumeAbrupt(generator, abruptCompletion, generatorBrand) {
|
||||
if (!(abruptCompletion instanceof CompletionRecord)) {
|
||||
throw new $TypeError('Assertion failed: abruptCompletion must be a Completion Record');
|
||||
}
|
||||
|
||||
var state = GeneratorValidate(generator, generatorBrand); // step 1
|
||||
|
||||
if (state === 'suspendedStart') { // step 2
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'completed'); // step 3.a
|
||||
SLOT.set(generator, '[[GeneratorContext]]', null); // step 3.b
|
||||
state = 'completed'; // step 3.c
|
||||
}
|
||||
|
||||
var value = abruptCompletion.value();
|
||||
|
||||
if (state === 'completed') { // step 3
|
||||
return CreateIterResultObject(value, true); // steps 3.a-b
|
||||
}
|
||||
|
||||
if (state !== 'suspendedYield') {
|
||||
throw new $TypeError('Assertion failed: generator state is unexpected: ' + state); // step 4
|
||||
}
|
||||
if (abruptCompletion.type() === 'return') {
|
||||
// due to representing `GeneratorContext` as a function, we can't safely re-invoke it, so we can't support sending it a return completion
|
||||
return CreateIterResultObject(SLOT.get(generator, '[[CloseIfAbrupt]]')(NormalCompletion(abruptCompletion.value())), true);
|
||||
}
|
||||
|
||||
var genContext = SLOT.get(generator, '[[GeneratorContext]]'); // step 5
|
||||
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'executing'); // step 8
|
||||
|
||||
var result = genContext(value); // steps 6-7, 8-11
|
||||
|
||||
return result; // step 12
|
||||
};
|
||||
44
node_modules/es-iterator-helpers/aos/GeneratorStart.js
generated
vendored
Normal file
44
node_modules/es-iterator-helpers/aos/GeneratorStart.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var CreateIterResultObject = require('es-abstract/2024/CreateIterResultObject');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function GeneratorStart(generator, closure) {
|
||||
SLOT.assert(generator, '[[GeneratorState]]');
|
||||
SLOT.assert(generator, '[[GeneratorContext]]');
|
||||
SLOT.assert(generator, '[[GeneratorBrand]]');
|
||||
SLOT.assert(generator, '[[Sentinel]]'); // our userland slot
|
||||
SLOT.assert(generator, '[[CloseIfAbrupt]]'); // our second userland slot
|
||||
|
||||
if (!IsCallable(closure) || closure.length !== 0) {
|
||||
throw new $TypeError('`closure` must be a function that takes no arguments');
|
||||
}
|
||||
|
||||
var sentinel = SLOT.get(closure, '[[Sentinel]]');
|
||||
if (Type(sentinel) !== 'Object') {
|
||||
throw new $TypeError('`closure.[[Sentinel]]` must be an object');
|
||||
}
|
||||
SLOT.set(generator, '[[GeneratorContext]]', function () { // steps 2-5
|
||||
try {
|
||||
var result = closure();
|
||||
if (result === sentinel) {
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'completed');
|
||||
SLOT.set(generator, '[[GeneratorContext]]', null);
|
||||
return CreateIterResultObject(void undefined, true);
|
||||
}
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'suspendedYield');
|
||||
return CreateIterResultObject(result, false);
|
||||
} catch (e) {
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'completed');
|
||||
SLOT.set(generator, '[[GeneratorContext]]', null);
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
SLOT.set(generator, '[[GeneratorState]]', 'suspendedStart'); // step 6
|
||||
};
|
||||
22
node_modules/es-iterator-helpers/aos/GeneratorValidate.js
generated
vendored
Normal file
22
node_modules/es-iterator-helpers/aos/GeneratorValidate.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
module.exports = function GeneratorValidate(generator, generatorBrand) {
|
||||
SLOT.assert(generator, '[[GeneratorState]]'); // step 1
|
||||
SLOT.assert(generator, '[[GeneratorBrand]]'); // step 2
|
||||
|
||||
var brand = SLOT.get(generator, '[[GeneratorBrand]]');
|
||||
if (brand !== generatorBrand) {
|
||||
throw new $TypeError('Assertion failed: generator brand is unexpected: ' + brand);
|
||||
}
|
||||
SLOT.assert(generator, '[[GeneratorContext]]'); // step 4
|
||||
var state = SLOT.get(generator, '[[GeneratorState]]'); // step 5
|
||||
if (state === 'executing') {
|
||||
throw new $TypeError('generator is executing');
|
||||
}
|
||||
|
||||
return state; // step 7
|
||||
};
|
||||
18
node_modules/es-iterator-helpers/aos/GetIteratorDirect.js
generated
vendored
Normal file
18
node_modules/es-iterator-helpers/aos/GetIteratorDirect.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var Get = require('es-abstract/2024/Get');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
module.exports = function GetIteratorDirect(obj) {
|
||||
if (Type(obj) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: `obj` must be an Object');
|
||||
}
|
||||
|
||||
var nextMethod = Get(obj, 'next'); // step 2
|
||||
|
||||
var iteratorRecord = { '[[Iterator]]': obj, '[[NextMethod]]': nextMethod, '[[Done]]': false }; // step 3
|
||||
|
||||
return iteratorRecord; // step 4
|
||||
};
|
||||
44
node_modules/es-iterator-helpers/aos/GetIteratorFlattenable.js
generated
vendored
Normal file
44
node_modules/es-iterator-helpers/aos/GetIteratorFlattenable.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var AdvanceStringIndex = require('es-abstract/2024/AdvanceStringIndex');
|
||||
var Call = require('es-abstract/2024/Call');
|
||||
var GetIteratorDirect = require('./GetIteratorDirect');
|
||||
var GetMethod = require('es-abstract/2024/GetMethod');
|
||||
var IsArray = require('es-abstract/2024/IsArray');
|
||||
var Type = require('es-abstract/2024/Type');
|
||||
|
||||
var getIteratorMethod = require('es-abstract/helpers/getIteratorMethod');
|
||||
|
||||
module.exports = function GetIteratorFlattenable(obj, stringHandling) {
|
||||
if (Type(obj) !== 'Object') {
|
||||
if (stringHandling === 'reject-strings' || typeof obj !== 'string') {
|
||||
throw new $TypeError('obj must be an Object'); // step 1.a
|
||||
}
|
||||
}
|
||||
|
||||
var method = void undefined; // step 2
|
||||
|
||||
// method = GetMethod(obj, Symbol.iterator); // step 5.a
|
||||
method = getIteratorMethod(
|
||||
{
|
||||
AdvanceStringIndex: AdvanceStringIndex,
|
||||
GetMethod: GetMethod,
|
||||
IsArray: IsArray
|
||||
},
|
||||
obj
|
||||
);
|
||||
|
||||
var iterator;
|
||||
if (typeof method === 'undefined') { // step 3
|
||||
iterator = obj; // step 3.a
|
||||
} else { // step 4
|
||||
iterator = Call(method, obj); // step 4.a
|
||||
}
|
||||
|
||||
if (Type(iterator) !== 'Object') {
|
||||
throw new $TypeError('iterator must be an Object'); // step 5
|
||||
}
|
||||
return GetIteratorDirect(iterator); // step 6
|
||||
};
|
||||
3
node_modules/es-iterator-helpers/auto.js
generated
vendored
Normal file
3
node_modules/es-iterator-helpers/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
17
node_modules/es-iterator-helpers/index.json
generated
vendored
Normal file
17
node_modules/es-iterator-helpers/index.json
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
"Iterator",
|
||||
"Iterator.from",
|
||||
"Iterator.prototype",
|
||||
"Iterator.prototype.constructor",
|
||||
"Iterator.prototype.drop",
|
||||
"Iterator.prototype.every",
|
||||
"Iterator.prototype.filter",
|
||||
"Iterator.prototype.find",
|
||||
"Iterator.prototype.flatMap",
|
||||
"Iterator.prototype.forEach",
|
||||
"Iterator.prototype.map",
|
||||
"Iterator.prototype.reduce",
|
||||
"Iterator.prototype.some",
|
||||
"Iterator.prototype.take",
|
||||
"Iterator.prototype.toArray"
|
||||
]
|
||||
188
node_modules/es-iterator-helpers/package.json
generated
vendored
Normal file
188
node_modules/es-iterator-helpers/package.json
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"name": "es-iterator-helpers",
|
||||
"version": "1.0.19",
|
||||
"description": "An ESnext spec-compliant iterator helpers shim/polyfill/replacement that works as far down as ES3.",
|
||||
"main": "index.json",
|
||||
"exports": {
|
||||
".": "./index.json",
|
||||
"./auto": "./auto.js",
|
||||
"./shim": "./shim.js",
|
||||
"./Iterator": "./Iterator/index.js",
|
||||
"./Iterator/auto": "./Iterator/auto.js",
|
||||
"./Iterator/polyfill": "./Iterator/polyfill.js",
|
||||
"./Iterator/implementation": "./Iterator/implementation.js",
|
||||
"./Iterator/shim": "./Iterator/shim.js",
|
||||
"./Iterator.prototype": "./Iterator.prototype/index.js",
|
||||
"./Iterator.prototype/auto": "./Iterator.prototype/auto.js",
|
||||
"./Iterator.prototype/polyfill": "./Iterator.prototype/polyfill.js",
|
||||
"./Iterator.prototype/implementation": "./Iterator.prototype/implementation.js",
|
||||
"./Iterator.prototype/shim": "./Iterator.prototype/shim.js",
|
||||
"./Iterator.from": "./Iterator.from/index.js",
|
||||
"./Iterator.from/auto": "./Iterator.from/auto.js",
|
||||
"./Iterator.from/polyfill": "./Iterator.from/polyfill.js",
|
||||
"./Iterator.from/implementation": "./Iterator.from/implementation.js",
|
||||
"./Iterator.from/shim": "./Iterator.from/shim.js",
|
||||
"./Iterator.prototype.constructor": "./Iterator.prototype.constructor/index.js",
|
||||
"./Iterator.prototype.constructor/auto": "./Iterator.prototype.constructor/auto.js",
|
||||
"./Iterator.prototype.constructor/polyfill": "./Iterator.prototype.constructor/polyfill.js",
|
||||
"./Iterator.prototype.constructor/implementation": "./Iterator.prototype.constructor/implementation.js",
|
||||
"./Iterator.prototype.constructor/shim": "./Iterator.prototype.constructor/shim.js",
|
||||
"./Iterator.prototype.map": "./Iterator.prototype.map/index.js",
|
||||
"./Iterator.prototype.map/auto": "./Iterator.prototype.map/auto.js",
|
||||
"./Iterator.prototype.map/polyfill": "./Iterator.prototype.map/polyfill.js",
|
||||
"./Iterator.prototype.map/implementation": "./Iterator.prototype.map/implementation.js",
|
||||
"./Iterator.prototype.map/shim": "./Iterator.prototype.map/shim.js",
|
||||
"./Iterator.prototype.filter": "./Iterator.prototype.filter/index.js",
|
||||
"./Iterator.prototype.filter/auto": "./Iterator.prototype.filter/auto.js",
|
||||
"./Iterator.prototype.filter/polyfill": "./Iterator.prototype.filter/polyfill.js",
|
||||
"./Iterator.prototype.filter/implementation": "./Iterator.prototype.filter/implementation.js",
|
||||
"./Iterator.prototype.filter/shim": "./Iterator.prototype.filter/shim.js",
|
||||
"./Iterator.prototype.take": "./Iterator.prototype.take/index.js",
|
||||
"./Iterator.prototype.take/auto": "./Iterator.prototype.take/auto.js",
|
||||
"./Iterator.prototype.take/polyfill": "./Iterator.prototype.take/polyfill.js",
|
||||
"./Iterator.prototype.take/implementation": "./Iterator.prototype.take/implementation.js",
|
||||
"./Iterator.prototype.take/shim": "./Iterator.prototype.take/shim.js",
|
||||
"./Iterator.prototype.drop": "./Iterator.prototype.drop/index.js",
|
||||
"./Iterator.prototype.drop/auto": "./Iterator.prototype.drop/auto.js",
|
||||
"./Iterator.prototype.drop/polyfill": "./Iterator.prototype.drop/polyfill.js",
|
||||
"./Iterator.prototype.drop/implementation": "./Iterator.prototype.drop/implementation.js",
|
||||
"./Iterator.prototype.drop/shim": "./Iterator.prototype.drop/shim.js",
|
||||
"./Iterator.prototype.flatMap": "./Iterator.prototype.flatMap/index.js",
|
||||
"./Iterator.prototype.flatMap/auto": "./Iterator.prototype.flatMap/auto.js",
|
||||
"./Iterator.prototype.flatMap/polyfill": "./Iterator.prototype.flatMap/polyfill.js",
|
||||
"./Iterator.prototype.flatMap/implementation": "./Iterator.prototype.flatMap/implementation.js",
|
||||
"./Iterator.prototype.flatMap/shim": "./Iterator.prototype.flatMap/shim.js",
|
||||
"./Iterator.prototype.reduce": "./Iterator.prototype.reduce/index.js",
|
||||
"./Iterator.prototype.reduce/auto": "./Iterator.prototype.reduce/auto.js",
|
||||
"./Iterator.prototype.reduce/polyfill": "./Iterator.prototype.reduce/polyfill.js",
|
||||
"./Iterator.prototype.reduce/implementation": "./Iterator.prototype.reduce/implementation.js",
|
||||
"./Iterator.prototype.reduce/shim": "./Iterator.prototype.reduce/shim.js",
|
||||
"./Iterator.prototype.toArray": "./Iterator.prototype.toArray/index.js",
|
||||
"./Iterator.prototype.toArray/auto": "./Iterator.prototype.toArray/auto.js",
|
||||
"./Iterator.prototype.toArray/polyfill": "./Iterator.prototype.toArray/polyfill.js",
|
||||
"./Iterator.prototype.toArray/implementation": "./Iterator.prototype.toArray/implementation.js",
|
||||
"./Iterator.prototype.toArray/shim": "./Iterator.prototype.toArray/shim.js",
|
||||
"./Iterator.prototype.forEach": "./Iterator.prototype.forEach/index.js",
|
||||
"./Iterator.prototype.forEach/auto": "./Iterator.prototype.forEach/auto.js",
|
||||
"./Iterator.prototype.forEach/polyfill": "./Iterator.prototype.forEach/polyfill.js",
|
||||
"./Iterator.prototype.forEach/implementation": "./Iterator.prototype.forEach/implementation.js",
|
||||
"./Iterator.prototype.forEach/shim": "./Iterator.prototype.forEach/shim.js",
|
||||
"./Iterator.prototype.some": "./Iterator.prototype.some/index.js",
|
||||
"./Iterator.prototype.some/auto": "./Iterator.prototype.some/auto.js",
|
||||
"./Iterator.prototype.some/polyfill": "./Iterator.prototype.some/polyfill.js",
|
||||
"./Iterator.prototype.some/implementation": "./Iterator.prototype.some/implementation.js",
|
||||
"./Iterator.prototype.some/shim": "./Iterator.prototype.some/shim.js",
|
||||
"./Iterator.prototype.every": "./Iterator.prototype.every/index.js",
|
||||
"./Iterator.prototype.every/auto": "./Iterator.prototype.every/auto.js",
|
||||
"./Iterator.prototype.every/polyfill": "./Iterator.prototype.every/polyfill.js",
|
||||
"./Iterator.prototype.every/implementation": "./Iterator.prototype.every/implementation.js",
|
||||
"./Iterator.prototype.every/shim": "./Iterator.prototype.every/shim.js",
|
||||
"./Iterator.prototype.find": "./Iterator.prototype.find/index.js",
|
||||
"./Iterator.prototype.find/auto": "./Iterator.prototype.find/auto.js",
|
||||
"./Iterator.prototype.find/polyfill": "./Iterator.prototype.find/polyfill.js",
|
||||
"./Iterator.prototype.find/implementation": "./Iterator.prototype.find/implementation.js",
|
||||
"./Iterator.prototype.find/shim": "./Iterator.prototype.find/shim.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prelint": "es-shim-api --bound --multi --ignore-dirs=WrapForValidIteratorPrototype,IteratorHelperPrototype",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "evalmd README.md",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es-shims/iterator-helpers.git"
|
||||
},
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"es-shims",
|
||||
"es-shim API",
|
||||
"Iterator",
|
||||
"helpers",
|
||||
"from",
|
||||
"map",
|
||||
"filter",
|
||||
"take",
|
||||
"drop",
|
||||
"flatMap",
|
||||
"reduce",
|
||||
"toArray",
|
||||
"forEach",
|
||||
"some",
|
||||
"every",
|
||||
"find"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/iterator-helpers/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/iterator-helpers#readme",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.7",
|
||||
"define-properties": "^1.2.1",
|
||||
"es-abstract": "^1.23.3",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-set-tostringtag": "^2.0.3",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-intrinsic": "^1.2.4",
|
||||
"globalthis": "^1.0.3",
|
||||
"has-property-descriptors": "^1.0.2",
|
||||
"has-proto": "^1.0.3",
|
||||
"has-symbols": "^1.0.3",
|
||||
"internal-slot": "^1.0.7",
|
||||
"iterator.prototype": "^1.1.2",
|
||||
"safe-array-concat": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.4.2",
|
||||
"@ljharb/eslint-config": "^21.1.0",
|
||||
"aud": "^2.0.4",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"in-publish": "^2.0.1",
|
||||
"iterate-iterator": "^1.0.2",
|
||||
"make-generator-function": "^2.0.0",
|
||||
"mock-property": "^1.0.3",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.13.1",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.7.5"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
}
|
||||
35
node_modules/es-iterator-helpers/shim.js
generated
vendored
Normal file
35
node_modules/es-iterator-helpers/shim.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var shimIterator = require('./Iterator/shim');
|
||||
var shimIteratorFrom = require('./Iterator.from/shim');
|
||||
var shimIteratorProto = require('./Iterator.prototype/shim');
|
||||
var shimIteratorCtor = require('./Iterator.prototype.constructor/shim');
|
||||
var shimIteratorDrop = require('./Iterator.prototype.drop/shim');
|
||||
var shimIteratorEvery = require('./Iterator.prototype.every/shim');
|
||||
var shimIteratorFilter = require('./Iterator.prototype.filter/shim');
|
||||
var shimIteratorFind = require('./Iterator.prototype.find/shim');
|
||||
var shimIteratorFlatMap = require('./Iterator.prototype.flatMap/shim');
|
||||
var shimIteratorForEach = require('./Iterator.prototype.forEach/shim');
|
||||
var shimIteratorMap = require('./Iterator.prototype.map/shim');
|
||||
var shimIteratorReduce = require('./Iterator.prototype.reduce/shim');
|
||||
var shimIteratorSome = require('./Iterator.prototype.some/shim');
|
||||
var shimIteratorTake = require('./Iterator.prototype.take/shim');
|
||||
var shimIteratorToArray = require('./Iterator.prototype.toArray/shim');
|
||||
|
||||
module.exports = function shimIteratorHelpers() {
|
||||
shimIterator();
|
||||
shimIteratorFrom();
|
||||
shimIteratorProto();
|
||||
shimIteratorCtor();
|
||||
shimIteratorDrop();
|
||||
shimIteratorEvery();
|
||||
shimIteratorFilter();
|
||||
shimIteratorFind();
|
||||
shimIteratorFlatMap();
|
||||
shimIteratorForEach();
|
||||
shimIteratorMap();
|
||||
shimIteratorReduce();
|
||||
shimIteratorSome();
|
||||
shimIteratorTake();
|
||||
shimIteratorToArray();
|
||||
};
|
||||
162
node_modules/es-iterator-helpers/test/Iterator.from.js
generated
vendored
Normal file
162
node_modules/es-iterator-helpers/test/Iterator.from.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
var callBind = require('call-bind');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var hasProto = require('has-proto')();
|
||||
var forEach = require('for-each');
|
||||
var debug = require('object-inspect');
|
||||
var v = require('es-value-fixtures');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var mockProperty = require('mock-property');
|
||||
|
||||
var index = require('../Iterator.from');
|
||||
var impl = require('../Iterator.from/implementation');
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var testIterator = require('./helpers/testIterator');
|
||||
|
||||
var $Iterator = require('../Iterator/implementation');
|
||||
var iterProto = require('iterator.prototype');
|
||||
|
||||
var getCodePoints = function getCodePoints(str) {
|
||||
var chars = [];
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c1 = str.charCodeAt(i);
|
||||
if (c1 >= 0xD800 && c1 < 0xDC00 && i + 1 < str.length) {
|
||||
var c2 = str.charCodeAt(i + 1);
|
||||
if (c2 >= 0xDC00 && c2 < 0xE000) {
|
||||
chars.push(str.charAt(i) + str.charAt(i + 1));
|
||||
i += 1;
|
||||
continue; // eslint-disable-line no-continue, no-restricted-syntax
|
||||
}
|
||||
}
|
||||
chars.push(str.charAt(i));
|
||||
}
|
||||
return chars;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
tests: function (from, name, t) {
|
||||
t['throws'](
|
||||
function () { return new from(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` itself is not a constructor'
|
||||
);
|
||||
t['throws'](
|
||||
function () { return new from({}); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` itself is not a constructor, with an argument'
|
||||
);
|
||||
|
||||
forEach(v.primitives.concat(v.objects), function (nonIterator) {
|
||||
if (typeof nonIterator !== 'string') {
|
||||
t['throws'](
|
||||
function () { from(nonIterator).next(); },
|
||||
TypeError,
|
||||
debug(nonIterator) + ' is not an iterable Object'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
t.test('actual iteration', { skip: !hasSymbols }, function (st) {
|
||||
forEach(v.nonFunctions, function (nonFunction) {
|
||||
var badIterable = {};
|
||||
badIterable[Symbol.iterator] = nonFunction;
|
||||
st['throws'](
|
||||
function () { from(badIterable).next(); },
|
||||
TypeError,
|
||||
debug(badIterable) + ' is not a function'
|
||||
);
|
||||
});
|
||||
|
||||
// st['throws'](
|
||||
// function () { return new from([]); }, // eslint-disable-line new-cap
|
||||
// RangeError,
|
||||
// '`' + name + '` iterator is not a constructor'
|
||||
// );
|
||||
|
||||
forEach(v.strings, function (string) {
|
||||
var stringIt = from(string);
|
||||
testIterator(stringIt, getCodePoints(string), st, 'string iterator: ' + debug(string));
|
||||
});
|
||||
|
||||
var arrayIt = from([1, 2, 3]);
|
||||
st.equal(typeof arrayIt.next, 'function', 'has a `next` function');
|
||||
|
||||
st.test('__proto__ is Iterator.prototype', { skip: !hasProto }, function (s2t) {
|
||||
var fakeIterator = {
|
||||
__proto__: iterProto,
|
||||
next: function () {}
|
||||
};
|
||||
s2t.ok(fakeIterator instanceof $Iterator, 'is an instanceof Iterator');
|
||||
s2t.equal(typeof fakeIterator.next, 'function', 'fake iterator `.next` is a function');
|
||||
s2t.equal(from(fakeIterator), fakeIterator, 'returns input when it is an instanceof Iterator');
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('real iterators', { skip: !hasSymbols }, function (s2t) {
|
||||
var iter = [][Symbol.iterator]();
|
||||
s2t.equal(from(iter), iter, 'array iterator becomes itself');
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('observability in a replaced String iterator', function (s2t) {
|
||||
var originalStringIterator = String.prototype[Symbol.iterator];
|
||||
var observedType;
|
||||
s2t.teardown(mockProperty(String.prototype, Symbol.iterator, {
|
||||
get: function () {
|
||||
'use strict'; // eslint-disable-line strict, lines-around-directive
|
||||
|
||||
observedType = typeof this;
|
||||
return originalStringIterator;
|
||||
}
|
||||
}));
|
||||
|
||||
from('');
|
||||
s2t.equal(observedType, 'string', 'string primitive -> primitive receiver in Symbol.iterator getter');
|
||||
from(Object(''));
|
||||
s2t.equal(observedType, 'object', 'boxed string -> boxed string in Symbol.iterator getter');
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator.from: index', function (t) {
|
||||
module.exports.tests(index, 'Iterator.from', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator.from: implementation', function (t) {
|
||||
module.exports.tests(impl, 'Iterator.from', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator.from: shimmed', function (t) {
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Iterator.from.name, 'from', 'Iterator.from has name "from"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Iterator, 'from'), 'Iterator.from is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
module.exports.tests(callBind(Iterator.from, Iterator), 'Iterator.from', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
95
node_modules/es-iterator-helpers/test/Iterator.js
generated
vendored
Normal file
95
node_modules/es-iterator-helpers/test/Iterator.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var index = require('../Iterator');
|
||||
var impl = require('../Iterator/implementation');
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
module.exports = {
|
||||
tests: function (Iter, name, t) {
|
||||
t.equal(typeof Iter, 'function', name + ' is a function');
|
||||
|
||||
t['throws'](
|
||||
function () { Iter(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
name + ' throws when Call-ed'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { return new Iter(); },
|
||||
TypeError,
|
||||
name + ' throws when Construct-ed'
|
||||
);
|
||||
|
||||
var SubIter;
|
||||
var SubSubIter;
|
||||
try {
|
||||
/* eslint no-new-func: 0 */
|
||||
SubIter = Function('Iter', 'return class SubIter extends Iter {};')(Iter);
|
||||
SubSubIter = Function('SubIter', 'return class SubSubIter extends SubIter {};')(SubIter);
|
||||
} catch (e) { /**/ }
|
||||
|
||||
t.test('class inheritance', { skip: !SubIter }, function (st) {
|
||||
st.doesNotThrow(
|
||||
function () { return new SubIter(); },
|
||||
'Extending ' + name + ' does not throw when Construct-ed'
|
||||
);
|
||||
st.doesNotThrow(
|
||||
function () { return new SubSubIter(); },
|
||||
'Extending ' + name + ' twice does not throw when Construct-ed'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator: index', function (t) {
|
||||
module.exports.tests(index, 'Iterator', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator: implementation', function (t) {
|
||||
module.exports.tests(impl, 'Iterator', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator: shimmed', function (t) {
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Iterator.name, 'Iterator', 'Iterator has name "Iterator"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(global, Iterator), 'Iterator is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('prototype descriptor', { skip: !defineProperties.supportsDescriptors }, function (pt) {
|
||||
var desc = Object.getOwnPropertyDescriptor(Iterator, 'prototype');
|
||||
pt.deepEqual(
|
||||
desc,
|
||||
{
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: Iterator.prototype,
|
||||
writable: false
|
||||
}
|
||||
);
|
||||
|
||||
pt.end();
|
||||
});
|
||||
|
||||
module.exports.tests(Iterator, 'Iterator', t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
57
node_modules/es-iterator-helpers/test/Iterator.prototype.constructor.js
generated
vendored
Normal file
57
node_modules/es-iterator-helpers/test/Iterator.prototype.constructor.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
|
||||
var Index = require('../Iterator.prototype.constructor');
|
||||
var Impl = require('../Iterator.prototype.constructor/implementation');
|
||||
|
||||
var $Iterator = require('../Iterator/polyfill')();
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
module.exports = {
|
||||
tests: function (t, constructor, name) {
|
||||
t.equal(constructor, $Iterator, name + ' is Iterator');
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator.prototype.constructor: index', function (t) {
|
||||
t.notEqual(Index, $Iterator, 'index is not Iterator itself');
|
||||
t.equal(typeof Index, 'function', 'index is a function');
|
||||
|
||||
t['throws'](
|
||||
function () { Index(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'index throws when Call-ed'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { return new Index(); },
|
||||
TypeError,
|
||||
'index throws when Construct-ed'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator.prototype.constructor: implementation', function (t) {
|
||||
t.equal(Impl, $Iterator, 'implementation is Iterator itself');
|
||||
module.exports.tests(t, Impl, 'Iterator.prototype.constructor');
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator.prototype.constructor: shimmed', function (t) {
|
||||
module.exports.tests(t, Iterator.prototype.constructor, 'Iterator.prototype.constructor');
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Iterator.prototype, 'constructor'), 'Iterator#constructor is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
294
node_modules/es-iterator-helpers/test/Iterator.prototype.drop.js
generated
vendored
Normal file
294
node_modules/es-iterator-helpers/test/Iterator.prototype.drop.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
var callBind = require('call-bind');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var forEach = require('for-each');
|
||||
var debug = require('object-inspect');
|
||||
var v = require('es-value-fixtures');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
var iterate = require('iterate-iterator');
|
||||
|
||||
var index = require('../Iterator.prototype.drop');
|
||||
var impl = require('../Iterator.prototype.drop/implementation');
|
||||
|
||||
var fnName = 'drop';
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var testIterator = require('./helpers/testIterator');
|
||||
|
||||
module.exports = {
|
||||
tests: function (drop, name, t) {
|
||||
t['throws'](
|
||||
function () { return new drop(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` itself is not a constructor'
|
||||
);
|
||||
|
||||
forEach(v.primitives.concat(v.objects), function (nonIterator) {
|
||||
t['throws'](
|
||||
function () { iterate(drop(nonIterator, 0)); },
|
||||
TypeError,
|
||||
debug(nonIterator) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
|
||||
var badNext = { next: nonIterator };
|
||||
t['throws'](
|
||||
function () { iterate(drop(badNext, 0)); },
|
||||
TypeError,
|
||||
debug(badNext) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('observable lookups', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var effects = [];
|
||||
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'next', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function next() {
|
||||
effects.push('get next');
|
||||
return function () {
|
||||
return { done: true, value: undefined };
|
||||
};
|
||||
}
|
||||
});
|
||||
drop(obj, {
|
||||
valueOf: function valueOf() {
|
||||
effects.push('ToNumber limit');
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
st.deepEqual(effects, [
|
||||
'ToNumber limit',
|
||||
'get next'
|
||||
]);
|
||||
st.end();
|
||||
});
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
|
||||
t.test('actual iteration', { skip: !hasSymbols }, function (st) {
|
||||
var iterator = callBind(arr[Symbol.iterator], arr);
|
||||
|
||||
st['throws'](
|
||||
function () { drop(iterator(), -3); },
|
||||
RangeError,
|
||||
'-3 is not >= 0'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { return new drop(iterator()); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
st['throws'](
|
||||
function () { return new drop(iterator(), 0); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
|
||||
testIterator(iterator(), [1, 2, 3], st, 'original');
|
||||
testIterator(drop(iterator(), 0), [1, 2, 3], st, 'drop 0');
|
||||
testIterator(drop(iterator(), 1), [2, 3], st, 'drop 1');
|
||||
testIterator(drop(iterator(), 2), [3], st, 'drop 2');
|
||||
testIterator(drop(iterator(), 3), [], st, 'drop 3');
|
||||
testIterator(drop(iterator(), Infinity), [], st, 'drop ∞');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/drop/get-return-method-throws', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var badIterator = {
|
||||
next: function next() {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(badIterator, 'return', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function () { throw new SyntaxError(); }
|
||||
});
|
||||
|
||||
var iter = drop(badIterator, 1);
|
||||
iter.next();
|
||||
|
||||
st['throws'](
|
||||
function () { iter['return'](); },
|
||||
SyntaxError,
|
||||
'gets the `return` method, whose getter throws'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/drop/return-is-forwarded', function (st) {
|
||||
var returnCount = 0;
|
||||
|
||||
var makeBadIterator = function makeBadIterator() {
|
||||
return {
|
||||
next: function next() {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
returnCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var iter1 = drop(makeBadIterator(), 0);
|
||||
st.equal(returnCount, 0, 'iter1, before return()');
|
||||
iter1['return']();
|
||||
st.equal(returnCount, 1, 'iter1, after return()');
|
||||
|
||||
var iter2 = drop(makeBadIterator(), 1);
|
||||
st.equal(returnCount, 1, 'iter2, before return()');
|
||||
iter2['return']();
|
||||
st.equal(returnCount, 2, 'iter2, after return()');
|
||||
|
||||
// 5 drops (i wish i had pipeline)
|
||||
var iter3 = drop(
|
||||
drop(
|
||||
drop(
|
||||
drop(
|
||||
drop(
|
||||
makeBadIterator(),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
);
|
||||
st.equal(returnCount, 2, 'iter3, before return()');
|
||||
iter3['return']();
|
||||
st.equal(returnCount, 3, 'iter3, after return()');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/drop/return-is-not-forwarded-after-exhaustion', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var makeBadIterator = function makeBadIterator() {
|
||||
return {
|
||||
next: function next() {
|
||||
return {
|
||||
done: true,
|
||||
value: undefined
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
throw new SyntaxError();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var iter1 = drop(makeBadIterator(), 0);
|
||||
st['throws'](
|
||||
function () { iter1['return'](); },
|
||||
SyntaxError,
|
||||
'iter1, return() throws'
|
||||
);
|
||||
iter1.next();
|
||||
iter1['return']();
|
||||
|
||||
var iter2 = drop(makeBadIterator(), 1);
|
||||
st['throws'](
|
||||
function () { iter2['return'](); },
|
||||
SyntaxError,
|
||||
'iter2, return() throws'
|
||||
);
|
||||
iter2.next();
|
||||
iter2['return']();
|
||||
|
||||
// 5 drops (i wish i had pipeline)
|
||||
var iter3 = drop(
|
||||
drop(
|
||||
drop(
|
||||
drop(
|
||||
drop(
|
||||
makeBadIterator(),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
),
|
||||
1
|
||||
);
|
||||
st['throws'](
|
||||
function () { iter3['return'](); },
|
||||
SyntaxError,
|
||||
'iter3, return() throws'
|
||||
);
|
||||
iter3.next();
|
||||
iter3['return']();
|
||||
|
||||
var iter4 = drop(makeBadIterator(), 10);
|
||||
st['throws'](
|
||||
function () { iter4['return'](); },
|
||||
SyntaxError,
|
||||
'iter4, return() throws'
|
||||
);
|
||||
iter4.next();
|
||||
iter4['return']();
|
||||
|
||||
st.end();
|
||||
});
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator.prototype.' + fnName + ': index', function (t) {
|
||||
module.exports.tests(index, 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator.prototype.' + fnName + ': implementation', function (t) {
|
||||
module.exports.tests(callBind(impl), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator.prototype.' + fnName + ': shimmed', function (t) {
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Iterator.prototype[fnName].name, fnName, 'Iterator#' + fnName + ' has name "' + fnName + '"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Iterator.prototype, fnName), 'Iterator#' + fnName + ' is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('bad string/this value', { skip: !hasStrictMode }, function (st) {
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(undefined, 'a'); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(null, 'a'); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
module.exports.tests(callBind(Iterator.prototype[fnName]), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
140
node_modules/es-iterator-helpers/test/Iterator.prototype.every.js
generated
vendored
Normal file
140
node_modules/es-iterator-helpers/test/Iterator.prototype.every.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
var callBind = require('call-bind');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var forEach = require('for-each');
|
||||
var debug = require('object-inspect');
|
||||
var v = require('es-value-fixtures');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
var iterate = require('iterate-iterator');
|
||||
|
||||
var index = require('../Iterator.prototype.every');
|
||||
var impl = require('../Iterator.prototype.every/implementation');
|
||||
|
||||
var fnName = 'every';
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var testIterator = require('./helpers/testIterator');
|
||||
|
||||
module.exports = {
|
||||
tests: function (every, name, t) {
|
||||
t['throws'](
|
||||
function () { return new every(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` is not a constructor'
|
||||
);
|
||||
|
||||
forEach(v.primitives.concat(v.objects), function (nonIterator) {
|
||||
t['throws'](
|
||||
function () { iterate(every(nonIterator, function () {})); },
|
||||
TypeError,
|
||||
debug(nonIterator) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
|
||||
var badNext = { next: nonIterator };
|
||||
t['throws'](
|
||||
function () { iterate(every(badNext, function () {})); },
|
||||
TypeError,
|
||||
debug(badNext) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
});
|
||||
|
||||
forEach(v.nonFunctions, function (nonFunction) {
|
||||
t['throws'](
|
||||
function () { every({ next: function () {} }, nonFunction); },
|
||||
TypeError,
|
||||
debug(nonFunction) + ' is not a function'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('observable lookups', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var effects = [];
|
||||
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'next', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function next() {
|
||||
effects.push('get next');
|
||||
return function () {
|
||||
return { done: true, value: undefined };
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
st['throws'](
|
||||
function () { every(obj, null); },
|
||||
TypeError
|
||||
);
|
||||
|
||||
st.deepEqual(effects, []);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('actual iteration', { skip: !hasSymbols }, function (st) {
|
||||
var arr = [1, 2, 3];
|
||||
var iterator = callBind(arr[Symbol.iterator], arr);
|
||||
|
||||
st['throws'](
|
||||
function () { return new every(iterator()); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
st['throws'](
|
||||
function () { return new every(iterator(), function () {}); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
|
||||
testIterator(iterator(), [1, 2, 3], st, 'original');
|
||||
st.equal(every(iterator(), function () { return false; }), false, 'every for always-false');
|
||||
st.equal(every(iterator(), function () { return true; }), true, 'every for always-true');
|
||||
st.equal(every(iterator(), function (x, i) { return x === 2 && i === 1; }), false, 'every returns false for matching value/index');
|
||||
|
||||
st.end();
|
||||
});
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator.prototype.' + fnName + ': index', function (t) {
|
||||
module.exports.tests(index, 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator.prototype.' + fnName + ': implementation', function (t) {
|
||||
module.exports.tests(callBind(impl), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator.prototype.' + fnName + ': shimmed', function (t) {
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Iterator.prototype[fnName].name, fnName, 'Iterator#' + fnName + ' has name "' + fnName + '"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Iterator.prototype, fnName), 'Iterator#' + fnName + ' is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('bad string/this value', { skip: !hasStrictMode }, function (st) {
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(undefined, 'a'); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(null, 'a'); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
module.exports.tests(callBind(Iterator.prototype[fnName]), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
334
node_modules/es-iterator-helpers/test/Iterator.prototype.filter.js
generated
vendored
Normal file
334
node_modules/es-iterator-helpers/test/Iterator.prototype.filter.js
generated
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var test = require('tape');
|
||||
var callBind = require('call-bind');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var forEach = require('for-each');
|
||||
var debug = require('object-inspect');
|
||||
var v = require('es-value-fixtures');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
var iterate = require('iterate-iterator');
|
||||
|
||||
var index = require('../Iterator.prototype.filter');
|
||||
var impl = require('../Iterator.prototype.filter/implementation');
|
||||
|
||||
var fnName = 'filter';
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var testIterator = require('./helpers/testIterator');
|
||||
|
||||
module.exports = {
|
||||
tests: function (filter, name, t) {
|
||||
t['throws'](
|
||||
function () { return new filter(); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` is not a constructor'
|
||||
);
|
||||
|
||||
forEach(v.primitives.concat(v.objects), function (nonIterator) {
|
||||
t['throws'](
|
||||
function () { iterate(filter(nonIterator, function () {})); },
|
||||
TypeError,
|
||||
debug(nonIterator) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
|
||||
var badNext = { next: nonIterator };
|
||||
t['throws'](
|
||||
function () { iterate(filter(badNext, function () {})); },
|
||||
TypeError,
|
||||
debug(badNext) + ' is not an Object with a callable `next` method'
|
||||
);
|
||||
});
|
||||
|
||||
forEach(v.nonFunctions, function (nonFunction) {
|
||||
t['throws'](
|
||||
function () { filter({ next: function () {} }, nonFunction); },
|
||||
TypeError,
|
||||
debug(nonFunction) + ' is not a function'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('observable lookups', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var effects = [];
|
||||
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'next', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function next() {
|
||||
effects.push('get next');
|
||||
return function () {
|
||||
return { done: true, value: undefined };
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
st['throws'](
|
||||
function () { filter(obj, null); },
|
||||
TypeError
|
||||
);
|
||||
|
||||
st.deepEqual(effects, []);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('actual iteration', { skip: !hasSymbols }, function (st) {
|
||||
var arr = [1, 2, 3];
|
||||
var iterator = callBind(arr[Symbol.iterator], arr);
|
||||
|
||||
st['throws'](
|
||||
function () { return new filter(iterator()); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
st['throws'](
|
||||
function () { return new filter(iterator(), function () {}); }, // eslint-disable-line new-cap
|
||||
TypeError,
|
||||
'`' + name + '` iterator is not a constructor'
|
||||
);
|
||||
|
||||
testIterator(iterator(), [1, 2, 3], st, 'original');
|
||||
testIterator(filter(iterator(), function () { return false; }), [], st, 'filter for always-false');
|
||||
testIterator(filter(iterator(), function () { return true; }), [1, 2, 3], st, 'filter for always-true');
|
||||
testIterator(filter(iterator(), function (x, i) { return x === 2 && i === 1; }), [2], st, 'filter returns value for matching value/index');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/filter/predicate-args', function (st) {
|
||||
var g = function g() {
|
||||
var arr = ['a', 'b', 'c'];
|
||||
var i = 0;
|
||||
return {
|
||||
next: function () {
|
||||
try {
|
||||
return {
|
||||
value: arr[i],
|
||||
done: i >= arr.length
|
||||
};
|
||||
} finally {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var assertionCount = 0;
|
||||
var iter = filter(
|
||||
g(),
|
||||
function (value, count) {
|
||||
if (value === 'a') {
|
||||
st.equal(count, 0, 'first iteration');
|
||||
} else if (value === 'b') {
|
||||
st.equal(count, 1, 'second iteration');
|
||||
} else if (value === 'c') {
|
||||
st.equal(count, 2, 'third iteration');
|
||||
} else {
|
||||
st.fail('unexpected iteration');
|
||||
}
|
||||
assertionCount += 1;
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
st.equal(assertionCount, 0, 'prior to iteration');
|
||||
|
||||
testIterator(iter, ['a', 'b', 'c'], st, 'iteration');
|
||||
|
||||
st.equal(assertionCount, 3);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/filter/predicate-throws', function (st) {
|
||||
var returnCalls = 0;
|
||||
|
||||
var iter = {
|
||||
next: function () {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
returnCalls += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
var callbackCalls = 0;
|
||||
var iterator = filter(iter, function () {
|
||||
callbackCalls += 1;
|
||||
throw new SyntaxError();
|
||||
});
|
||||
|
||||
st['throws'](function () { iterator.next(); }, SyntaxError, 'next() throws');
|
||||
|
||||
st.equal(callbackCalls, 1);
|
||||
st.equal(returnCalls, 1);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/filter/predicate-throws-then-closing-iterator-also-throws', function (st) {
|
||||
var iter = {
|
||||
next: function next() {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
throw new EvalError();
|
||||
}
|
||||
};
|
||||
|
||||
var iterator = filter(iter, function () {
|
||||
throw new SyntaxError();
|
||||
});
|
||||
|
||||
st['throws'](
|
||||
function () { iterator.next(); },
|
||||
SyntaxError,
|
||||
'when the predicate and return() both throw, the predicate’s exception wins'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/filter/get-return-method-throws', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var badIterator = {
|
||||
next: function next() {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(badIterator, 'return', { get: function () { throw new SyntaxError(); } });
|
||||
|
||||
var iter = filter(badIterator, function () { return true; });
|
||||
iter.next();
|
||||
|
||||
st['throws'](
|
||||
function () { iter['return'](); },
|
||||
SyntaxError,
|
||||
'gets the `return` method, whose getter throws'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/drop/return-is-forwarded', function (st) {
|
||||
var returnCount = 0;
|
||||
|
||||
var badIterator = {
|
||||
next: function next() {
|
||||
return {
|
||||
done: false,
|
||||
value: 1
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
returnCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
var iter1 = filter(badIterator, function () { return false; });
|
||||
st.equal(returnCount, 0, 'iter1, before return()');
|
||||
iter1['return']();
|
||||
st.equal(returnCount, 1, 'iter1, after return()');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('262: test/built-ins/Iterator/prototype/drop/return-is-not-forwarded-after-exhaustion', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var makeBadIterator = function makeBadIterator() {
|
||||
return {
|
||||
next: function next() {
|
||||
return {
|
||||
done: true,
|
||||
value: undefined
|
||||
};
|
||||
},
|
||||
'return': function () {
|
||||
throw new SyntaxError();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var iter1 = filter(makeBadIterator(), function () { return true; });
|
||||
st['throws'](
|
||||
function () { iter1['return'](); },
|
||||
SyntaxError,
|
||||
'iter1, return() throws'
|
||||
);
|
||||
iter1.next();
|
||||
iter1['return']();
|
||||
|
||||
// 3 filters (i wish i had pipeline)
|
||||
var iter2 = filter(
|
||||
filter(
|
||||
filter(
|
||||
makeBadIterator(),
|
||||
function () { return true; }
|
||||
),
|
||||
function () { return true; }
|
||||
),
|
||||
function () { return true; }
|
||||
);
|
||||
st['throws'](
|
||||
function () { iter2['return'](); },
|
||||
SyntaxError,
|
||||
'iter2, return() throws'
|
||||
);
|
||||
iter2.next();
|
||||
iter2['return']();
|
||||
|
||||
st.end();
|
||||
});
|
||||
},
|
||||
index: function () {
|
||||
test('Iterator.prototype.' + fnName + ': index', function (t) {
|
||||
module.exports.tests(index, 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
implementation: function () {
|
||||
test('Iterator.prototype.' + fnName + ': implementation', function (t) {
|
||||
module.exports.tests(callBind(impl), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
},
|
||||
shimmed: function () {
|
||||
test('Iterator.prototype.' + fnName + ': shimmed', function (t) {
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Iterator.prototype[fnName].name, fnName, 'Iterator#' + fnName + ' has name "' + fnName + '"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Iterator.prototype, fnName), 'Iterator#' + fnName + ' is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('bad string/this value', { skip: !hasStrictMode }, function (st) {
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(undefined, 'a'); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Iterator.prototype[fnName].call(null, 'a'); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
module.exports.tests(callBind(Iterator.prototype[fnName]), 'Iterator.prototype.' + fnName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user