pax_global_header00006660000000000000000000000064145177622130014522gustar00rootroot0000000000000052 comment=7cbd6b5e9e96cda050ae911c4015b0ecd9875f92 core-js-3.33.2/000077500000000000000000000000001451776221300131545ustar00rootroot00000000000000core-js-3.33.2/.gitattributes000066400000000000000000000000161451776221300160440ustar00rootroot00000000000000* text eol=lf core-js-3.33.2/.github/000077500000000000000000000000001451776221300145145ustar00rootroot00000000000000core-js-3.33.2/.github/FUNDING.yml000066400000000000000000000001161451776221300163270ustar00rootroot00000000000000open_collective: core-js patreon: zloirock custom: https://boosty.to/zloirock core-js-3.33.2/.github/workflows/000077500000000000000000000000001451776221300165515ustar00rootroot00000000000000core-js-3.33.2/.github/workflows/ci.yml000066400000000000000000000031001451776221300176610ustar00rootroot00000000000000name: ci on: [push, pull_request] permissions: contents: read # to fetch code (actions/checkout) jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 21 cache: npm - uses: actions/setup-python@v4 with: python-version: 3.11 - run: npm ci - run: pip install codespell - run: npx run-s lint-raw codespell karma: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 21 cache: npm - run: npm ci - run: npx run-s bundle test-unit-karma promises-and-observables: strategy: matrix: node: - 18.12 - 20.9 - 21 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: npm - run: npm ci - run: npx run-s test-promises test-observables tests: strategy: matrix: os: - ubuntu-latest - windows-latest - macos-latest node: - 18.12 - 20.9 - 21 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: npm - run: npm ci - run: npx run-s bundle test-unit-node test-entries test-compat-data test-compat-tools test-builder core-js-3.33.2/.gitignore000066400000000000000000000023321451776221300151440ustar00rootroot00000000000000npm-shrinkwrap.json yarn.lock node_modules/ *.tmp *.log *.bak *.swp /packages/core-js/features/ /packages/core-js/es/index.js /packages/core-js/full/index.js /packages/core-js/stable/index.js /packages/core-js/LICENSE /packages/core-js-builder/LICENSE /packages/core-js-bundle/LICENSE /packages/core-js-bundle/index.js /packages/core-js-bundle/minified.js /packages/core-js-bundle/minified.js.map /packages/core-js-bundle/postinstall.js /packages/core-js-compat/LICENSE /packages/core-js-compat/data.json /packages/core-js-compat/entries.json /packages/core-js-compat/external.json /packages/core-js-compat/modules.json /packages/core-js-compat/modules-by-versions.json /packages/core-js-pure/actual/ /packages/core-js-pure/es/ /packages/core-js-pure/features/ /packages/core-js-pure/full/ /packages/core-js-pure/internals/ /packages/core-js-pure/modules/ /packages/core-js-pure/proposals/ /packages/core-js-pure/stable/ /packages/core-js-pure/stage/ /packages/core-js-pure/web/ /packages/core-js-pure/LICENSE /packages/core-js-pure/index.js /packages/core-js-pure/configurator.js /packages/core-js-pure/postinstall.js /tests/**/bundles/ /tests/compat/*.jar /tests/compat/compat-data.js /tests/unit-global/index.js /tests/unit-pure/index.js core-js-3.33.2/.npmrc000066400000000000000000000000711451776221300142720ustar00rootroot00000000000000audit=false fund=false lockfile-version=3 loglevel=error core-js-3.33.2/CHANGELOG.md000066400000000000000000005150711451776221300147760ustar00rootroot00000000000000## Changelog ##### Unreleased - Nothing ##### [3.33.2 - 2023.10.31](https://github.com/zloirock/core-js/releases/tag/v3.33.2) - Simplified `structuredClone` polyfill, avoided second tree pass in cases of transferring - Added support of [`SuppressedError`](https://github.com/tc39/proposal-explicit-resource-management#the-suppressederror-error) to `structuredClone` polyfill - Removed unspecified unnecessary `ArrayBuffer` and `DataView` dependencies of `structuredClone` lack of which could cause errors in some entries in IE10- - Fixed handling of fractional number part in [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) - Compat data improvements: - [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse) marked as [supported from Chromium 120](https://bugs.chromium.org/p/chromium/issues/detail?id=1425839) - Updated Opera Android 78 compat data mapping - Added Electron 29 compat data mapping ##### [3.33.1 - 2023.10.20](https://github.com/zloirock/core-js/releases/tag/v3.33.1) - Added one more workaround of possible error with `Symbol` polyfill on global object, [#1289](https://github.com/zloirock/core-js/issues/1289#issuecomment-1768411444) - Directly specified `type: commonjs` in `package.json` of all packages to avoid potential breakage in future Node versions, see [this issue](https://github.com/nodejs/TSC/issues/1445) - Prevented potential issue with lack of some dependencies after automatic optimization polyfills of some methods in the pure version - Some minor internal fixes and optimizations - Compat data improvements: - [`String.prototype.{ isWellFormed, toWellFormed }`](https://github.com/tc39/proposal-is-usv-string) marked as [supported from FF119](https://bugzilla.mozilla.org/show_bug.cgi?id=1850755) - Added React Native 0.73 Hermes compat data, mainly fixes of [some issues](https://github.com/facebook/hermes/issues/770) - Added [NodeJS 21.0 compat data mapping](https://nodejs.org/ru/blog/release/v21.0.0) ##### [3.33.0 - 2023.10.02](https://github.com/zloirock/core-js/releases/tag/v3.33.0) - Re-introduced [`RegExp` escaping stage 2 proposal](https://github.com/tc39/proposal-regex-escaping), September 2023 TC39 meeting: - Added `RegExp.escape` method with the new set of symbols for escaping - Some years ago, it was presented in `core-js`, but it was removed after rejecting the old version of this proposal - Added [`ArrayBuffer.prototype.{ transfer, transferToFixedLength }`](https://github.com/tc39/proposal-arraybuffer-transfer) and support transferring of `ArrayBuffer`s via [`structuredClone`](https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone) to engines with `MessageChannel` - Optimized [`Math.f16round`](https://github.com/tc39/proposal-float16array) polyfill - Fixed [some conversion cases](https://github.com/petamoriken/float16/issues/1046) of [`Math.f16round` and `DataView.prototype.{ getFloat16, setFloat16 }`](https://github.com/tc39/proposal-float16array) - Fully forced polyfilling of [the TC39 `Observable` proposal](https://github.com/tc39/proposal-observable) because of incompatibility with [the new WHATWG `Observable` proposal](https://github.com/WICG/observable) - Added an extra workaround of errors with exotic environment objects in `Symbol` polyfill, [#1289](https://github.com/zloirock/core-js/issues/1289) - Some minor fixes and stylistic changes - Compat data improvements: - V8 unshipped [`Iterator` helpers](https://github.com/tc39/proposal-iterator-helpers) because of [some Web compatibility issues](https://github.com/tc39/proposal-iterator-helpers/issues/286) - [`Promise.withResolvers`](https://github.com/tc39/proposal-promise-with-resolvers) marked as [supported from V8 ~ Chrome 119](https://chromestatus.com/feature/5810984110784512) - [`Array` grouping proposal](https://github.com/tc39/proposal-array-grouping) features marked as [supported from FF119](https://bugzilla.mozilla.org/show_bug.cgi?id=1792650#c9) - [`value` argument of `URLSearchParams.prototype.{ has, delete }`](https://url.spec.whatwg.org/#dom-urlsearchparams-delete) marked as properly supported from V8 ~ Chrome 118 - [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse) and [`URLSearchParams.prototype.size`](https://url.spec.whatwg.org/#dom-urlsearchparams-size) marked as [supported from Bun 1.0.2](https://github.com/oven-sh/bun/releases/tag/bun-v1.0.2) - Added Deno 1.37 compat data mapping - Added Electron 28 compat data mapping - Added Opera Android 78 compat data mapping ##### [3.32.2 - 2023.09.07](https://github.com/zloirock/core-js/releases/tag/v3.32.2) - Fixed `structuredClone` feature detection `core-js@3.32.1` bug, [#1288](https://github.com/zloirock/core-js/issues/1288) - Added a workaround of old WebKit + `eval` bug, [#1287](https://github.com/zloirock/core-js/pull/1287) - Compat data improvements: - Added Samsung Internet 23 compat data mapping - Added Quest Browser 29 compat data mapping ##### [3.32.1 - 2023.08.19](https://github.com/zloirock/core-js/releases/tag/v3.32.1) - Fixed some cases of IEEE754 rounding, [#1279](https://github.com/zloirock/core-js/issues/1279), thanks [**@petamoriken**](https://github.com/petamoriken) - Prevented injection `process` polyfill to `core-js` via some bundlers or `esm.sh`, [#1277](https://github.com/zloirock/core-js/issues/1277) - Some minor fixes and stylistic changes - Compat data improvements: - [`Promise.withResolvers`](https://github.com/tc39/proposal-promise-with-resolvers) marked as supported [from Bun 0.7.1](https://bun.sh/blog/bun-v0.7.1#bun-ismainthread-and-promise-withresolvers) - Added Opera Android 77 compat data mapping - Updated Electron 27 compat data mapping ##### [3.32.0 - 2023.07.28](https://github.com/zloirock/core-js/releases/tag/v3.32.0) - [`Array` grouping proposal](https://github.com/tc39/proposal-array-grouping), July 2023 TC39 meeting updates: - [Moved back to stage 3](https://github.com/tc39/proposal-array-grouping/issues/54) - Added `/actual/` namespaces entries, unconditional forced replacement changed to feature detection - [`Promise.withResolvers` proposal](https://github.com/tc39/proposal-promise-with-resolvers), July 2023 TC39 meeting updates: - [Moved to stage 3](https://github.com/tc39/proposal-promise-with-resolvers/pull/18) - Added `/actual/` namespaces entries, unconditional forced replacement changed to feature detection - [`Set` methods stage 3 proposal](https://github.com/tc39/proposal-set-methods), July 2023 TC39 meeting updates: - Throw on negative `Set` sizes, [proposal-set-methods/88](https://github.com/tc39/proposal-set-methods/pull/88) - Removed `IsCallable` check in `GetKeysIterator`, [proposal-set-methods/101](https://github.com/tc39/proposal-set-methods/pull/101) - [Iterator Helpers stage 3 proposal](https://github.com/tc39/proposal-iterator-helpers): - Avoid creating observable `String` wrapper objects, July 2023 TC39 meeting update, [proposal-iterator-helpers/281](https://github.com/tc39/proposal-iterator-helpers/pull/281) - `Iterator` is not constructible from the active function object (works as an abstract class) - Async explicit resource management: - Moved back into [the initial proposal](https://github.com/tc39/proposal-explicit-resource-management) -> moved to stage 3, [proposal-explicit-resource-management/154](https://github.com/tc39/proposal-explicit-resource-management/pull/154) - Added `/actual/` namespace entries, unconditional forced replacement changed to feature detection - Ignore return value of `[@@dispose]()` method when hint is `async-dispose`, [proposal-explicit-resource-management/180](https://github.com/tc39/proposal-explicit-resource-management/pull/180) - Added ticks for empty resources, [proposal-explicit-resource-management/163](https://github.com/tc39/proposal-explicit-resource-management/pull/163) - Added some methods from [`Float16Array` stage 3 proposal](https://github.com/tc39/proposal-float16array): - There are some reason why I don't want to add `Float16Array` right now, however, make sense to add some methods from this proposal. - Methods: - `Math.f16round` - `DataView.prototype.getFloat16` - `DataView.prototype.setFloat16` - Added [`DataView` get / set `Uint8Clamped` methods stage 1 proposal](https://github.com/tc39/proposal-dataview-get-set-uint8clamped): - Methods: - `DataView.prototype.getUint8Clamped` - `DataView.prototype.setUint8Clamped` - Used strict mode in some missed cases, [#1269](https://github.com/zloirock/core-js/issues/1269) - Fixed [a Chromium 117 bug](https://bugs.chromium.org/p/v8/issues/detail?id=14222) in `value` argument of `URLSearchParams.prototype.{ has, delete }` - Fixed early WebKit ~ Safari 17.0 beta `Set` methods implementation by the actual spec - Fixed incorrect `Symbol.{ dispose, asyncDispose }` descriptors from [NodeJS 20.4](https://github.com/nodejs/node/issues/48699) / transpilers helpers / userland code - Fixed forced polyfilling of some iterator helpers that should return wrapped iterator in the pure version - Fixed and exposed [`AsyncIteratorPrototype` `core-js/configurator` option](https://github.com/zloirock/core-js#asynciterator-helpers), [#1268](https://github.com/zloirock/core-js/issues/1268) - Compat data improvements: - Sync [`Iterator` helpers proposal](https://github.com/tc39/proposal-iterator-helpers) features marked as [supported](https://chromestatus.com/feature/5102502917177344) from V8 ~ Chrome 117 - [`Array` grouping proposal](https://github.com/tc39/proposal-array-grouping) features marked as [supported](https://chromestatus.com/feature/5714791975878656) from V8 ~ Chrome 117 - Mark `Symbol.{ dispose, asyncDispose }` as supported from NodeJS 20.5.0 (as mentioned above, NodeJS 20.4.0 add it, but [with incorrect descriptors](https://github.com/nodejs/node/issues/48699)) - Added Electron 27 compat data mapping ##### [3.31.1 - 2023.07.06](https://github.com/zloirock/core-js/releases/tag/v3.31.1) - Fixed a `structuredClone` bug with cloning views of transferred buffers, [#1265](https://github.com/zloirock/core-js/issues/1265) - Fixed the order of arguments validation in `DataView` methods - Allowed cloning of [`Float16Array`](https://github.com/tc39/proposal-float16array) in `structuredClone` - Compat data improvements: - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) marked as [supported from Safari 17.0](https://developer.apple.com/documentation/safari-release-notes/safari-17-release-notes#JavaScript) - New `URL` features: [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse), [`URLSearchParams.prototype.size`](https://url.spec.whatwg.org/#dom-urlsearchparams-size) and [`value` argument of `URLSearchParams.prototype.{ has, delete }`](https://url.spec.whatwg.org/#dom-urlsearchparams-delete) marked as [supported from Safari 17.0](https://developer.apple.com/documentation/safari-release-notes/safari-17-release-notes#Web-API) - `value` argument of `URLSearchParams.prototype.{ has, delete }` marked as supported from [Deno 1.35](https://github.com/denoland/deno/pull/19654) - `AggregateError` and well-formed `JSON.stringify` marked as [supported React Native 0.72 Hermes](https://reactnative.dev/blog/2023/06/21/0.72-metro-package-exports-symlinks#more-ecmascript-support-in-hermes) - Added Deno 1.35 compat data mapping - Added Quest Browser 28 compat data mapping - Added missing NodeJS 12.16-12.22 compat data mapping - Updated Opera Android 76 compat data mapping ##### [3.31.0 - 2023.06.12](https://github.com/zloirock/core-js/releases/tag/v3.31.0) - [Well-formed unicode strings proposal](https://github.com/tc39/proposal-is-usv-string): - Methods: - `String.prototype.isWellFormed` method - `String.prototype.toWellFormed` method - Moved to stable ES, [May 2023 TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-15.md#well-formed-unicode-strings-for-stage-4) - Added `es.` namespace modules, `/es/` and `/stable/` namespaces entries - [`Array` grouping proposal](https://github.com/tc39/proposal-array-grouping), [May 2023 TC39 meeting updates](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-16.md#arrayprototypegroup-rename-for-web-compatibility): - Because of the [web compat issue](https://github.com/tc39/proposal-array-grouping/issues/44), [moved from prototype to static methods](https://github.com/tc39/proposal-array-grouping/pull/47). Added: - `Object.groupBy` method - `Map.groupBy` method (with the actual semantic - with a minor difference it was present [in the collections methods stage 1 proposal](https://github.com/tc39/proposal-collection-methods)) - Demoted to stage 2 - [Decorator Metadata proposal](https://github.com/tc39/proposal-decorator-metadata), [May 2023 TC39 meeting updates](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-16.md#decorator-metadata-for-stage-3): - Moved to stage 3 - Added `Function.prototype[Symbol.metadata]` (`=== null`) - Added `/actual/` entries - [Iterator Helpers stage 3 proposal](https://github.com/tc39/proposal-iterator-helpers): - Changed `Symbol.iterator` fallback from callable check to `undefined` / `null` check, [May 2023 TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-16.md#iterator-helpers-should-symboliterator-fallback-be-a-callable-check-or-an-undefinednull-check), [proposal-iterator-helpers/272](https://github.com/tc39/proposal-iterator-helpers/pull/272) - Removed `IsCallable` check on `NextMethod`, deferring errors to `Call` site, [May 2023 TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-16.md#iterator-helpers-should-malformed-iterators-fail-early-or-fail-only-when-iterated), [proposal-iterator-helpers/274](https://github.com/tc39/proposal-iterator-helpers/pull/274) - Added [`Promise.withResolvers` stage 2 proposal](https://github.com/tc39/proposal-promise-with-resolvers): - `Promise.withResolvers` method - [`Symbol` predicates stage 2 proposal](https://github.com/tc39/proposal-symbol-predicates): - The methods renamed to end with `Symbol`, [May 2023 TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2023-05/may-15.md#symbol-predicates): - `Symbol.isRegistered` -> `Symbol.isRegisteredSymbol` method - `Symbol.isWellKnown` -> `Symbol.isWellKnownSymbol` method - Added `value` argument of `URLSearchParams.prototype.{ has, delete }`, [url/735](https://github.com/whatwg/url/pull/735) - Fixed some cases of increasing buffer size in `ArrayBuffer.prototype.{ transfer, transferToFixedLength }` polyfills - Fixed awaiting async `AsyncDisposableStack.prototype.adopt` callback, [#1258](https://github.com/zloirock/core-js/issues/1258) - Fixed `URLSearchParams#size` in ES3 engines (IE8-) - Added a workaround in `Object.{ entries, values }` for some IE versions bug with invisible integer keys on `null`-prototype objects - Added TypeScript definitions to `core-js-compat`, [#1235](https://github.com/zloirock/core-js/issues/1235), thanks [**@susnux**](https://github.com/susnux) - Compat data improvements: - [`Set.prototype.difference`](https://github.com/tc39/proposal-set-methods) that was missed in Bun because of [a bug](https://github.com/oven-sh/bun/issues/2309) added in 0.6.0 - `Array.prototype.{ group, groupToMap }` marked as no longer supported in WebKit runtimes because of the mentioned above web compat issue. For example, it's disabled from Bun 0.6.2 - Methods from the [change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy) marked as supported from FF115 - [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async) marked as supported from FF115 - [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse) marked as supported from FF115 - `value` argument of `URLSearchParams.prototype.{ has, delete }` marked as supported from [NodeJS 20.2.0](https://github.com/nodejs/node/pull/47885) and FF115 - Added Deno 1.34 compat data mapping - Added Electron 26 compat data mapping - Added Samsung Internet 22 compat data mapping - Added Opera Android 75 and 76 compat data mapping - Added Quest Browser 27 compat data mapping ##### [3.30.2 - 2023.05.07](https://github.com/zloirock/core-js/releases/tag/v3.30.2) - Added a fix for a NodeJS 20.0.0 [bug](https://github.com/nodejs/node/issues/47612) with cloning `File` via `structuredClone` - Added protection from Terser unsafe `String` optimization, [#1242](https://github.com/zloirock/core-js/issues/1242) - Added a workaround for getting proper global object in Figma plugins, [#1231](https://github.com/zloirock/core-js/issues/1231) - Compat data improvements: - Added NodeJS 20.0 compat data mapping - Added Deno 1.33 compat data mapping - [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse) marked as supported (fixed) from [NodeJS 20.1.0](https://github.com/nodejs/node/pull/47513) and [Deno 1.33.2](https://github.com/denoland/deno/pull/18896) ##### [3.30.1 - 2023.04.14](https://github.com/zloirock/core-js/releases/tag/v3.30.1) - Added a fix for a NodeJS 19.9.0 `URL.canParse` [bug](https://github.com/nodejs/node/issues/47505) - Compat data improvements: - [`JSON.parse` source text access proposal](https://github.com/tc39/proposal-json-parse-with-source) features marked as [supported](https://chromestatus.com/feature/5121582673428480) from V8 ~ Chrome 114 - [`ArrayBuffer.prototype.transfer` and friends proposal](https://github.com/tc39/proposal-arraybuffer-transfer) features marked as [supported](https://chromestatus.com/feature/5073244152922112) from V8 ~ Chrome 114 - [`URLSearchParams.prototype.size`](https://github.com/whatwg/url/pull/734) marked as supported from V8 ~ Chrome 113 ##### [3.30.0 - 2023.04.04](https://github.com/zloirock/core-js/releases/tag/v3.30.0) - Added [`URL.canParse` method](https://url.spec.whatwg.org/#dom-url-canparse), [url/763](https://github.com/whatwg/url/pull/763) - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods): - Removed sort from `Set.prototype.intersection`, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1478610425), [proposal-set-methods/94](https://github.com/tc39/proposal-set-methods/pull/94) - Iterator Helpers proposals ([sync](https://github.com/tc39/proposal-iterator-helpers), [async](https://github.com/tc39/proposal-async-iterator-helpers)): - Validate arguments before opening iterator, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1478412430), [proposal-iterator-helpers/265](https://github.com/tc39/proposal-iterator-helpers/pull/265) - Explicit Resource Management proposals ([sync](https://github.com/tc39/proposal-explicit-resource-management), [async](https://github.com/tc39/proposal-async-explicit-resource-management)): - `(Async)DisposableStack.prototype.move` marks the original stack as disposed, [#1226](https://github.com/zloirock/core-js/issues/1226) - Some simplifications like [proposal-explicit-resource-management/150](https://github.com/tc39/proposal-explicit-resource-management/pull/150) - [`Iterator.range` proposal](https://github.com/tc39/proposal-Number.range): - Moved to Stage 2, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1480266760) - [Decorator Metadata proposal](https://github.com/tc39/proposal-decorator-metadata): - Returned to usage `Symbol.metadata`, [March 2023 TC39 meeting](https://github.com/babel/proposals/issues/87#issuecomment-1478790137), [proposal-decorator-metadata/12](https://github.com/tc39/proposal-decorator-metadata/pull/12) - Compat data improvements: - [`URLSearchParams.prototype.size`](https://github.com/whatwg/url/pull/734) marked as supported from FF112, NodeJS 19.8 and Deno 1.32 - Added Safari 16.4 compat data - Added Deno 1.32 compat data mapping - Added Electron 25 and updated 24 compat data mapping - Added Samsung Internet 21 compat data mapping - Added Quest Browser 26 compat data mapping - Updated Opera Android 74 compat data ##### [3.29.1 - 2023.03.13](https://github.com/zloirock/core-js/releases/tag/v3.29.1) - Fixed dependencies of some entries - Fixed `ToString` conversion / built-ins nature of some accessors - [`String.prototype.{ isWellFormed, toWellFormed }`](https://github.com/tc39/proposal-is-usv-string) marked as supported from V8 ~ Chrome 111 - Added Opera Android 74 compat data mapping ##### [3.29.0 - 2023.02.27](https://github.com/zloirock/core-js/releases/tag/v3.29.0) - Added `URLSearchParams.prototype.size` getter, [url/734](https://github.com/whatwg/url/pull/734) - Allowed cloning resizable `ArrayBuffer`s in the `structuredClone` polyfill - Fixed wrong export in `/(stable|actual|full)/instance/unshift` entries, [#1207](https://github.com/zloirock/core-js/issues/1207) - Compat data improvements: - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) marked as supported from Bun 0.5.7 - `String.prototype.toWellFormed` marked as fixed from Bun 0.5.7 - Added Deno 1.31 compat data mapping ##### [3.28.0 - 2023.02.14](https://github.com/zloirock/core-js/releases/tag/v3.28.0) **I highly recommend reading this: [So, what's next?](https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md)** --- - [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy): - Methods: - `Array.prototype.toReversed` - `Array.prototype.toSorted` - `Array.prototype.toSpliced` - `Array.prototype.with` - `%TypedArray%.prototype.toReversed` - `%TypedArray%.prototype.toSorted` - `%TypedArray%.prototype.with` - Moved to stable ES, [January 2023 TC39 meeting](https://github.com/babel/proposals/issues/86#issuecomment-1409261397) - Added `es.` namespace modules, `/es/` and `/stable/` namespaces entries - Added [`JSON.parse` source text access Stage 3 proposal](https://github.com/tc39/proposal-json-parse-with-source) - Methods: - `JSON.parse` patched for support `source` in `reviver` function arguments - `JSON.rawJSON` - `JSON.isRawJSON` - `JSON.stringify` patched for support `JSON.rawJSON` - Added [`ArrayBuffer.prototype.transfer` and friends Stage 3 proposal](https://github.com/tc39/proposal-arraybuffer-transfer): - Built-ins: - `ArrayBuffer.prototype.detached` - `ArrayBuffer.prototype.transfer` (only in runtimes with native `structuredClone` with `ArrayBuffer` transfer support) - `ArrayBuffer.prototype.transferToFixedLength` (only in runtimes with native `structuredClone` with `ArrayBuffer` transfer support) - In backwards, in runtimes with native `ArrayBuffer.prototype.transfer`, but without proper `structuredClone`, added `ArrayBuffer` transfer support to `structuredClone` polyfill - [Iterator Helpers](https://github.com/tc39/proposal-iterator-helpers) proposal: - Split into 2 ([sync](https://github.com/tc39/proposal-iterator-helpers) and [async](https://github.com/tc39/proposal-async-iterator-helpers)) proposals, async version moved back to Stage 2, [January 2023 TC39 meeting](https://github.com/babel/proposals/issues/86#issuecomment-1410926068) - Allowed interleaved mapping in `AsyncIterator` helpers, [proposal-iterator-helpers/262](https://github.com/tc39/proposal-iterator-helpers/pull/262) - [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management) Stage 3 and [Async Explicit Resource Management](https://github.com/tc39/proposal-async-explicit-resource-management/) Stage 2 proposals: - `InstallErrorCause` removed from `SuppressedError`, [January 2023 TC39 meeting](https://github.com/babel/proposals/issues/86#issuecomment-1410889704), [proposal-explicit-resource-management/145](https://github.com/tc39/proposal-explicit-resource-management/pull/146) - Simplified internal behaviour of `{ AsyncDisposableStack, DisposableStack }.prototype.use`, [proposal-explicit-resource-management/143](https://github.com/tc39/proposal-explicit-resource-management/pull/143) - Added [`Symbol` predicates Stage 2 proposal](https://github.com/tc39/proposal-symbol-predicates) - Methods: - `Symbol.isRegistered` - `Symbol.isWellKnown` - `Number.range` Stage 1 proposal and method [renamed to `Iterator.range`](https://github.com/tc39/proposal-Number.range) - `Function.prototype.unThis` Stage 0 proposal and method [renamed to `Function.prototype.demethodize`](https://github.com/js-choi/proposal-function-demethodize) - Fixed [Safari `String.prototype.toWellFormed` `ToString` conversion bug](https://bugs.webkit.org/show_bug.cgi?id=251757) - Improved some cases handling of array-replacer in `JSON.stringify` symbols handling fix - Fixed many other old `JSON.{ parse, stringify }` bugs (numbers instead of strings as keys in replacer, handling negative zeroes, spaces, some more handling symbols cases, etc.) - Fixed configurability and `ToString` conversion of some accessors - Added throwing proper errors on an incorrect context in some `ArrayBuffer` and `DataView` methods - Some minor `DataView` and `%TypedArray%` polyfills optimizations - Added proper error on the excess number of trailing `=` in the `atob` polyfill - Fixed theoretically possible ReDoS vulnerabilities in `String.prototype.{ trim, trimEnd, trimRight }`, `parse(Int|Float)`, `Number`, `atob`, and `URL` polyfills in some ancient engines - Compat data improvements: - `RegExp.prototype.flags` marked as fixed from V8 ~ Chrome 111 - Added Opera Android 73 compat data mapping - Added TypeScript definitions to `core-js-builder` ##### [3.27.2 - 2023.01.19](https://github.com/zloirock/core-js/releases/tag/v3.27.2) - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) updates: - Closing of iterators of `Set`-like objects on early exit, [proposal-set-methods/85](https://github.com/tc39/proposal-set-methods/pull/85) - Some other minor internal changes - Added one more workaround of a `webpack` dev server bug on IE global methods, [#1161](https://github.com/zloirock/core-js/issues/1161) - Fixed possible `String.{ raw, cooked }` error with empty template array - Used non-standard V8 `Error.captureStackTrace` instead of stack parsing in new error classes / wrappers where it's possible - Added detection correctness of iteration to `Promise.{ allSettled, any }` feature detection, Hermes issue - Compat data improvements: - [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy) marked as supported from V8 ~ Chrome 110 - Added Samsung Internet 20 compat data mapping - Added Quest Browser 25 compat data mapping - Added React Native 0.71 Hermes compat data - Added Electron 23 and 24 compat data mapping - `self` marked as fixed in Deno 1.29.3, [deno/17362](https://github.com/denoland/deno/pull/17362) - Minor tweaks of minification settings for `core-js-bundle` - Refactoring, some minor fixes, improvements, optimizations ##### [3.27.1 - 2022.12.30](https://github.com/zloirock/core-js/releases/tag/v3.27.1) - Fixed a Chakra-based MS Edge (18-) bug that unfreeze (O_o) frozen arrays used as `WeakMap` keys - Fixing of the previous bug also fixes some cases of `String.dedent` in MS Edge - Fixed dependencies of some entries ##### [3.27.0 - 2022.12.26](https://github.com/zloirock/core-js/releases/tag/v3.27.0) - [Iterator Helpers](https://github.com/tc39/proposal-iterator-helpers) proposal: - Built-ins: - `Iterator` - `Iterator.from` - `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` - `Iterator.prototype.toAsync` - `Iterator.prototype[@@toStringTag]` - `AsyncIterator` - `AsyncIterator.from` - `AsyncIterator.prototype.drop` - `AsyncIterator.prototype.every` - `AsyncIterator.prototype.filter` - `AsyncIterator.prototype.find` - `AsyncIterator.prototype.flatMap` - `AsyncIterator.prototype.forEach` - `AsyncIterator.prototype.map` - `AsyncIterator.prototype.reduce` - `AsyncIterator.prototype.some` - `AsyncIterator.prototype.take` - `AsyncIterator.prototype.toArray` - `AsyncIterator.prototype[@@toStringTag]` - Moved to Stage 3, [November 2022 TC39 meeting](https://github.com/babel/proposals/issues/85#issuecomment-1333474304) - Added `/actual/` entries, unconditional forced replacement disabled for features that survived to Stage 3 - `.from` accept strings, `.flatMap` throws on strings returned from the callback, [proposal-iterator-helpers/244](https://github.com/tc39/proposal-iterator-helpers/pull/244), [proposal-iterator-helpers/250](https://github.com/tc39/proposal-iterator-helpers/pull/250) - `.from` and `.flatMap` throws on non-object *iterators*, [proposal-iterator-helpers/253](https://github.com/tc39/proposal-iterator-helpers/pull/253) - [`Set` methods proposal](https://github.com/tc39/proposal-set-methods): - Built-ins: - `Set.prototype.intersection` - `Set.prototype.union` - `Set.prototype.difference` - `Set.prototype.symmetricDifference` - `Set.prototype.isSubsetOf` - `Set.prototype.isSupersetOf` - `Set.prototype.isDisjointFrom` - Moved to Stage 3, [November 2022 TC39 meeting](https://github.com/babel/proposals/issues/85#issuecomment-1332175557) - Reimplemented with [new semantics](https://tc39.es/proposal-set-methods/): - Optimized performance (iteration over lowest set) - Accepted only `Set`-like objects as an argument, not all iterables - Accepted only `Set`s as `this`, no `@@species` support, and other minor changes - Added `/actual/` entries, unconditional forced replacement changed to feature detection - For avoiding breaking changes: - New versions of methods are implemented as new modules and available in new entries or entries where old versions of methods were not available before (like `/actual/` namespace) - In entries where they were available before (like `/full/` namespace), those methods are available with fallbacks to old semantics (in addition to `Set`-like, they accept iterable objects). This behavior will be removed from the next major release - [Well-Formed Unicode Strings](https://github.com/tc39/proposal-is-usv-string) proposal: - Methods: - `String.prototype.isWellFormed` - `String.prototype.toWellFormed` - Moved to Stage 3, [November 2022 TC39 meeting](https://github.com/babel/proposals/issues/85#issuecomment-1332180862) - Added `/actual/` entries, disabled unconditional forced replacement - [Explicit resource management](https://github.com/tc39/proposal-explicit-resource-management) Stage 3 and [Async explicit resource management](https://github.com/tc39/proposal-async-explicit-resource-management) Stage 2 proposals: - Renamed from "`using` statement" and [split into 2 (sync and async) proposals](https://github.com/tc39/proposal-explicit-resource-management/pull/131) - In addition to already present well-known symbols, added new built-ins: - `Symbol.dispose` - `Symbol.asyncDispose` - `SuppressedError` - `DisposableStack` - `DisposableStack.prototype.dispose` - `DisposableStack.prototype.use` - `DisposableStack.prototype.adopt` - `DisposableStack.prototype.defer` - `DisposableStack.prototype.move` - `DisposableStack.prototype[@@dispose]` - `AsyncDisposableStack` - `AsyncDisposableStack.prototype.disposeAsync` - `AsyncDisposableStack.prototype.use` - `AsyncDisposableStack.prototype.adopt` - `AsyncDisposableStack.prototype.defer` - `AsyncDisposableStack.prototype.move` - `AsyncDisposableStack.prototype[@@asyncDispose]` - `Iterator.prototype[@@dispose]` - `AsyncIterator.prototype[@@asyncDispose]` - Sync version of this proposal moved to Stage 3, [November 2022 TC39 meeting](https://github.com/babel/proposals/issues/85#issuecomment-1333747094) - Added `/actual/` namespace entries for Stage 3 proposal - Added [`String.dedent` stage 2 proposal](https://github.com/tc39/proposal-string-dedent) - Method `String.dedent` - Throws an error on non-frozen raw templates for avoiding possible breaking changes in the future, [proposal-string-dedent/75](https://github.com/tc39/proposal-string-dedent/issues/75) - [Compat data targets](/packages/core-js-compat#targets-option) improvements: - [React Native from 0.70 shipped with Hermes as the default engine.](https://reactnative.dev/blog/2022/07/08/hermes-as-the-default) However, bundled Hermes versions differ from standalone Hermes releases. So added **`react-native`** target for React Native with bundled Hermes. - [According to the documentation](https://developer.oculus.com/documentation/web/browser-intro/), Oculus Browser was renamed to Meta Quest Browser, so `oculus` target was renamed to **`quest`**. - `opera_mobile` target name is confusing since it contains data for the Chromium-based Android version, but iOS Opera is Safari-based. So `opera_mobile` target was renamed to **`opera-android`**. - `android` target name is also confusing for someone - that means Android WebView, some think thinks that it's Chrome for Android, but they have some differences. For avoiding confusion, added **`chrome-android`** target. - For consistency with two previous cases, added **`firefox-android`** target. - For avoiding breaking changes, the `oculus` and `opera_mobile` fields are available in the compat data till the next major release. - Compat data improvements: - [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async) marked as supported from Bun 0.3.0 - [`String.prototype.{ isWellFormed, toWellFormed }`](https://github.com/tc39/proposal-is-usv-string) marked as supported from Bun 0.4.0 - [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy) marked as supported from Deno 1.27, [deno/16429](https://github.com/denoland/deno/pull/16429) - Added Deno 1.28 / 1.29 compat data mapping - Added NodeJS 19.2 compat data mapping - Added Samsung Internet 19.0 compat data mapping - Added Quest Browser 24.0 compat data mapping - Fixed the first version in the Chromium-based Edge compat data mapping - `{ Map, WeakMap }.prototype.emplace` became stricter [by the spec draft](https://tc39.es/proposal-upsert/) - Smoothed behavior of some conflicting proposals - Removed some generic behavior (like `@@species` pattern) of some `.prototype` methods from the [new collections methods proposal](https://github.com/tc39/proposal-collection-methods) and the [`Array` deduplication proposal](https://github.com/tc39/proposal-array-unique) that *most likely* will not be implemented since it contradicts the current TC39 policy - Added pure version of the `Number` constructor, [#1154](https://github.com/zloirock/core-js/issues/1154), [#1155](https://github.com/zloirock/core-js/issues/1155), thanks [@trosos](https://github.com/trosos) - Added `set(Timeout|Interval|Immediate)` extra arguments fix for Bun 0.3.0- (similarly to IE9-), [bun/1633](https://github.com/oven-sh/bun/issues/1633) - Fixed handling of sparse arrays in `structuredClone`, [#1156](https://github.com/zloirock/core-js/issues/1156) - Fixed a theoretically possible future conflict of polyfills definitions in the pure version - Some refactoring and optimization ##### [3.26.1 - 2022.11.14](https://github.com/zloirock/core-js/releases/tag/v3.26.1) - Disabled forced replacing of `Array.fromAsync` since it's on Stage 3 - Avoiding a check of the target in the internal `function-uncurry-this` helper where it's not required - minor optimization and preventing problems in some broken environments, a workaround of [#1141](https://github.com/zloirock/core-js/issues/1141) - V8 will not ship `Array.prototype.{ group, groupToMap }` in V8 ~ Chromium 108, [proposal-array-grouping/44](https://github.com/tc39/proposal-array-grouping/issues/44#issuecomment-1306311107) ##### [3.26.0 - 2022.10.24](https://github.com/zloirock/core-js/releases/tag/v3.26.0) - [`Array.fromAsync` proposal](https://github.com/tc39/proposal-array-from-async): - Moved to Stage 3, [September TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2022-09/sep-14.md#arrayfromasync-for-stage-3) - Avoid observable side effects of `%Array.prototype.values%` usage in array-like branch, [proposal-array-from-async/30](https://github.com/tc39/proposal-array-from-async/pull/30) - Added [well-formed unicode strings stage 2 proposal](https://github.com/tc39/proposal-is-usv-string): - `String.prototype.isWellFormed` - `String.prototype.toWellFormed` - Recent updates of the [iterator helpers proposal](https://github.com/tc39/proposal-iterator-helpers): - Added a counter parameter to helpers, [proposal-iterator-helpers/211](https://github.com/tc39/proposal-iterator-helpers/pull/211) - Don't await non-objects returned from functions passed to `AsyncIterator` helpers, [proposal-iterator-helpers/239](https://github.com/tc39/proposal-iterator-helpers/pull/239) - `{ Iterator, AsyncIterator }.prototype.flatMap` supports returning both - iterables and iterators, [proposal-iterator-helpers/233](https://github.com/tc39/proposal-iterator-helpers/pull/233) - Early exit on broken `.next` in missed cases of `{ Iterator, AsyncIterator }.from`, [proposal-iterator-helpers/232](https://github.com/tc39/proposal-iterator-helpers/pull/232) - Added `self` polyfill as a part of [The Minimum Common Web Platform API](https://common-min-api.proposal.wintercg.org/), [specification](https://html.spec.whatwg.org/multipage/window-object.html#dom-self), [#1118](https://github.com/zloirock/core-js/issues/1118) - Added `inverse` option to `core-js-compat`, [#1119](https://github.com/zloirock/core-js/issues/1119) - Added `format` option to `core-js-builder`, [#1120](https://github.com/zloirock/core-js/issues/1120) - Added NodeJS 19.0 compat data - Added Deno 1.26 and 1.27 compat data - Added Opera Android 72 compat data mapping - Updated Electron 22 compat data mapping ##### [3.25.5 - 2022.10.04](https://github.com/zloirock/core-js/releases/tag/v3.25.5) - Fixed regression with an error on reuse of some built-in methods from another realm, [#1133](https://github.com/zloirock/core-js/issues/1133) ##### [3.25.4 - 2022.10.03](https://github.com/zloirock/core-js/releases/tag/v3.25.4) - Added a workaround of a Nashorn bug with `Function.prototype.{ call, apply, bind }` on string methods, [#1128](https://github.com/zloirock/core-js/issues/1128) - Updated lists of `[Serializable]` and `[Transferable]` objects in the `structuredClone` polyfill. Mainly, for better error messages if polyfilling of cloning such types is impossible - `Array.prototype.{ group, groupToMap }` marked as [supported from V8 ~ Chromium 108](https://chromestatus.com/feature/5714791975878656) - Added Electron 22 compat data mapping ##### [3.25.3 - 2022.09.26](https://github.com/zloirock/core-js/releases/tag/v3.25.3) - Forced polyfilling of `Array.prototype.groupToMap` in the pure version for returning wrapped `Map` instances - Fixed existence of `Array.prototype.{ findLast, findLastIndex }` in `/stage/4` entry - Added Opera Android 71 compat data mapping - Some stylistic changes ##### [3.25.2 - 2022.09.19](https://github.com/zloirock/core-js/releases/tag/v3.25.2) - Considering `document.all` as a callable in some missed cases - Added Safari 16.0 compat data - Added iOS Safari 16.0 compat data mapping - Fixed some ancient iOS Safari versions compat data mapping ##### [3.25.1 - 2022.09.08](https://github.com/zloirock/core-js/releases/tag/v3.25.1) - Added some fixes and workarounds of FF30- typed arrays bug that does not properly convert objects to numbers - Added `sideEffects` field to `core-js-pure` `package.json` for better tree shaking, [#1117](https://github.com/zloirock/core-js/issues/1117) - Dropped `semver` dependency from `core-js-compat` - `semver` package (ironically) added [a breaking change and dropped NodeJS 8 support in the minor `7.1` version](https://github.com/npm/node-semver/commit/d61f828e64260a0a097f26210f5500), after that `semver` in `core-js-compat` was pinned to `7.0` since for avoiding breaking changes it should support NodeJS 8. However, since `core-js-compat` is usually used with other packages that use `semver` dependency, it causes multiple duplication of `semver` in dependencies. So I decided to remove `semver` dependency and replace it with a couple of simple helpers. - Added Bun 0.1.6-0.1.11 compat data - Added Deno 1.25 compat data mapping - Updated Electron 21 compat data mapping - Some stylistic changes, minor fixes, and improvements ##### [3.25.0 - 2022.08.25](https://github.com/zloirock/core-js/releases/tag/v3.25.0) - Added [`Object.prototype.__proto__`](https://tc39.es/ecma262/#sec-object.prototype.__proto__) polyfill - It's optional, legacy, and in some cases (mainly because of developers' mistakes) can cause problems, but [some libraries depend on it](https://github.com/denoland/deno/issues/13321), and most code can't work without the proper libraries' ecosystem - Only for modern engines where this feature is missed (like Deno), it's not installed in IE10- since here we have no proper way setting of the prototype - Without fixes of early implementations where it's not an accessor since those fixes are impossible - Only for the global version - Considering `document.all` as an object in some missed cases, see [ECMAScript Annex B 3.6](https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot) - Avoiding unnecessary promise creation and validation result in `%WrapForValid(Async)IteratorPrototype%.return`, [proposal-iterator-helpers/215](https://github.com/tc39/proposal-iterator-helpers/pull/215) - Fixed omitting the result of proxing `.return` in `%IteratorHelperPrototype%.return`, [#1116](https://github.com/zloirock/core-js/issues/1116) - Fixed the order creation of properties of iteration result object of some iterators (`value` should be created before `done`) - Fixed some cases of Safari < 13 bug - silent on non-writable array `.length` setting - Fixed `ArrayBuffer.length` in V8 ~ Chrome 27- - Relaxed condition of re-usage native `WeakMap` for internal states with multiple `core-js` copies - Availability cloning of `FileList` in the `structuredClone` polyfill extended to some more old engines versions - Some stylistic changes and minor fixes - Throwing a `TypeError` in `core-js-compat` / `core-js-builder` in case of passing invalid module names / filters for avoiding unexpected result, related to [#1115](https://github.com/zloirock/core-js/issues/1115) - Added missed NodeJS 13.2 to `esmodules` `core-js-compat` / `core-js-builder` target - Added Electron 21 compat data mapping - Added Oculus Browser 23.0 compat data mapping ##### [3.24.1 - 2022.07.30](https://github.com/zloirock/core-js/releases/tag/v3.24.1) - NodeJS is ignored in `IS_BROWSER` detection to avoid a false positive with `jsdom`, [#1110](https://github.com/zloirock/core-js/issues/1110) - Fixed detection of `@@species` support in `Promise` in some old engines - `{ Array, %TypedArray% }.prototype.{ findLast, findLastIndex }` marked as shipped [in FF104](https://bugzilla.mozilla.org/show_bug.cgi?id=1775026) - Added iOS Safari 15.6 compat data mapping - Fixed Opera 15 compat data mapping ##### [3.24.0 - 2022.07.25](https://github.com/zloirock/core-js/releases/tag/v3.24.0) - Recent updates of the [iterator helpers proposal](https://github.com/tc39/proposal-iterator-helpers), [#1101](https://github.com/zloirock/core-js/issues/1101): - `.asIndexedPairs` renamed to `.indexed`, [proposal-iterator-helpers/183](https://github.com/tc39/proposal-iterator-helpers/pull/183): - `Iterator.prototype.asIndexedPairs` -> `Iterator.prototype.indexed` - `AsyncIterator.prototype.asIndexedPairs` -> `AsyncIterator.prototype.indexed` - Avoid exposing spec fiction `%AsyncFromSyncIteratorPrototype%` in `AsyncIterator.from` and `Iterator.prototype.toAsync`, [proposal-iterator-helpers/182](https://github.com/tc39/proposal-iterator-helpers/pull/182), [proposal-iterator-helpers/202](https://github.com/tc39/proposal-iterator-helpers/pull/202) - Avoid unnecessary promise creation in `%WrapForValidAsyncIteratorPrototype%.next`, [proposal-iterator-helpers/197](https://github.com/tc39/proposal-iterator-helpers/pull/197) - Do not validate value in `%WrapForValid(Async)IteratorPrototype%.next`, [proposal-iterator-helpers/197](https://github.com/tc39/proposal-iterator-helpers/pull/197) and [proposal-iterator-helpers/205](https://github.com/tc39/proposal-iterator-helpers/pull/205) - Do not forward the parameter of `.next` / `.return` to an underlying iterator by the extended iterator protocol, a part of [proposal-iterator-helpers/194](https://github.com/tc39/proposal-iterator-helpers/pull/194) - `.throw` methods removed from all wrappers / helpers prototypes, a part of [proposal-iterator-helpers/194](https://github.com/tc39/proposal-iterator-helpers/pull/194) - Close inner iterators of `{ Iterator, AsyncIterator }.prototype.flatMap` proxy iterators on `.return`, [proposal-iterator-helpers/195](https://github.com/tc39/proposal-iterator-helpers/pull/195) - Throw `RangeError` on `NaN` in `{ Iterator, AsyncIterator }.prototype.{ drop, take }`, [proposal-iterator-helpers/181](https://github.com/tc39/proposal-iterator-helpers/pull/181) - Many other updates and fixes of this proposal - `%TypedArray%.prototype.toSpliced` method removed from the [change array by copy proposal](https://github.com/tc39/proposal-change-array-by-copy) and marked as obsolete in `core-js`, [proposal-change-array-by-copy/88](https://github.com/tc39/proposal-change-array-by-copy/issues/88) - Polyfill `Promise` with `unhandledrejection` event support (browser style) in Deno < [1.24](https://github.com/denoland/deno/releases/tag/v1.24.0) - Available new targets in `core-js-compat` / `core-js-builder` and added compat data for them: - Bun (`bun`), compat data for 0.1.1-0.1.5, [#1103](https://github.com/zloirock/core-js/issues/1103) - Hermes (`hermes`), compat data for 0.1-0.11, [#1099](https://github.com/zloirock/core-js/issues/1099) - Oculus Browser (`oculus`), compat data mapping for 3.0-22.0, [#1098](https://github.com/zloirock/core-js/issues/1098) - Added Samsung Internet 18.0 compat data mapping ##### [3.23.5 - 2022.07.18](https://github.com/zloirock/core-js/releases/tag/v3.23.5) - Fixed a typo in the `structuredClone` feature detection, [#1106](https://github.com/zloirock/core-js/issues/1106) - Added Opera Android 70 compat data mapping ##### [3.23.4 - 2022.07.10](https://github.com/zloirock/core-js/releases/tag/v3.23.4) - Added a workaround of the Bun ~ 0.1.1 [bug](https://github.com/Jarred-Sumner/bun/issues/399) that define some globals with incorrect property descriptors and that causes a crash of `core-js` - Added a fix of the FF103+ `structuredClone` bugs ([1774866](https://bugzilla.mozilla.org/show_bug.cgi?id=1774866) (fixed in FF104) and [1777321](https://bugzilla.mozilla.org/show_bug.cgi?id=1777321) (still not fixed)) that now can clone errors, but `.stack` of the clone is an empty string - Fixed `{ Map, WeakMap }.prototype.emplace` logic, [#1102](https://github.com/zloirock/core-js/issues/1102) - Fixed order of errors throwing on iterator helpers ##### [3.23.3 - 2022.06.26](https://github.com/zloirock/core-js/releases/tag/v3.23.3) - Changed the order of operations in `%TypedArray%.prototype.toSpliced` following [proposal-change-array-by-copy/89](https://github.com/tc39/proposal-change-array-by-copy/issues/89) - Fixed regression of some IE8- issues ##### [3.23.2 - 2022.06.21](https://github.com/zloirock/core-js/releases/tag/v3.23.2) - Avoided creation of extra properties for the handling of `%TypedArray%` constructors in new methods, [#1092 (comment)](https://github.com/zloirock/core-js/issues/1092#issuecomment-1158760512) - Added Deno 1.23 compat data mapping ##### [3.23.1 - 2022.06.14](https://github.com/zloirock/core-js/releases/tag/v3.23.1) - Fixed possible error on multiple `core-js` copies, [#1091](https://github.com/zloirock/core-js/issues/1091) - Added `v` flag to `RegExp.prototype.flags` implementation in case if current V8 bugs will not be fixed before this flag implementation ##### [3.23.0 - 2022.06.14](https://github.com/zloirock/core-js/releases/tag/v3.23.0) - [`Array` find from last](https://github.com/tc39/proposal-array-find-from-last) moved to the stable ES, according to June 2022 TC39 meeting: - `Array.prototype.findLast` - `Array.prototype.findLastIndex` - `%TypedArray%.prototype.findLast` - `%TypedArray%.prototype.findLastIndex` - Methods from [the `Array` grouping proposal](https://github.com/tc39/proposal-array-grouping) [renamed](https://github.com/tc39/proposal-array-grouping/pull/39), according to June 2022 TC39 meeting: - `Array.prototype.groupBy` -> `Array.prototype.group` - `Array.prototype.groupByToMap` -> `Array.prototype.groupToMap` - Changed the order of operations in `%TypedArray%.prototype.with` following [proposal-change-array-by-copy/86](https://github.com/tc39/proposal-change-array-by-copy/issues/86), according to June 2022 TC39 meeting - [Decorator Metadata proposal](https://github.com/tc39/proposal-decorator-metadata) extracted from [Decorators proposal](https://github.com/tc39/proposal-decorators) as a separate stage 2 proposal, according to March 2022 TC39 meeting, `Symbol.metadataKey` replaces `Symbol.metadata` - Added `Array.prototype.push` polyfill with some fixes for modern engines - Added `Array.prototype.unshift` polyfill with some fixes for modern engines - Fixed a bug in the order of getting flags in `RegExp.prototype.flags` in the actual version of V8 - Fixed property descriptors of some `Math` and `Number` constants - Added a workaround of V8 `ArrayBufferDetaching` protector cell invalidation and performance degradation on `structuredClone` feature detection, one more case of [#679](https://github.com/zloirock/core-js/issues/679) - Added detection of NodeJS [bug](https://github.com/nodejs/node/issues/41038) in `structuredClone` that can not clone `DOMException` (just in case for future versions that will fix other issues) - Compat data: - Added NodeJS 18.3 compat data mapping - Added and fixed Deno 1.22 and 1.21 compat data mapping - Added Opera Android 69 compat data mapping - Updated Electron 20.0 compat data mapping ##### [3.22.8 - 2022.06.02](https://github.com/zloirock/core-js/releases/tag/v3.22.8) - Fixed possible multiple call of `ToBigInt` / `ToNumber` conversion of the argument passed to `%TypedArray%.prototype.fill` in V8 ~ Chrome < 59, Safari < 14.1, FF < 55, Edge <=18 - Fixed some cases of `DeletePropertyOrThrow` in IE9- - Fixed the kind of error (`TypeError` instead of `Error`) on incorrect `exec` result in `RegExp.prototype.test` polyfill - Fixed dependencies of `{ actual, full, features }/typed-array/at` entries - Added Electron 20.0 compat data mapping - Added iOS Safari 15.5 compat data mapping - Refactoring ##### [3.22.7 - 2022.05.24](https://github.com/zloirock/core-js/releases/tag/v3.22.7) - Added a workaround for V8 ~ Chrome 53 bug with non-writable prototype of some methods, [#1083](https://github.com/zloirock/core-js/issues/1083) ##### [3.22.6 - 2022.05.23](https://github.com/zloirock/core-js/releases/tag/v3.22.6) - Fixed possible double call of `ToNumber` conversion on arguments of `Math.{ fround, trunc }` polyfills - `Array.prototype.includes` marked as [fixed](https://bugzilla.mozilla.org/show_bug.cgi?id=1767541) in FF102 ##### [3.22.5 - 2022.05.10](https://github.com/zloirock/core-js/releases/tag/v3.22.5) - Ensured that polyfilled constructors `.prototype` is non-writable - Ensured that polyfilled methods `.prototype` is not defined - Added detection and fix of a V8 ~ Chrome <103 [bug](https://bugs.chromium.org/p/v8/issues/detail?id=12542) of `struturedClone` that returns `null` if cloned object contains multiple references to one error ##### [3.22.4 - 2022.05.03](https://github.com/zloirock/core-js/releases/tag/v3.22.4) - Ensured proper `.length` of polyfilled functions even in compressed code (excepting some ancient engines) - Ensured proper `.name` of polyfilled accessors (excepting some ancient engines) - Ensured proper source / `ToString` conversion of polyfilled accessors - Actualized Rhino compat data - Refactoring ##### [3.22.3 - 2022.04.28](https://github.com/zloirock/core-js/releases/tag/v3.22.3) - Added a fix for FF99+ `Array.prototype.includes` broken on sparse arrays ##### [3.22.2 - 2022.04.21](https://github.com/zloirock/core-js/releases/tag/v3.22.2) - Fixed `URLSearchParams` in IE8- that was broken in the previous release - Fixed `__lookupGetter__` entries ##### [3.22.1 - 2022.04.20](https://github.com/zloirock/core-js/releases/tag/v3.22.1) - Improved some cases of `RegExp` flags handling - Prevented experimental warning in NodeJS ~ 18.0 on detection `fetch` API - Added NodeJS 18.0 compat data ##### [3.22.0 - 2022.04.15](https://github.com/zloirock/core-js/releases/tag/v3.22.0) - [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy): - Moved to Stage 3, [March TC39 meeting](https://github.com/babel/proposals/issues/81#issuecomment-1083449843) - Disabled forced replacement and added `/actual/` entry points for methods from this proposal - `Array.prototype.toSpliced` throws a `TypeError` instead of `RangeError` if the result length is more than `MAX_SAFE_INTEGER`, [proposal-change-array-by-copy/70](https://github.com/tc39/proposal-change-array-by-copy/pull/70) - Added some more `atob` / `btoa` fixes: - NodeJS <17.9 `atob` does not ignore spaces, [node/42530](https://github.com/nodejs/node/issues/42530) - Actual NodeJS `atob` does not validate encoding, [node/42646](https://github.com/nodejs/node/issues/42646) - FF26- implementation does not properly convert argument to string - IE / Edge <16 implementation have wrong arity - Added `/full/` namespace as the replacement for `/features/` since it's more descriptive in context of the rest namespaces (`/es/` ⊆ `/stable/` ⊆ `/actual/` ⊆ `/full/`) - Avoided propagation of removed parts of proposals to upper stages. For example, `%TypedArray%.prototype.groupBy` was removed from the `Array` grouping proposal a long time ago. We can't completely remove this method since it's a breaking change. But this proposal has been promoted to stage 3 - so the proposal should be promoted without this method, this method should not be available in `/actual/` entries - but it should be available in early-stage entries to avoid breakage. - Significant internal refactoring and splitting of modules (but without exposing to public API since it will be a breaking change - it will be exposed in the next major version) - Bug fixes: - Fixed work of non-standard V8 `Error` features with wrapped `Error` constructors, [#1061](https://github.com/zloirock/core-js/issues/1061) - `null` and `undefined` allowed as the second argument of `structuredClone`, [#1056](https://github.com/zloirock/core-js/issues/1056) - Tooling: - Stabilized proposals are filtered out from the `core-js-compat` -> `core-js-builder` -> `core-js-bundle` output. That mean that if the output contains, for example, `es.object.has-own`, the legacy reference to it, `esnext.object.has-own`, no longer added. - Aligned modules filters of [`core-js-builder`](https://github.com/zloirock/core-js/tree/master/packages/core-js-builder) and [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat), now it's `modules` and `exclude` options - Added support of entry points, modules, regexes, and arrays of them to those filters - Missed `targets` option of `core-js-compat` means that the `targets` filter just will not be applied, so the result will contain modules required for all possible engines - Compat data: - `.stack` property on `DOMException` marked as supported from Deno [1.15](https://github.com/denoland/deno/releases/tag/v1.15.0) - Added Deno 1.21 compat data mapping - Added Electron 19.0 and updated 18.0 compat data mapping - Added Samsung Internet 17.0 compat data mapping - Added Opera Android 68 compat data mapping ##### [3.21.1 - 2022.02.17](https://github.com/zloirock/core-js/releases/tag/v3.21.1) - Added a [bug](https://bugs.webkit.org/show_bug.cgi?id=236541)fix for the WebKit `Array.prototype.{ groupBy, groupByToMap }` implementation - `core-js-compat` targets parser transforms engine names to lower case - `atob` / `btoa` marked as [fixed](https://github.com/nodejs/node/pull/41478) in NodeJS 17.5 - Added Electron 18.0 compat data mapping - Added Deno 1.20 compat data mapping ##### [3.21.0 - 2022.02.02](https://github.com/zloirock/core-js/releases/tag/v3.21.0) - Added [Base64 utility methods](https://developer.mozilla.org/en-US/docs/Glossary/Base64): - `atob` - `btoa` - Added the proper validation of arguments to some methods from web standards - Forced replacement of all features from early-stage proposals for avoiding possible web compatibility issues in the future - Added Rhino 1.7.14 compat data - Added Deno 1.19 compat data mapping - Added Opera Android 66 and 67 compat data mapping - Added iOS Safari 15.3 and 15.4 compat data mapping ##### [3.20.3 - 2022.01.15](https://github.com/zloirock/core-js/releases/tag/v3.20.3) - Detects and replaces broken third-party `Function#bind` polyfills, uses only native `Function#bind` in the internals - `structuredClone` should throw an error if no arguments passed - Changed the structure of notes in `__core-js_shared__` ##### [3.20.2 - 2022.01.02](https://github.com/zloirock/core-js/releases/tag/v3.20.2) - Added a fix of [a V8 ~ Chrome 36- `Object.{ defineProperty, defineProperties }` bug](https://bugs.chromium.org/p/v8/issues/detail?id=3334), [Babel issue](https://github.com/babel/babel/issues/14056) - Added fixes of some different `%TypedArray%.prototype.set` bugs, affects modern engines (like Chrome < 95 or Safari < 14.1) ##### [3.20.1 - 2021.12.23](https://github.com/zloirock/core-js/releases/tag/v3.20.1) - Fixed the order of calling reactions of already fulfilled / rejected promises in `Promise.prototype.then`, [#1026](https://github.com/zloirock/core-js/issues/1026) - Fixed possible memory leak in specific promise chains - Fixed some missed dependencies of entries - Added Deno 1.18 compat data mapping ##### [3.20.0 - 2021.12.16](https://github.com/zloirock/core-js/releases/tag/v3.20.0) - Added `structuredClone` method [from the HTML spec](https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone), [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) - Includes all cases of cloning and transferring of required ECMAScript and platform types that can be polyfilled, for the details see [the caveats](https://github.com/zloirock/core-js#caveats-when-using-structuredclone-polyfill) - Uses native structured cloning algorithm implementations where it's possible - Includes the new semantic of errors cloning from [`html/5749`](https://github.com/whatwg/html/pull/5749) - Added `DOMException` polyfill, [the Web IDL spec](https://webidl.spec.whatwg.org/#idl-DOMException), [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/DOMException) - Includes `DOMException` and its attributes polyfills with fixes of many different engines bugs - Includes `DOMException#stack` property polyfill in engines that should have it - Reuses native `DOMException` implementations where it's possible (for example, in old NodeJS where it's not exposed as global) - Added [support of `cause` on all Error types](https://github.com/tc39/proposal-error-cause) - Added `Error.prototype.toString` method polyfill with fixes of many different bugs of JS engines - Added `Number.prototype.toExponential` method polyfill with fixes of many different bugs of JS engines - [`Array` grouping proposal](https://github.com/tc39/proposal-array-grouping): - Moved to stage 3 - Added `Array.prototype.groupByToMap` method - Removed `@@species` support - Added [change `Array` by copy stage 2 proposal](https://github.com/tc39/proposal-change-array-by-copy): - `Array.prototype.toReversed` - `Array.prototype.toSorted` - `Array.prototype.toSpliced` - `Array.prototype.with` - `%TypedArray%.prototype.toReversed` - `%TypedArray%.prototype.toSorted` - `%TypedArray%.prototype.toSpliced` - `%TypedArray%.prototype.with` - Added `Iterator.prototype.toAsync` method from [the iterator helpers stage 2 proposal](https://github.com/tc39/proposal-iterator-helpers) - [`Array.fromAsync` proposal](https://github.com/tc39/proposal-array-from-async) moved to stage 2 - Added [`String.cooked` stage 1 proposal](https://github.com/tc39/proposal-string-cooked) - Added [`Function.prototype.unThis` stage 0 proposal](https://github.com/js-choi/proposal-function-un-this) - Added [`Function.{ isCallable, isConstructor }` stage 0 proposal](https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md): - `Function.isCallable` - `Function.isConstructor` - Added a workaround of most cases breakage modern `String#at` after loading obsolete `String#at` proposal module, [#1019](https://github.com/zloirock/core-js/issues/1019) - Fixed `Array.prototype.{ values, @@iterator }.name` in V8 ~ Chrome 45- - Fixed validation of typed arrays in typed arrays iteration methods in V8 ~ Chrome 50- - Extension of the API, [#1012](https://github.com/zloirock/core-js/issues/1012) - Added a new `core-js/actual/**` namespace - Added entry points for each finished post-ES6 proposal ##### [3.19.3 - 2021.12.06](https://github.com/zloirock/core-js/releases/tag/v3.19.3) - Fixed internal slots check in methods of some built-in types, [#1017](https://github.com/zloirock/core-js/issues/1017) - Fixed `URLSearchParams` iterator `.next` that should be enumerable [by the spec](https://webidl.spec.whatwg.org/#es-iterator-prototype-object) - Refactored `Subscription` - Added NodeJS 17.2 compat data mapping ##### [3.19.2 - 2021.11.29](https://github.com/zloirock/core-js/releases/tag/v3.19.2) - Added a workaround for a UC Browser specific version bug with unobservable `RegExp#sticky` flag, [#1008](https://github.com/zloirock/core-js/issues/1008), [#1015](https://github.com/zloirock/core-js/issues/1015) - Added handling of comments and specific spaces to `Function#name` polyfill, [#1010](https://github.com/zloirock/core-js/issues/1010), thanks [@ildar-shaimordanov](https://github.com/ildar-shaimordanov) - Prevented some theoretical cases of breaking / observing the internal state by patching `Array.prototype[@@species]` - Refactored `URL` and `URLSearchParams` - Added iOS Safari 15.2 compat data mapping - Added Electron 17.0 compat data mapping - Updated Deno compat data mapping ##### [3.19.1 - 2021.11.03](https://github.com/zloirock/core-js/releases/tag/v3.19.1) - Added a workaround for FF26- bug where `ArrayBuffer`s are non-extensible, but `Object.isExtensible` does not report it: - Fixed in `Object.{ isExtensible, isSealed, isFrozen }` and `Reflect.isExtensible` - Fixed handling of `ArrayBuffer`s as collections keys - Fixed `Object#toString` on `AggregateError` in IE10- - Fixed possible lack of dependencies of `WeakMap` in IE8- - `.findLast` methods family marked as supported [from Chrome 97](https://chromestatus.com/features#milestone%3D97) - Fixed inheritance of Electron compat data `web.` modules - Fixed Safari 15.1 compat data (some features were not added) - Added iOS Safari 15.1 compat data mapping ##### [3.19.0 - 2021.10.25](https://github.com/zloirock/core-js/releases/tag/v3.19.0) - Most built-ins are encapsulated in `core-js` for preventing possible cases of breaking / observing the internal state by patching / deleting of them - Avoid `.call` / `.apply` prototype methods that could be patched - Avoid `instanceof` operator - implicit `.prototype` / `@@hasInstance` access that could be patched - Avoid `RegExp#test`, `String#match` and some over methods - implicit `.exec` and `RegExp` well-known symbols access that could be patched - Clearing of `Error` stack from extra entries experimentally added to `AggregateError`, [#996](https://github.com/zloirock/core-js/pull/996), in case lack of problems it will be extended to other cases - In engines with native `Symbol` support, new well-known symbols created with usage `Symbol.for` for ensuring the same keys in different realms, [#998](https://github.com/zloirock/core-js/issues/998) - Added a workaround of [a BrowserFS NodeJS `process` polyfill bug](https://github.com/jvilk/bfs-process/issues/5) that incorrectly reports V8 version that's used in some cases of `core-js` feature detection - Fixed normalization of `message` `AggregateError` argument - Fixed order of arguments conversion in `Math.scale`, [a spec draft bug](https://github.com/rwaldron/proposal-math-extensions/issues/24) - Fixed `core-js-builder` work in NodeJS 17, added a workaround of [`webpack` + NodeJS 17 issue](https://github.com/webpack/webpack/issues/14532) - Added NodeJS 17.0 compat data mapping - Added Opera Android 65 compat data mapping - Updated Electron 16.0 compat data mapping - Many other minor fixes and improvements ##### [3.18.3 - 2021.10.13](https://github.com/zloirock/core-js/releases/tag/v3.18.3) - Fixed the prototype chain of `AggregateError` constructor that should contain `Error` constructor - Fixed incorrect `AggregateError.prototype` properties descriptors - Fixed `InstallErrorCause` internal operation - Added NodeJS 16.11 compat data mapping - Added Deno 1.16 compat data mapping - `Object.hasOwn` marked as supported from Safari 15.1 ##### [3.18.2 - 2021.10.06](https://github.com/zloirock/core-js/releases/tag/v3.18.2) - Early `{ Array, %TypedArray% }.fromAsync` errors moved to the promise, per the latest changes of the spec draft - Internal `ToInteger(OrInfinity)` operation returns `+0` for `-0` argument, ES2020+ update - Fixed theoretical problems with handling bigint in `Number` constructor wrapper - Fixed `String.raw` with extra arguments - Fixed some missed dependencies in entry points - Some other minor fixes and improvements - Refactoring ##### [3.18.1 - 2021.09.27](https://github.com/zloirock/core-js/releases/tag/v3.18.1) - Fixed `String.prototype.substr` feature detection and compat data - Removed mistakenly added `.forEach` from prototypes of some DOM collections where it shouldn't be, [#988](https://github.com/zloirock/core-js/issues/988), [#987](https://github.com/zloirock/core-js/issues/987), thanks [@moorejs](https://github.com/moorejs) - Added `cause` to `AggregateError` constructor implementation (still without adding to the feature detection) - Families of `.at` and `.findLast` methods marked as supported in Safari TP - Added Electron 16.0 compat data mapping ##### [3.18.0 - 2021.09.20](https://github.com/zloirock/core-js/releases/tag/v3.18.0) - Added [`Array.fromAsync` stage 1 proposal](https://github.com/tc39/proposal-array-from-async): - `Array.fromAsync` - `%TypedArray%.fromAsync` - `.name` and `.toString()` on polyfilled functions improved in many different cases - Improved internal `IsConstructor` and `IsCallable` checks - Fixed some internal cases of `GetMethod` operation - Fixed a bug of MS Edge 18- `parseInt` / `parseFloat` with boxed symbols - Fixed `es.array.{ index-of, last-index-of }` compat data - Added Deno 1.15 compat data mapping - Some other minor fixes and optimizations ##### [3.17.3 - 2021.09.09](https://github.com/zloirock/core-js/releases/tag/v3.17.3) - Fixed some possible problems related to possible extension of `%IteratorPrototype%` and `%AsyncIteratorPrototype%` in the future - Fixed `DOMTokenList.prototype.{ forEach, @@iterator, keys, values, entries }` in old WebKit versions where `element.classList` is not an instance of global `DOMTokenList` - Added NodeJS 16.9 compat data mapping - Added Samsung Internet 16.0 compat data mapping ##### [3.17.2 - 2021.09.03](https://github.com/zloirock/core-js/releases/tag/v3.17.2) - Fixed missed cases of ES3 reserved words usage, related to [#980](https://github.com/zloirock/core-js/issues/980) - Fixed dependencies in one missed entry point - Some other minor fixes and optimizations ##### [3.17.1 - 2021.09.02](https://github.com/zloirock/core-js/releases/tag/v3.17.1) - Fixed missed `modules-by-versions` data ##### [3.17.0 - 2021.09.02](https://github.com/zloirock/core-js/releases/tag/v3.17.0) - [Accessible `Object.prototype.hasOwnProperty` (`Object.hasOwn`) proposal](https://github.com/tc39/proposal-accessible-object-hasownproperty) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909288348) - [Relative indexing method (`.at`) proposal](https://github.com/tc39/proposal-relative-indexing-method) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909285053) - Exposed by default the stable version of `String.prototype.at`. It was not exposed because of the conflict with the alternative obsolete proposal (that will be completely removed in the next major version). For the backward compatibility, in the case of loading this proposal, it will be overwritten. - Some more iteration closing fixes - Fixed an ES3 reserved words usage, [#980](https://github.com/zloirock/core-js/issues/980) ##### [3.16.4 - 2021.08.29](https://github.com/zloirock/core-js/releases/tag/v3.16.4) - `AsyncFromSyncIterator` made stricter, related mainly to `AsyncIterator.from` and `AsyncIterator.prototype.flatMap` - Handling of optional `.next` arguments in `(Async)Iterator` methods is aligned with the current spec draft (mainly - ignoring the first passed to `.next` argument in built-in generators) - Behavior of `.next`, `.return`, `.throw` methods on `AsyncIterator` helpers proxy iterators aligned with the current spec draft (built-in async generators) (mainly - some early errors moved to returned promises) - Fixed some cases of safe iteration closing - Fixed dependencies of some entry points ##### [3.16.3 - 2021.08.25](https://github.com/zloirock/core-js/releases/tag/v3.16.3) - Fixed `CreateAsyncFromSyncIterator` semantic in `AsyncIterator.from`, related to [#765](https://github.com/zloirock/core-js/issues/765) - Added a workaround of a specific case of broken `Object.prototype`, [#973](https://github.com/zloirock/core-js/issues/973) ##### [3.16.2 - 2021.08.17](https://github.com/zloirock/core-js/releases/tag/v3.16.2) - Added a workaround of a Closure Compiler unsafe optimization, [#972](https://github.com/zloirock/core-js/issues/972) - One more fix crashing of `Object.create(null)` on WSH, [#970](https://github.com/zloirock/core-js/issues/970) - Added Deno 1.14 compat data mapping ##### [3.16.1 - 2021.08.09](https://github.com/zloirock/core-js/releases/tag/v3.16.1) - Fixed microtask implementation on iOS Pebble, [#967](https://github.com/zloirock/core-js/issues/967) - Fixed some entry points - Improved old Safari compat data ##### [3.16.0 - 2021.07.30](https://github.com/zloirock/core-js/releases/tag/v3.16.0) - [`Array` find from last proposal](https://github.com/tc39/proposal-array-find-from-last) moved to the stage 3, [July 2021 TC39 meeting](https://github.com/tc39/proposal-array-find-from-last/pull/47) - [`Array` filtering stage 1 proposal](https://github.com/tc39/proposal-array-filtering): - `Array.prototype.filterReject` replaces `Array.prototype.filterOut` - `%TypedArray%.prototype.filterReject` replaces `%TypedArray%.prototype.filterOut` - Added [`Array` grouping stage 1 proposal](https://github.com/tc39/proposal-array-grouping): - `Array.prototype.groupBy` - `%TypedArray%.prototype.groupBy` - Work with symbols made stricter: some missed before cases of methods that should throw an error on symbols now works as they should - Handling `@@toPrimitive` in some cases of `ToPrimitive` internal logic made stricter - Fixed work of `Request` with polyfilled `URLSearchParams`, [#965](https://github.com/zloirock/core-js/issues/965) - Fixed possible exposing of collections elements metadata in some cases, [#427](https://github.com/zloirock/core-js/issues/427) - Fixed crashing of `Object.create(null)` on WSH, [#966](https://github.com/zloirock/core-js/issues/966) - Fixed some cases of typed arrays subclassing logic - Fixed a minor bug related to string conversion in `RegExp#exec` - Fixed `Date.prototype.getYear` feature detection - Fixed content of some entry points - Some minor optimizations and refactoring - Deno: - Added Deno support (sure, after bundling since Deno does not support CommonJS) - Allowed `deno` target in `core-js-compat` / `core-js-builder` - A bundle for Deno published on [deno.land/x/corejs](https://deno.land/x/corejs) - Added / updated compat data / mapping: - Deno 1.0-1.13 - NodeJS up to 16.6 - iOS Safari up to 15.0 - Samsung Internet up to 15.0 - Opera Android up to 64 - `Object.hasOwn` marked as supported from [V8 9.3](https://chromestatus.com/feature/5662263404920832) and [FF92](https://bugzilla.mozilla.org/show_bug.cgi?id=1721149) - `Date.prototype.getYear` marked as not supported in IE8- - Added `summary` option to `core-js-builder`, see more info in the [`README`](https://github.com/zloirock/core-js/blob/master/packages/core-js-builder/README.md), [#910](https://github.com/zloirock/core-js/issues/910) ##### [3.15.2 - 2021.06.29](https://github.com/zloirock/core-js/releases/tag/v3.15.2) - Worked around breakage related to `zone.js` loaded before `core-js`, [#953](https://github.com/zloirock/core-js/issues/953) - Added NodeJS 16.4 -> Chrome 91 compat data mapping ##### [3.15.1 - 2021.06.23](https://github.com/zloirock/core-js/releases/tag/v3.15.1) - Fixed cloning of regex through `RegExp` constructor, [#948](https://github.com/zloirock/core-js/issues/948) ##### [3.15.0 - 2021.06.21](https://github.com/zloirock/core-js/releases/tag/v3.15.0) - Added `RegExp` named capture groups polyfill, [#521](https://github.com/zloirock/core-js/issues/521), [#944](https://github.com/zloirock/core-js/issues/944) - Added `RegExp` `dotAll` flag polyfill, [#792](https://github.com/zloirock/core-js/issues/792), [#944](https://github.com/zloirock/core-js/issues/944) - Added missed polyfills of [Annex B](https://tc39.es/ecma262/#sec-additional-built-in-properties) features (required mainly for some non-browser engines), [#336](https://github.com/zloirock/core-js/issues/336), [#945](https://github.com/zloirock/core-js/issues/945): - `escape` - `unescape` - `String.prototype.substr` - `Date.prototype.getYear` - `Date.prototype.setYear` - `Date.prototype.toGMTString` - Fixed detection of forbidden host code points in `URL` polyfill - Allowed `rhino` target in `core-js-compat` / `core-js-builder`, added compat data for `rhino` 1.7.13, [#942](https://github.com/zloirock/core-js/issues/942), thanks [@gausie](https://github.com/gausie) - `.at` marked as supported from FF90 ##### [3.14.0 - 2021.06.05](https://github.com/zloirock/core-js/releases/tag/v3.14.0) - Added polyfill of stable sort in `{ Array, %TypedArray% }.prototype.sort`, [#769](https://github.com/zloirock/core-js/issues/769), [#941](https://github.com/zloirock/core-js/issues/941) - Fixed `Safari` 14.0- `%TypedArray%.prototype.sort` validation of arguments bug - `.at` marked as supported from V8 9.2 ##### [3.13.1 - 2021.05.29](https://github.com/zloirock/core-js/releases/tag/v3.13.1) - Overwrites `get-own-property-symbols` third-party `Symbol` polyfill if it's used since it causes a stack overflow, [#774](https://github.com/zloirock/core-js/issues/774) - Added a workaround of possible browser crash on `Object.prototype` accessors methods in WebKit ~ Android 4.0, [#232](https://github.com/zloirock/core-js/issues/232) ##### [3.13.0 - 2021.05.26](https://github.com/zloirock/core-js/releases/tag/v3.13.0) - Accessible `Object#hasOwnProperty` (`Object.hasOwn`) proposal moved to the stage 3, [May 2021 TC39 meeting](https://github.com/babel/proposals/issues/74#issuecomment-848121673) ##### [3.12.1 - 2021.05.09](https://github.com/zloirock/core-js/releases/tag/v3.12.1) - Fixed some cases of `Function#toString` with multiple `core-js` instances - Fixed some possible `String#split` polyfill problems in V8 5.1 ##### [3.12.0 - 2021.05.06](https://github.com/zloirock/core-js/releases/tag/v3.12.0) - Added well-known symbol `Symbol.metadata` for [decorators stage 2 proposal](https://github.com/tc39/proposal-decorators) - Added well-known symbol `Symbol.matcher` for [pattern matching stage 1 proposal](https://github.com/tc39/proposal-pattern-matching) - Fixed regression of V8 ~ Node 0.12 `String(Symbol())` bug, [#933](https://github.com/zloirock/core-js/issues/933) ##### [3.11.3 - 2021.05.05](https://github.com/zloirock/core-js/releases/tag/v3.11.3) - Native promise-based APIs `Promise#{ catch, finally }` returns polyfilled `Promise` instances when it's required ##### [3.11.2 - 2021.05.03](https://github.com/zloirock/core-js/releases/tag/v3.11.2) - Added a workaround of WebKit ~ iOS 10.3 Safari `Promise` bug, [#932](https://github.com/zloirock/core-js/issues/932) - `Promise#then` of incorrect native `Promise` implementations with correct subclassing no longer wrapped - Changed the order of `Promise` feature detection, removed unhandled rejection tracking check in non-browser non-node platforms ##### [3.11.1 - 2021.04.28](https://github.com/zloirock/core-js/releases/tag/v3.11.1) - Made `instanceof Promise` and `.constructor === Promise` work with polyfilled `Promise` for all native promise-based APIs - Added a workaround for some buggy V8 versions \~4.5 related to fixing of `%TypedArray%` static methods, [#564](https://github.com/zloirock/core-js/issues/564) ##### [3.11.0 - 2021.04.22](https://github.com/zloirock/core-js/releases/tag/v3.11.0) - Added [accessible `Object#hasOwnProperty` stage 2 proposal](https://github.com/tc39/proposal-accessible-object-hasownproperty) - `Object.hasOwn` method - Fixed a possible `RegExp` constructor problem with multiple global `core-js` instances ##### [3.10.2 - 2021.04.19](https://github.com/zloirock/core-js/releases/tag/v3.10.2) - `URL` and `URLSearchParams` marked as supported from Safari 14.0 - Polyfilled built-in constructors protected from calling on instances ##### [3.10.1 - 2021.04.08](https://github.com/zloirock/core-js/releases/tag/v3.10.1) - Prevented possible `RegExp#split` problems in old engines, [#751](https://github.com/zloirock/core-js/issues/751), [#919](https://github.com/zloirock/core-js/issues/919) - Detection of Safari 10 string padding bug extended to some Safari-based browsers ##### [3.10.0 - 2021.03.31](https://github.com/zloirock/core-js/releases/tag/v3.10.0) - [`Array` find from last proposal](https://github.com/tc39/proposal-array-find-from-last) moved to the stage 2, [March TC39 meeting](https://github.com/babel/proposals/issues/71#issuecomment-795916535) - Prevented possible `RegExp#exec` problems in some old engines, [#920](https://github.com/zloirock/core-js/issues/920) - Updated compat data mapping: - NodeJS up to 16.0 - Electron up to 13.0 - Samsung Internet up to 14.0 - Opera Android up to 62 - The rest automatically ##### [3.9.1 - 2021.03.01](https://github.com/zloirock/core-js/releases/tag/v3.9.1) - Added a workaround for Chrome 38-40 bug which does not allow to inherit symbols (incl. well-known) from DOM collections prototypes to instances, [#37](https://github.com/zloirock/core-js/issues/37) - Used `NumericRangeIterator` as toStringTag instead of `RangeIterator` in `{ Number, BigInt }.range` iterator, per [this PR](https://github.com/tc39/proposal-Number.range/pull/46) - TypedArray constructors marked as supported from Safari 14.0 - Updated compat data mapping for iOS Safari and Opera for Android ##### [3.9.0 - 2021.02.19](https://github.com/zloirock/core-js/releases/tag/v3.9.0) - Added [`Array` find from last stage 1 proposal](https://github.com/tc39/proposal-array-find-from-last) - `Array#findLast` - `Array#findLastIndex` - `%TypedArray%#findLast` - `%TypedArray%#findLastIndex` - Added `%TypedArray%#uniqueBy` method for [array deduplication stage 1 proposal](https://github.com/tc39/proposal-array-unique) - `%TypedArray%#uniqueBy` - Dropped `ToLength` detection from array methods feature detection which could cause hanging FF11-21 and some versions of old WebKit, [#764](https://github.com/zloirock/core-js/issues/764) - Minified bundle from `core-js-bundle` uses `terser` instead of `uglify-js` ##### [3.8.3 - 2021.01.19](https://github.com/zloirock/core-js/releases/tag/v3.8.3) - Fixed some more issues related to FF44- legacy `Iterator`, [#906](https://github.com/zloirock/core-js/issues/906) ##### [3.8.2 - 2021.01.03](https://github.com/zloirock/core-js/releases/tag/v3.8.2) - Fixed handling of special replacements patterns in `String#replaceAll`, [#900](https://github.com/zloirock/core-js/issues/900) - Fixed iterators dependencies of `Promise.any` and `Promise.allSettled` entries - Fixed microtask implementation on WebOS, [#898](https://github.com/zloirock/core-js/issues/898), [#901](https://github.com/zloirock/core-js/issues/901) ##### [3.8.1 - 2020.12.06](https://github.com/zloirock/core-js/releases/tag/v3.8.1) - Fixed work of new `%TypedArray%` methods on `BigInt` arrays - Added ESNext methods to ES3 workaround for `Number` constructor wrapper ##### [3.8.0 - 2020.11.26](https://github.com/zloirock/core-js/releases/tag/v3.8.0) - Added [relative indexing method stage 3 proposal](https://github.com/tc39/proposal-relative-indexing-method) - `Array#at` - `%TypedArray%#at` - Added [`Number.range` stage 1 proposal](https://github.com/tc39/proposal-Number.range) - `Number.range` - `BigInt.range` - Added [array filtering stage 1 proposal](https://github.com/tc39/proposal-array-filtering) - `Array#filterOut` - `%TypedArray%#filterOut` - Added [array deduplication stage 1 proposal](https://github.com/tc39/proposal-array-unique) - `Array#uniqueBy` - Added code points / code units explicit feature detection in `String#at` for preventing breakage code which use obsolete `String#at` proposal polyfill - Added the missed `(es|stable)/instance/replace-all` entries - Updated compat data mapping for Opera - from Opera 69, the difference with Chrome versions increased to 14 - Compat data mapping for modern Android WebView to Chrome moved from targets parser directly to compat data - Deprecate `core-js-builder` `blacklist` option in favor of `exclude` ##### [2.6.12 [LEGACY] - 2020.11.26](https://github.com/zloirock/core-js/releases/tag/v2.6.12) - Added code points / code units explicit feature detection in `String#at` for preventing breakage code which use obsolete `String#at` proposal polyfill - Added `OPEN_SOURCE_CONTRIBUTOR` detection in `postinstall` - Added Drone CI detection in `postinstall` ##### [3.7.0 - 2020.11.06](https://github.com/zloirock/core-js/releases/tag/v3.7.0) - `String#replaceAll` moved to the stable ES, [per June TC39 meeting](https://github.com/tc39/notes/blob/master/meetings/2020-06/june-2.md#stringprototypereplaceall-for-stage-4) - `Promise.any` and `AggregateError` moved to the stable ES, [per July TC39 meeting](https://github.com/tc39/notes/blob/master/meetings/2020-07/july-21.md#promiseany--aggregateerror-for-stage-4) - Added `Reflect[@@toStringTag]`, [per July TC39 meeting](https://github.com/tc39/ecma262/pull/2057) - Forced replacement of `Array#{ reduce, reduceRight }` in Chrome 80-82 because of [a bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1049982), [#766](https://github.com/zloirock/core-js/issues/766) - Following the changes in [the `upsert` proposal](https://github.com/tc39/proposal-upsert), `{ Map, WeakMap }#emplace` replace `{ Map, WeakMap }#upsert`, these obsolete methods will be removed in the next major release - [By the current spec](https://tc39.es/ecma262/#sec-aggregate-error-constructor), `AggregateError#errors` is own data property - Added correct iteration closing in the iteration helpers according to the current version of [the proposal](https://tc39.es/proposal-iterator-helpers) - `process.nextTick` have a less priority than `Promise` in the microtask implementation, [#855](https://github.com/zloirock/core-js/issues/855) - Fixed microtask implementation in engines with `MutationObserver`, but without `document`, [#865](https://github.com/zloirock/core-js/issues/865), [#866](https://github.com/zloirock/core-js/issues/866) - Fixed `core-js-builder` with an empty (after the targets engines or another filtration) modules list, [#822](https://github.com/zloirock/core-js/issues/822) - Fixed possible twice call of `window.onunhandledrejection`, [#760](https://github.com/zloirock/core-js/issues/760) - Fixed some possible problems related multiple global copies of `core-js`, [#880](https://github.com/zloirock/core-js/issues/880) - Added a workaround for 3rd party `Reflect.set` polyfill bug, [#847](https://github.com/zloirock/core-js/issues/847) - Updated compat data: - Chrome up to 86 - FF up to 82 - Safari up to 14 - Updated compat data mapping: - iOS up to 14 - NodeJS up to 15.0 - Electron up to 11.0 - Samsung Internet up to 13.0 - Opera Android up to 60 - The rest automatically - Updated all required dependencies ##### [3.6.5 - 2020.04.09](https://github.com/zloirock/core-js/releases/tag/v3.6.5) - Updated Browserslist [#755](https://github.com/zloirock/core-js/issues/755) - Fixed `setImmediate` in Safari [#770](https://github.com/zloirock/core-js/issues/770), thanks [@dtinth](https://github.com/dtinth) - Fixed some regexp, thanks [@scottarc](https://github.com/scottarc) - Added OPEN_SOURCE_CONTRIBUTOR detection in `postinstall`, thanks [@scottarc](https://github.com/scottarc) - Added Drone CI in `postinstall` CI detection [#781](https://github.com/zloirock/core-js/issues/781) ##### [3.6.4 - 2020.01.14](https://github.com/zloirock/core-js/releases/tag/v3.6.4) - Prevented a possible almost infinite loop in non-standard implementations of some backward iteration array methods ##### [3.6.3 - 2020.01.11](https://github.com/zloirock/core-js/releases/tag/v3.6.3) - Fixed replacement of substitutes of undefined capture groups in `.replace` in Safari 13.0-, [#471](https://github.com/zloirock/core-js/issues/471), [#745](https://github.com/zloirock/core-js/issues/745), thanks [@mattclough1](https://github.com/mattclough1) - Improved compat data for old engines ##### [3.6.2 - 2020.01.07](https://github.com/zloirock/core-js/releases/tag/v3.6.2) - Fixed early implementations of `Array#{ every, forEach, includes, indexOf, lastIndexOf, reduce, reduceRight, slice, some, splice }` for the usage of `ToLength` - Added `RegExp#exec` dependency to methods which depends on the correctness of logic of this method (`3.6.0-3.6.1` issue), [#741](https://github.com/zloirock/core-js/issues/741) - Refactored some internals ##### [3.6.1 - 2019.12.25](https://github.com/zloirock/core-js/releases/tag/v3.6.1) - Fixed a bug related `Symbol` with multiple copies of `core-js` (for `3.4.2-3.6.0`), [#736](https://github.com/zloirock/core-js/issues/736) - Refactored some tools ##### [3.6.0 - 2019.12.19](https://github.com/zloirock/core-js/releases/tag/v3.6.0) - Added support of sticky (`y`) `RegExp` flag, [#372](https://github.com/zloirock/core-js/issues/372), [#732](https://github.com/zloirock/core-js/issues/732), [#492](https://github.com/zloirock/core-js/issues/492), thanks [@cvle](https://github.com/cvle) and [@nicolo-ribaudo](https://github.com/nicolo-ribaudo) - Added `RegExp#test` delegation to `RegExp#exec`, [#732](https://github.com/zloirock/core-js/issues/732), thanks [@cvle](https://github.com/cvle) - Fixed some cases of `Object.create(null)` in IE8-, [#727](https://github.com/zloirock/core-js/issues/727), [#728](https://github.com/zloirock/core-js/issues/728), thanks [@aleen42](https://github.com/aleen42) - Allowed object of minimum environment versions as `core-js-compat` and `core-js-builder` `targets` argument - Allowed corresponding to Babel `targets.esmodules`, `targets.browsers`, `targets.node` options in `core-js-compat` and `core-js-builder` - Engines in compat data and results of targets parsing sorted alphabetically - Fixed `features/instance/match-all` entry compat data - Fixed `Array.prototype[@@unscopables]` descriptor (was writable) - Added Samsung Internet 11 compat data mapping ##### [3.5.0 - 2019.12.12](https://github.com/zloirock/core-js/releases/tag/v3.5.0) - Added [object iteratoration stage 1 proposal](https://github.com/tc39/proposal-object-iteration): - `Object.iterateKeys` - `Object.iterateValues` - `Object.iterateEntries` ##### [3.4.8 - 2019.12.09](https://github.com/zloirock/core-js/releases/tag/v3.4.8) - Added one more workaround for broken in previous versions `inspectSource` helper, [#719](https://github.com/zloirock/core-js/issues/719) - Added Opera Mobile compat data - Updated Samsung Internet, iOS, old Node and Android compat data mapping - `es.string.match-all` marked as completely supported in FF73 - Generate `core-js-compat/modules` since often we need just the list of `core-js` modules ##### [2.6.11 [LEGACY] - 2019.12.09](https://github.com/zloirock/core-js/releases/tag/v2.6.11) - Returned usage of `node -e` in the `postinstall` scripts for better cross-platform compatibility, [#582](https://github.com/zloirock/core-js/issues/582) - Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707) ##### [3.4.7 - 2019.12.03](https://github.com/zloirock/core-js/releases/tag/v3.4.7) - Fixed an NPM publishing issue ##### [3.4.6 - 2019.12.03](https://github.com/zloirock/core-js/releases/tag/v3.4.6) - Improved iOS compat data - added missed mapping iOS 12.2 -> Safari 12.1, added bug fixes from patch releases - Added Safari 13.1 compat data - Added missed in `core-js-compat` helpers `ie_mob` normalization - Normalize the result of `getModulesListForTargetVersion` `core-js-compat` helper - Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707) ##### [3.4.5 - 2019.11.28](https://github.com/zloirock/core-js/releases/tag/v3.4.5) - Detect incorrect order of operations in `Object.assign`, MS Edge bug - Detect usage of `ToLength` in `Array#{ filter, map }`, FF48-49 and MS Edge 14- issues - Detect incorrect MS Edge 17-18 `Reflect.set` which allows setting the property to object with non-writable property on the prototype - Fixed `inspectSource` helper with multiple `core-js` copies and some related features like some edge cases of `Promise` feature detection ##### [3.4.4 - 2019.11.27](https://github.com/zloirock/core-js/releases/tag/v3.4.4) - Added feature detection for Safari [non-generic `Promise#finally` bug](https://bugs.webkit.org/show_bug.cgi?id=200829) **(critical for `core-js-pure`)** - Fixed missed `esnext.string.code-points` in `core-js/features/string` entry point - Updated `Iterator` proposal feature detection for the case of non-standard `Iterator` in FF44- ##### [3.4.3 - 2019.11.26](https://github.com/zloirock/core-js/releases/tag/v3.4.3) - Fixed missed `es.json.stringify` and some modules from iteration helpers proposal in some entry points **(includes the root entry point)** - Added a workaround of `String#{ endsWith, startsWith }` MDN polyfills bugs, [#702](https://github.com/zloirock/core-js/issues/702) - Fixed `.size` property descriptor of `Map` / `Set` in the pure version - Refactoring, some internal improvements ##### [3.4.2 - 2019.11.22](https://github.com/zloirock/core-js/releases/tag/v3.4.2) - Don't use polyfilled symbols as internal uids, a workaround for some incorrect use cases - `String#replaceAll` is available only in nightly FF builds - Improved `Promise` feature detection for the case of V8 6.6 with multiple `core-js` copies - Some internals optimizations - Added Node 13.2 -> V8 7.9 compat data mapping - Returned usage of `node -e` in `postinstall` scripts ##### [3.4.1 - 2019.11.12](https://github.com/zloirock/core-js/releases/tag/v3.4.1) - Throw when `(Async)Iterator#flatMap` mapper returns a non-iterable, per [tc39/proposal-iterator-helpers/55](https://github.com/tc39/proposal-iterator-helpers/issues/55) and [tc39/proposal-iterator-helpers/59](https://github.com/tc39/proposal-iterator-helpers/pull/59) - Removed own `AggregateError#toString`, per [tc39/proposal-promise-any/49](https://github.com/tc39/proposal-promise-any/pull/49) - Global `core-js` `Promise` polyfill passes feature detection in the pure versions - Fixed indexes in `String#replaceAll` callbacks - `String#replaceAll` marked as supported by FF72 ##### [3.4.0 - 2019.11.07](https://github.com/zloirock/core-js/releases/tag/v3.4.0) - Added [well-formed `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify), ES2019 feature, thanks [@ExE-Boss](https://github.com/ExE-Boss) and [@WebReflection](https://github.com/WebReflection) for the idea - Fixed `Math.signbit`, [#687](https://github.com/zloirock/core-js/issues/687), thanks [@chicoxyzzy](https://github.com/chicoxyzzy) ##### [3.3.6 - 2019.11.01](https://github.com/zloirock/core-js/releases/tag/v3.3.6) - Don't detect Chakra-based Edge as Chrome in the `userAgent` parsing - Fixed inheritance in typed array constructors wrappers, [#683](https://github.com/zloirock/core-js/issues/683) - Added one more workaround for correct work of early `fetch` implementations with polyfilled `URLSearchParams`, [#680](https://github.com/zloirock/core-js/issues/680) ##### [3.3.5 - 2019.10.29](https://github.com/zloirock/core-js/releases/tag/v3.3.5) - Added a workaround of V8 deoptimization which causes serious performance degradation (~4x in my tests) of `Array#concat`, [#679](https://github.com/zloirock/core-js/issues/679) - Added a workaround of V8 deoptimization which causes slightly performance degradation of `Promise`, [#679](https://github.com/zloirock/core-js/issues/679) - Added `(Async)Iterator.prototype.constructor -> (Async)Iterator` per [this issue](https://github.com/tc39/proposal-iterator-helpers/issues/60) - Added compat data for Chromium-based Edge ##### [3.3.4 - 2019.10.25](https://github.com/zloirock/core-js/releases/tag/v3.3.4) - Added a workaround of V8 deoptimization which causes serious performance degradation (~20x in my tests) of some `RegExp`-related methods like `String#split`, [#306](https://github.com/zloirock/core-js/issues/306) - Added a workaround of V8 deoptimization which causes serious performance degradation (up to 100x in my tests) of `Array#splice` and slightly `Array#{ filter, map }`, [#677](https://github.com/zloirock/core-js/issues/677) - Fixed work of `fetch` with polyfilled `URLSearchParams`, [#674](https://github.com/zloirock/core-js/issues/674) - Fixed an edge case of `String#replaceAll` with an empty search value - Added compat data for Chrome 80 - `package-lock.json` no longer generated in libraries ##### [3.3.3 - 2019.10.22](https://github.com/zloirock/core-js/releases/tag/v3.3.3) - `gopher` removed from `URL` special cases per [this issue](https://github.com/whatwg/url/issues/342) and [this PR](https://github.com/whatwg/url/pull/453) - Added compat data for iOS 13 and Node 13.0 ##### [3.3.2 - 2019.10.14](https://github.com/zloirock/core-js/releases/tag/v3.3.2) - Fixed compatibility of `core-js-compat` with Node 6 and Yarn, [#669](https://github.com/zloirock/core-js/issues/669) ##### [3.3.1 - 2019.10.13](https://github.com/zloirock/core-js/releases/tag/v3.3.1) - Fixed an NPM publishing issue ##### [3.3.0 - 2019.10.13](https://github.com/zloirock/core-js/releases/tag/v3.3.0) - **`String#{ matchAll, replaceAll }` throws an error on non-global regex argument per [the decision from TC39 meetings](https://github.com/tc39/ecma262/pull/1716) (+ [this PR](https://github.com/tc39/proposal-string-replaceall/pull/24)). It's a breaking change, but since it's a breaking change in the ES spec, it's added at the minor release** - `globalThis` moved to stable ES, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537217903) - `Promise.any` moved to stage 3, some minor internal changes, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-538084885) - `String#replaceAll` moved to stage 3, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537530013) - Added [iterator helpers stage 2 proposal](https://github.com/tc39/proposal-iterator-helpers): - `Iterator` - `Iterator.from` - `Iterator#asIndexedPairs` - `Iterator#drop` - `Iterator#every` - `Iterator#filter` - `Iterator#find` - `Iterator#flatMap` - `Iterator#forEach` - `Iterator#map` - `Iterator#reduce` - `Iterator#some` - `Iterator#take` - `Iterator#toArray` - `Iterator#@@toStringTag` - `AsyncIterator` - `AsyncIterator.from` - `AsyncIterator#asIndexedPairs` - `AsyncIterator#drop` - `AsyncIterator#every` - `AsyncIterator#filter` - `AsyncIterator#find` - `AsyncIterator#flatMap` - `AsyncIterator#forEach` - `AsyncIterator#map` - `AsyncIterator#reduce` - `AsyncIterator#some` - `AsyncIterator#take` - `AsyncIterator#toArray` - `AsyncIterator#@@toStringTag` - Updated `Map#upsert` (`Map#updateOrInsert` before) [proposal](https://github.com/thumbsupep/proposal-upsert) - Moved to stage 2, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537606117) - `Map#updateOrInsert` renamed to `Map#upsert` - Added `WeakMap#upsert` - You can don't pass one of the callbacks - Added a workaround for iOS Safari MessageChannel + bfcache bug, [#624](https://github.com/zloirock/core-js/issues/624) - Added a workaround for Chrome 33 / Android 4.4.4 `Promise` bug, [#640](https://github.com/zloirock/core-js/issues/640) - Replaced broken `URL` constructor in Safari and `URLSearchParams` in Chrome 66-, [#656](https://github.com/zloirock/core-js/issues/656) - Added compat data for Node up to 12.11, FF 69, Samsung up to 10.2 and Phantom 1.9 - `Math.hypot` marked as not supported in Chrome 77 since [a bug in this method](https://bugs.chromium.org/p/v8/issues/detail?id=9546) was not fixed before the stable Chrome 77 release - Fixed unnecessary exposing on `Symbol.matchAll` in `esnext.string.match-all`, [#626](https://github.com/zloirock/core-js/issues/626) - Fixed missed cases [access the `.next` method once, at the beginning, of the iteration protocol](https://github.com/tc39/ecma262/issues/976) - Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597), thanks [@remy](https://github.com/remy) ##### [2.6.10 [LEGACY] - 2019.10.13](https://github.com/zloirock/core-js/releases/tag/v2.6.10) - Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597) ##### [3.2.1 - 2019.08.12](https://github.com/zloirock/core-js/releases/tag/v3.2.1) - Added a workaround for possible recursion in microtasks caused by conflicts with other `Promise` polyfills, [#615](https://github.com/zloirock/core-js/issues/615) ##### [3.2.0 - 2019.08.09](https://github.com/zloirock/core-js/releases/tag/v3.2.0) - `Promise.allSettled` moved to stable ES, per July TC39 meeting - `Promise.any` moved to stage 2, `.errors` property of `AggregateError` instances made non-enumerable, per July TC39 meeting - `using` statement proposal moved to stage 2, added `Symbol.asyncDispose`, per July TC39 meeting - Added `Array.isTemplateObject` [stage 2 proposal](https://github.com/tc39/proposal-array-is-template-object), per June TC39 meeting - Added `Map#updateOrInsert` [stage 1 proposal](https://docs.google.com/presentation/d/1_xtrGSoN1-l2Q74eCXPHBbbrBHsVyqArWN0ebnW-pVQ/), per July TC39 meeting - Added a fix for [`Math.hypot` V8 7.7 bug](https://bugs.chromium.org/p/v8/issues/detail?id=9546), since it's still not stable without adding results to `core-js-compat` - Added a workaround for APIs where not possible to replace broken native `Promise`, [#579](https://github.com/zloirock/core-js/issues/579) - added `.finally` and patched `.then` to / on native `Promise` prototype - Fixed crashing of Opera Presto, [#595](https://github.com/zloirock/core-js/issues/595) - Fixed incorrect early breaking of `{ Map, Set, WeakMap, WeakSet }.deleteAll` - Fixed some missed dependencies in entry points - Added compat data for Node 12.5, FF 67, Safari 13 - Added support of `DISABLE_OPENCOLLECTIVE` env variable to `postinstall` script - Removed `core-js-pure` dependency from `core-js-compat`, [#590](https://github.com/zloirock/core-js/issues/590) - Fixed generation of `core-js-compat` on Windows, [#606](https://github.com/zloirock/core-js/issues/606) ##### [3.1.4 - 2019.06.15](https://github.com/zloirock/core-js/releases/tag/v3.1.4) - Refactoring. Many minor internal improvements and fixes like: - Improved `Symbol.keyFor` complexity to `O(1)` - Fixed the order of arguments validation in `String.prototype.{ endsWith, includes, startsWith }` - Internal implementation of `RegExp#flags` helper now respect `dotAll` flag (mainly related to the `pure` version) - Performance optimizations related old V8 - Etc. ##### [3.1.3 - 2019.05.27](https://github.com/zloirock/core-js/releases/tag/v3.1.3) - Fixed `core-js/features/reflect/delete-metadata` entry point - Some fixes and improvements of the `postinstall` script like support `npm` color config ([#556](https://github.com/zloirock/core-js/issues/556)) or adding support of `ADBLOCK` env variable - Refactoring and some minor fixes ##### [2.6.9 [LEGACY] - 2019.05.27](https://github.com/zloirock/core-js/releases/tag/v2.6.9) - Some fixes and improvements of the `postinstall` script like support `npm` color config ([#556](https://github.com/zloirock/core-js/issues/556)) or adding support of `ADBLOCK` env variable ##### [3.1.2 - 2019.05.22](https://github.com/zloirock/core-js/releases/tag/v3.1.2) - Added a workaround of a strange `npx` bug on `postinstall`, [#551](https://github.com/zloirock/core-js/issues/551) ##### [2.6.8 [LEGACY] - 2019.05.22](https://github.com/zloirock/core-js/releases/tag/v2.6.8) - Added a workaround of a strange `npx` bug on `postinstall`, [#551](https://github.com/zloirock/core-js/issues/551) ##### [3.1.1 - 2019.05.21](https://github.com/zloirock/core-js/releases/tag/v3.1.1) - Added one more workaround of alternative not completely correct `Symbol` polyfills, [#550](https://github.com/zloirock/core-js/issues/550), [#554](https://github.com/zloirock/core-js/issues/554) - Reverted `esnext.string.match-all` in some entry points for fix autogeneration of `core-js-compat/entries` and backward `@babel/preset-env` compatibility ##### [2.6.7 [LEGACY] - 2019.05.21](https://github.com/zloirock/core-js/releases/tag/v2.6.7) - Added one more workaround of alternative not completely correct `Symbol` polyfills, [#550](https://github.com/zloirock/core-js/issues/550), [#554](https://github.com/zloirock/core-js/issues/554) ##### [3.1.0 - 2019.05.20](https://github.com/zloirock/core-js/releases/tag/v3.1.0) - `String#matchAll` moved to stable ES, exposed `Symbol.matchAll`, [#516](https://github.com/zloirock/core-js/issues/516) - `Promise.allSettled` moved to stage 3, [#515](https://github.com/zloirock/core-js/issues/515) - `String#replaceAll` moved to stage 2, behavior updated by the spec draft, [#524](https://github.com/zloirock/core-js/issues/524) - `Promise.any` moved to stage 1, [#517](https://github.com/zloirock/core-js/issues/517) - Removed `es.regexp.flags` dependency from `es.regexp.to-string`, [#536](https://github.com/zloirock/core-js/issues/536), [#537](https://github.com/zloirock/core-js/issues/537) - Fixed IE8- non-enumerable properties support in `Object.{ assign, entries, values }`, [#541](https://github.com/zloirock/core-js/issues/541) - Fixed support of primitives in `Object.getOwnPropertySymbols` in Chrome 38 / 39, [#539](https://github.com/zloirock/core-js/issues/539) - `window.postMessage`-based task implementation uses location origin over `'*'`, [#542](https://github.com/zloirock/core-js/issues/542) - Lookup `PromiseConstructor.resolve` only once in `Promise` combinators, [tc39/ecma262#1506](https://github.com/tc39/ecma262/pull/1506) - Temporarily removed `core-js` dependency from `core-js-compat` since it's required for missed at this moment feature - Show a message on `postinstall` - Added compat data for Chrome 76, FF 67, Node 12 ##### [2.6.6 [LEGACY] - 2019.05.20](https://github.com/zloirock/core-js/releases/tag/v2.6.6) - Fixed IE8- non-enumerable properties support in `Object.{ assign, entries, values }`, [#541](https://github.com/zloirock/core-js/issues/541) - Fixed support of primitives in `Object.getOwnPropertySymbols` in Chrome 38 / 39, [#539](https://github.com/zloirock/core-js/issues/539) - Show a message on `postinstall` ##### [3.0.1 - 2019.04.06](https://github.com/zloirock/core-js/releases/tag/v3.0.1) - Fixed some cases of work with malformed URI sequences in `URLSearchParams`, [#525](https://github.com/zloirock/core-js/issues/525) - Added a workaround for a rollup issue, [#513](https://github.com/zloirock/core-js/issues/513) ##### [3.0.0 - 2019.03.19](https://github.com/zloirock/core-js/releases/tag/v3.0.0) - Features - Add new features: - `Object.fromEntries` ([ECMAScript 2019](https://github.com/tc39/proposal-object-from-entries)) - `Symbol#description` ([ECMAScript 2019](https://tc39.es/ecma262/#sec-symbol.prototype.description)) - New `Set` methods ([stage 2 proposal](https://github.com/tc39/proposal-set-methods)) - `Set#difference` - `Set#intersection` - `Set#isDisjointFrom` - `Set#isSubsetOf` - `Set#isSupersetOf` - `Set#symmetricDifference` - `Set#union` - `Promise.allSettled` ([stage 2 proposal](https://github.com/tc39/proposal-promise-allSettled)) - Getting last item from `Array` ([stage 1 proposal](https://github.com/keithamus/proposal-array-last)) - `Array#lastItem` - `Array#lastIndex` - `String#replaceAll` ([stage 1 proposal](https://github.com/tc39/proposal-string-replace-all)) - `String#codePoints` ([stage 1 proposal](https://github.com/tc39/proposal-string-prototype-codepoints)) - New collections methods ([stage 1 proposal](https://github.com/tc39/collection-methods)) - `Map.groupBy` - `Map.keyBy` - `Map#deleteAll` - `Map#every` - `Map#filter` - `Map#find` - `Map#findKey` - `Map#includes` - `Map#keyOf` - `Map#mapKeys` - `Map#mapValues` - `Map#merge` - `Map#reduce` - `Map#some` - `Map#update` - `Set#addAll` - `Set#deleteAll` - `Set#every` - `Set#filter` - `Set#find` - `Set#join` - `Set#map` - `Set#reduce` - `Set#some` - `WeakMap#deleteAll` - `WeakSet#addAll` - `WeakSet#deleteAll` - `compositeKey` and `compositeSymbol` methods ([stage 1 proposal](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey)) - `Number.fromString` ([stage 1 proposal](https://github.com/tc39/proposal-number-fromstring)) - `Math.seededPRNG` ([stage 1 proposal](https://github.com/tc39/proposal-seeded-random)) - `Symbol.patternMatch` ([for stage 1 pattern matching proposal](https://github.com/tc39/proposal-pattern-matching)) - `Symbol.dispose` ([for stage 1 `using` statement proposal](https://github.com/tc39/proposal-using-statement)) - `Promise.any` (with `AggregateError`) ([stage 0 proposal](https://github.com/tc39/proposal-promise-any)) - `URL` and `URLSearchParam` [from `URL` standard](https://url.spec.whatwg.org/), also [stage 0 proposal to ECMAScript](https://github.com/jasnell/proposal-url) - `URL` - `URL#href` - `URL#origin` - `URL#protocol` - `URL#username` - `URL#password` - `URL#host` - `URL#hostname` - `URL#port` - `URL#pathname` - `URL#search` - `URL#searchParams` - `URL#hash` - `URL#toString` - `URL#toJSON` - `URLSearchParams` - `URLSearchParams#append` - `URLSearchParams#delete` - `URLSearchParams#get` - `URLSearchParams#getAll` - `URLSearchParams#has` - `URLSearchParams#set` - `URLSearchParams#sort` - `URLSearchParams#toString` - `URLSearchParams#keys` - `URLSearchParams#values` - `URLSearchParams#entries` - `URLSearchParams#@@iterator` - `.forEach` method on iterable DOM collections ([#329](https://github.com/zloirock/core-js/issues/329)) - Improve existing features: - Add triggering unhandled `Promise` rejection events (instead of only global handlers), [#205](https://github.com/zloirock/core-js/issues/205). - Wrap `fetch` for correct with polyfilled `Promise` and preventing problems like [#178](https://github.com/zloirock/core-js/issues/178), [#332](https://github.com/zloirock/core-js/issues/332), [#371](https://github.com/zloirock/core-js/issues/371). - Add support of `@@isConcatSpreadable` to `Array#concat`. - Add support of `@@species` to `Array#{concat, filter, map, slice, splice}`. - Add direct `.exec` calling to `RegExp#{@@replace, @@split, @@match, @@search}`. Also, added fixes for `RegExp#exec` method. [#411](https://github.com/zloirock/core-js/issues/411), [#434](https://github.com/zloirock/core-js/issues/434), [#453](https://github.com/zloirock/core-js/issues/453), thanks [**@nicolo-ribaudo**](https://github.com/nicolo-ribaudo). - Correct iterators prototypes chain, related [#261](https://github.com/zloirock/core-js/issues/261). - Correct Typed Arrays prototypes chain, related [#378](https://github.com/zloirock/core-js/issues/378). - Make the internal state of polyfilled features completely unobservable, [#146](https://github.com/zloirock/core-js/issues/146). - Add validation of receiver's internal class to missed non-generic methods. - Fix descriptors of global properties. - In the version without global pollution, if `Object#toString` does not support `@@toStringTag`, add to wrapped prototypes own `toString` method with `@@toStringTag` logic, see [#199](https://github.com/zloirock/core-js/issues/199). - Update standard features and proposals: - `asap` (old stage 0 proposal) replaced by `queueMicrotask` ([a part of HTML spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask)) - Update [`Observable`](https://github.com/tc39/proposal-observable) (#257, #276, etc.) - Update `Array#flatten` -> `Array#flat` and `Array#flatMap` - Update `global` [stage 3 proposal](https://github.com/tc39/proposal-global) - rename `global` to `globalThis` - Update `String#matchAll` ([proposal-string-matchall#17](https://github.com/tc39/proposal-string-matchall/pull/17), [proposal-string-matchall#38](https://github.com/tc39/proposal-string-matchall/pull/38), [proposal-string-matchall#41](https://github.com/tc39/proposal-string-matchall/pull/41), etc.) and move to the stage 3 - Update `.name` properties of `String#{trimStart, trimEnd , trimLeft, trimRight}`, move to the stage 3 - Remove mongolian vowel separator (U+180E) from the list of whitespaces for methods like `String#trim` (ES6 -> ES7) - Mark ES2016, ES2017, ES2018, ES2019 features as stable: - `Array#{ flat, flatMap }` - `{ Array, %TypedArray% }#includes` - `Object.{ values, entries}` - `Object.getOwnPropertyDescriptors` - `String#{ padStart, padEnd }` - `String#{ trimStart, trimEnd, trimLeft, trimRight }` - `Promise#finally` - `Symbol.asyncIterator` - `Object#__(define|lookup)[GS]etter__` - Remove obsolete features: - `Error.isError` (withdrawn) - `System.global` and `global` (replaced by `globalThis`) - `Map#toJSON` and `Set#toJSON` (rejected) - `RegExp.escape` (rejected) - `Reflect.enumerate` (removed from the spec) - Unnecessary iteration methods from `CSSRuleList`, `MediaList`, `StyleSheetList` - **No more non-standard features**, finally removed: - `Dict` - `Object.{classof, isObject, define, make}` - `Function#part` - `Number#@@iterator` - `String#{escapeHTML, unescapeHTML}` - `delay` - Add `.sham` flag to features which can't be properly polyfilled and / or not recommended for usage: - `Symbol` constructor - we can't add new primitives. `Object.prototype` accessors too expensive. - `Object.{create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyDescriptors}`, `Reflect.{defineProperty, getOwnPropertyDescriptor}` can't be properly polyfilled without descriptors support. - `Object.{freeze, seal, preventExtensions}`, `Reflect.preventExtensions` can't be properly polyfilled in ES3 environment. - `Object.getPrototypeOf` can be deceived in ES3 environment. - `Reflect.construct` can't be polyfilled for a correct work with `newTarget` argument on built-ins. - Typed Array constructors polyfill is quite correct but too expensive. - `URL` constructor in engines without descriptors support. - Bug and compatibility fixes: - Fix deoptimisation of iterators in V8, [#377](https://github.com/zloirock/core-js/issues/377). - Fix import of property before constructor which should contain this property, [#262](https://github.com/zloirock/core-js/issues/262). - Fix some cases of IE11 `WeakMap` frozen keys fallback, [#384](https://github.com/zloirock/core-js/issues/384). - Fix non-enumerable integer keys issue because of Nashorn ~ JDK8 bug, [#389](https://github.com/zloirock/core-js/issues/389). - Fix [Safari 12.0 `Array#reverse` bug](https://bugs.webkit.org/show_bug.cgi?id=188794). - One more fix for microtasks in iOS related [#339](https://github.com/zloirock/core-js/issues/339). - Added a fallback for [Rhino bug](https://github.com/mozilla/rhino/issues/346), [#440](https://github.com/zloirock/core-js/issues/440). - Many other internal fixes and improvements. - Repository: - Change `core-js` repository structure to monorepo with packages in `/packages/` directory. - Clean-up it, remove all possible duplicates, generated files, etc. - Packages: - **Extract a version without global namespace pollution to a separate `core-js-pure` package (replacement for `core-js/library`).** - **Leave only one pair of bundles (global, with all polyfills) and move it to `core-js-bundle` package.** - Remove bundling logic from `core-js` package, leave it only in `core-js-builder` package. - Clean-up packages. - Because of all approaches, **reduce size of packages from ~2mb for `core-js@2` to**: - **~500kb for `core-js` package** - **~440kb for `core-js-pure` package** - Finally remove `bower.json` - CommonJS API, namespaces: - Add availability [configuration of aggressiveness](https://github.com/zloirock/core-js/blob/master/README.md#configurable-level-of-aggressiveness). - Move `core-js/library` to separate `core-js-pure` package. - Because of removing all non-standard features, we no longer need `core-js/shim` entry point, replace it just with `core-js`. - Move all features from ES5, ES2015, ES2016, ES2017, ES2018 and ES2019 to one namespace for stable ES - it's available as `core-js/es`, all those features in `modules` folder has `es.` prefix. - Change prefix for ES proposals from `es7.` to `esnext.`, they no longer available in `core-js/es7`, use `core-js/stage/*` instead of that. - Rename `core-js(/library)/fn` to `core-js(-pure)/features` for improve readability. - Allow more granular inclusion of features from `/es/` path (for example, `core-js/es/array/from`). - Add `/stable/` entry points as an equal of `/features/` for stable features, without proposals. - Add `/proposals/` entry points for allow include all features from one proposal (for example, `core-js/proposals/reflect-metadata`). - Add `/es|stable|features/instance/` entry points for getting polyfill of the related method for passed instance (could be used in cases like `babel-runtime`). - Split typed arrays polyfills. Now you can, for example, load only required method (for example, `core-js/es/typed-array/from`). - Extract well-known symbols definition from `es.symbol` module for loading only required features, for example, in MS Edge. - Rename `web.dom` namespace to `web.dom-collections`. - Rename `es6.regexp.{match, replace, search, split}` -> `es.string.{match, replace, search, split}` - mainly it's fixes / adding support of well-known symbols to string methods, only in second place adding related methods to regexp prototype. - Relax `/modules/` directory by moving internal modules to `/internals/` directory. - Remove deprecated array entry points: `core-js(/library)/fn/array/{pop, push, reverse, shift, unshift}`. - `core` object no longer available in the global version, entry points which previously returned it now returns `globalThis` object. Also, don't set global `core` property. - Add some missing entry points. - Tools, tests, code quality: - Added `core-js-compat` package with: - Data about the necessity of `core-js` modules and API for getting a list of required `core-js` modules by `browserslist` query, [#466](https://github.com/zloirock/core-js/issues/466). - Data which modules load by each entry point (mainly useful for tools like `@babel/preset-env`). - Data which modules added in minor versions (mainly useful for tools like `@babel/preset-env`). - `core-js-builder` package: - Added `targets` option with `browserslist` query. - Removed an option for generation bundle of a version without global namespace pollution - now it's an odd use case. - Removed UMD wrapper from a generated code of bundles - we don't need it for a global polyfill. - **Getting rid of LiveScript**, usage another language in JS standard library looks strange and impedes usage of tools like ESLint: - Tests are rewritten to JS. - Scripts are rewritten to JS. - Babel with minimalistic config (which should work anywhere) used on tests. - ESLint used on tests and tools. - Source code refactored for improving readability. ##### [2.6.5 - 2019.02.15](https://github.com/zloirock/core-js/releases/tag/v2.6.5) - Fixed buggy `String#padStart` and `String#padEnd` mobile Safari implementations, [#414](https://github.com/zloirock/core-js/issues/414). ##### [2.6.4 - 2019.02.07](https://github.com/zloirock/core-js/releases/tag/v2.6.4) - Added a workaround against crushing an old IE11.0.9600.16384 build, [#485](https://github.com/zloirock/core-js/issues/485). ##### [2.6.3 - 2019.01.22](https://github.com/zloirock/core-js/releases/tag/v2.6.3) - Added a workaround for `babel-minify` bug, [#479](https://github.com/zloirock/core-js/issues/479) ##### [2.6.2 - 2019.01.10](https://github.com/zloirock/core-js/releases/tag/v2.6.2) - Fixed handling of `$` in `String#replace`, [#471](https://github.com/zloirock/core-js/issues/471) ##### [2.6.1 - 2018.12.18](https://github.com/zloirock/core-js/releases/tag/v2.6.1) - Fixed an issue with minified version, [#463](https://github.com/zloirock/core-js/issues/463), [#465](https://github.com/zloirock/core-js/issues/465) ##### [2.6.0 - 2018.12.05](https://github.com/zloirock/core-js/releases/tag/v2.6.0) - Add direct `.exec` calling to `RegExp#{@@replace, @@split, @@match, @@search}`. Also, added fixes for `RegExp#exec` method. [#428](https://github.com/zloirock/core-js/issues/428), [#435](https://github.com/zloirock/core-js/issues/435), [#458](https://github.com/zloirock/core-js/issues/458), thanks [**@nicolo-ribaudo**](https://github.com/nicolo-ribaudo). ##### [2.5.7 - 2018.05.26](https://github.com/zloirock/core-js/releases/tag/v2.5.7) - Get rid of reserved variable name `final`, related [#400](https://github.com/zloirock/core-js/issues/400) ##### [2.5.6 - 2018.05.07](https://github.com/zloirock/core-js/releases/tag/v2.5.6) - Forced replace native `Promise` in V8 6.6 (Node 10 and Chrome 66) because of [a bug with resolving custom thenables](https://bugs.chromium.org/p/chromium/issues/detail?id=830565) - Added a workaround for usage buggy native LG WebOS 2 `Promise` in microtask implementation, [#396](https://github.com/zloirock/core-js/issues/396) - Added modern version internal debugging information about used versions ##### [2.5.5 - 2018.04.08](https://github.com/zloirock/core-js/releases/tag/v2.5.5) - Fix some edge cases of `Reflect.set`, [#392](https://github.com/zloirock/core-js/issues/392) and [#393](https://github.com/zloirock/core-js/issues/393) ##### [2.5.4 - 2018.03.27](https://github.com/zloirock/core-js/releases/tag/v2.5.4) - Fixed one case of deoptimization built-in iterators in V8, related [#377](https://github.com/zloirock/core-js/issues/377) - Fixed some cases of iterators feature detection, [#368](https://github.com/zloirock/core-js/issues/368) - Fixed manually entered NodeJS domains issue in `Promise`, [#367](https://github.com/zloirock/core-js/issues/367) - Fixed `Number.{parseInt, parseFloat}` entry points - Fixed `__(define|lookup)[GS]etter__` export in the `library` version ##### [2.5.3 - 2017.12.12](https://github.com/zloirock/core-js/releases/tag/v2.5.3) - Fixed calling `onunhandledrejectionhandler` multiple times for one `Promise` chain, [#318](https://github.com/zloirock/core-js/issues/318) - Forced replacement of `String#{padStart, padEnd}` in Safari 10 because of [a bug](https://bugs.webkit.org/show_bug.cgi?id=161944), [#280](https://github.com/zloirock/core-js/issues/280) - Fixed `Array#@@iterator` in a very rare version of `WebKit`, [#236](https://github.com/zloirock/core-js/issues/236) and [#237](https://github.com/zloirock/core-js/issues/237) - One more [#345](https://github.com/zloirock/core-js/issues/345)-related fix ##### [2.5.2 - 2017.12.09](https://github.com/zloirock/core-js/releases/tag/v2.5.2) - `MutationObserver` no longer used for microtask implementation in iOS Safari because of bug with scrolling, [#339](https://github.com/zloirock/core-js/issues/339) - Fixed `JSON.stringify(undefined, replacer)` case in the wrapper from the `Symbol` polyfill, [#345](https://github.com/zloirock/core-js/issues/345) - `Array()` calls changed to `new Array()` for V8 optimisation ##### [2.5.1 - 2017.09.01](https://github.com/zloirock/core-js/releases/tag/v2.5.1) - Updated `Promise#finally` per [tc39/proposal-promise-finally#37](https://github.com/tc39/proposal-promise-finally/issues/37) - Optimized usage of some internal helpers for reducing size of `shim` version - Fixed some entry points for virtual methods ##### [2.5.0 - 2017.08.05](https://github.com/zloirock/core-js/releases/tag/v2.5.0) - Added `Promise#finally` [stage 3 proposal](https://github.com/tc39/proposal-promise-finally), [#225](https://github.com/zloirock/core-js/issues/225) - Added `Promise.try` [stage 1 proposal](https://github.com/tc39/proposal-promise-try) - Added `Array#flatten` and `Array#flatMap` [stage 1 proposal](https://tc39.github.io/proposal-flatMap) - Added `.of` and `.from` methods on collection constructors [stage 1 proposal](https://github.com/tc39/proposal-setmap-offrom): - `Map.of` - `Set.of` - `WeakSet.of` - `WeakMap.of` - `Map.from` - `Set.from` - `WeakSet.from` - `WeakMap.from` - Added `Math` extensions [stage 1 proposal](https://github.com/rwaldron/proposal-math-extensions), [#226](https://github.com/zloirock/core-js/issues/226): - `Math.clamp` - `Math.DEG_PER_RAD` - `Math.degrees` - `Math.fscale` - `Math.RAD_PER_DEG` - `Math.radians` - `Math.scale` - Added `Math.signbit` [stage 1 proposal](https://github.com/tc39/proposal-Math.signbit) - Updated `global` [stage 3 proposal](https://github.com/tc39/proposal-global) - added `global` global object, `System.global` deprecated - Updated `Object.getOwnPropertyDescriptors` to the [final version](https://tc39.es/ecma262/2017/#sec-object.getownpropertydescriptors) - it should not create properties if descriptors are `undefined` - Updated the list of iterable DOM collections, [#249](https://github.com/zloirock/core-js/issues/249), added: - `CSSStyleDeclaration#@@iterator` - `CSSValueList#@@iterator` - `ClientRectList#@@iterator` - `DOMRectList#@@iterator` - `DOMStringList#@@iterator` - `DataTransferItemList#@@iterator` - `FileList#@@iterator` - `HTMLAllCollection#@@iterator` - `HTMLCollection#@@iterator` - `HTMLFormElement#@@iterator` - `HTMLSelectElement#@@iterator` - `MimeTypeArray#@@iterator` - `NamedNodeMap#@@iterator` - `PaintRequestList#@@iterator` - `Plugin#@@iterator` - `PluginArray#@@iterator` - `SVGLengthList#@@iterator` - `SVGNumberList#@@iterator` - `SVGPathSegList#@@iterator` - `SVGPointList#@@iterator` - `SVGStringList#@@iterator` - `SVGTransformList#@@iterator` - `SourceBufferList#@@iterator` - `TextTrackCueList#@@iterator` - `TextTrackList#@@iterator` - `TouchList#@@iterator` - Updated stages of proposals: - [`Object.getOwnPropertyDescriptors`](https://github.com/tc39/proposal-object-getownpropertydescriptors) to [stage 4 (ES2017)](https://tc39.es/ecma262/2017/#sec-object.getownpropertydescriptors) - [String padding](https://github.com/tc39/proposal-string-pad-start-end) to [stage 4 (ES2017)](https://tc39.es/ecma262/2017/#sec-string.prototype.padend) - [`global`](https://github.com/tc39/proposal-global) to [stage 3](https://github.com/tc39/notes/blob/main/meetings/2016-09/sept-28.md#revisit-systemglobal--global) - [String trimming](https://github.com/tc39/proposal-string-left-right-trim) to [stage 2](https://github.com/tc39/notes/blob/main/meetings/2016-07/jul-27.md#10iic-trimstarttrimend) - Updated typed arrays to the modern (ES2016+) arguments validation, [#293](https://github.com/zloirock/core-js/pull/293) - Fixed `%TypedArray%.from` Safari bug, [#285](https://github.com/zloirock/core-js/issues/285) - Fixed compatibility with old version of Prototype.js, [#278](https://github.com/zloirock/core-js/issues/278), [#289](https://github.com/zloirock/core-js/issues/289) - `Function#name` no longer cache the result for correct behaviour with inherited constructors, [#296](https://github.com/zloirock/core-js/issues/296) - Added errors on incorrect context of collection methods, [#272](https://github.com/zloirock/core-js/issues/272) - Fixed conversion typed array constructors to string, fix [#300](https://github.com/zloirock/core-js/issues/300) - Fixed `Set#size` with debugger ReactNative for Android, [#297](https://github.com/zloirock/core-js/issues/297) - Fixed an issue with Electron-based debugger, [#230](https://github.com/zloirock/core-js/issues/230) - Fixed compatibility with incomplete third-party `WeakMap` polyfills, [#252](https://github.com/zloirock/core-js/pull/252) - Added a fallback for `Date#toJSON` in engines without native `Date#toISOString`, [#220](https://github.com/zloirock/core-js/issues/220) - Added support for Sphere Dispatch API, [#286](https://github.com/zloirock/core-js/pull/286) - Seriously changed the coding style and the [ESLint config](https://github.com/zloirock/core-js/blob/master/.eslintrc.js) - Updated many dev dependencies (`webpack`, `uglify`, etc) - Some other minor fixes and optimizations ##### [2.4.1 - 2016.07.18](https://github.com/zloirock/core-js/releases/tag/v2.4.1) - Fixed `script` tag for some parsers, [#204](https://github.com/zloirock/core-js/issues/204), [#216](https://github.com/zloirock/core-js/issues/216) - Removed some unused variables, [#217](https://github.com/zloirock/core-js/issues/217), [#218](https://github.com/zloirock/core-js/issues/218) - Fixed MS Edge `Reflect.construct` and `Reflect.apply` - they should not allow primitive as `argumentsList` argument ##### [1.2.7 [LEGACY] - 2016.07.18](https://github.com/zloirock/core-js/releases/tag/v1.2.7) - Some fixes for issues like [#159](https://github.com/zloirock/core-js/issues/159), [#186](https://github.com/zloirock/core-js/issues/186), [#194](https://github.com/zloirock/core-js/issues/194), [#207](https://github.com/zloirock/core-js/issues/207) ##### [2.4.0 - 2016.05.08](https://github.com/zloirock/core-js/releases/tag/v2.4.0) - Added `Observable`, [stage 1 proposal](https://github.com/zenparsing/es-observable) - Fixed behavior `Object.{getOwnPropertySymbols, getOwnPropertyDescriptor}` and `Object#propertyIsEnumerable` on `Object.prototype` - `Reflect.construct` and `Reflect.apply` should throw an error if `argumentsList` argument is not an object, [#194](https://github.com/zloirock/core-js/issues/194) ##### [2.3.0 - 2016.04.24](https://github.com/zloirock/core-js/releases/tag/v2.3.0) - Added `asap` for enqueuing microtasks, [stage 0 proposal](https://github.com/tc39/notes/blob/main/meetings/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask) - Added well-known symbol `Symbol.asyncIterator` for [stage 2 async iteration proposal](https://github.com/tc39/proposal-async-iteration) - Added well-known symbol `Symbol.observable` for [stage 1 observables proposal](https://github.com/zenparsing/es-observable) - `String#{padStart, padEnd}` returns original string if filler is empty string, [TC39 meeting notes](https://github.com/tc39/notes/blob/main/meetings/2016-03/march-29.md#stringprototypepadstartpadend) - `Object.values` and `Object.entries` moved to stage 4 from 3, [TC39 meeting notes](https://github.com/tc39/notes/blob/main/meetings/2016-03/march-29.md#objectvalues--objectentries) - `System.global` moved to stage 2 from 1, [TC39 meeting notes](https://github.com/tc39/notes/blob/main/meetings/2016-03/march-29.md#systemglobal) - `Map#toJSON` and `Set#toJSON` rejected and will be removed from the next major release, [TC39 meeting notes](https://github.com/tc39/notes/blob/main/meetings/2016-03/march-31.md#mapprototypetojsonsetprototypetojson) - `Error.isError` withdrawn and will be removed from the next major release, [TC39 meeting notes](https://github.com/tc39/notes/blob/main/meetings/2016-03/march-29.md#erroriserror) - Added fallback for `Function#name` on non-extensible functions and functions with broken `toString` conversion, [#193](https://github.com/zloirock/core-js/issues/193) ##### [2.2.2 - 2016.04.06](https://github.com/zloirock/core-js/releases/tag/v2.2.2) - Added conversion `-0` to `+0` to `Array#{indexOf, lastIndexOf}`, [ES2016 fix](https://github.com/tc39/ecma262/pull/316) - Added fixes for some `Math` methods in Tor Browser - `Array.{from, of}` no longer calls prototype setters - Added workaround over Chrome DevTools strange behavior, [#186](https://github.com/zloirock/core-js/issues/186) ##### [2.2.1 - 2016.03.19](https://github.com/zloirock/core-js/releases/tag/v2.2.1) - Fixed `Object.getOwnPropertyNames(window)` `2.1+` versions bug, [#181](https://github.com/zloirock/core-js/issues/181) ##### [2.2.0 - 2016.03.15](https://github.com/zloirock/core-js/releases/tag/v2.2.0) - Added `String#matchAll`, [proposal](https://github.com/tc39/String.prototype.matchAll) - Added `Object#__(define|lookup)[GS]etter__`, [annex B ES2017](https://github.com/tc39/ecma262/pull/381) - Added `@@toPrimitive` methods to `Date` and `Symbol` - Fixed `%TypedArray%#slice` in Edge ~ 13 (throws with `@@species` and wrapped / inherited constructor) - Some other minor fixes ##### [2.1.5 - 2016.03.12](https://github.com/zloirock/core-js/releases/tag/v2.1.5) - Improved support NodeJS domains in `Promise#then`, [#180](https://github.com/zloirock/core-js/issues/180) - Added fallback for `Date#toJSON` bug in Qt Script, [#173](https://github.com/zloirock/core-js/issues/173#issuecomment-193972502) ##### [2.1.4 - 2016.03.08](https://github.com/zloirock/core-js/releases/tag/v2.1.4) - Added fallback for `Symbol` polyfill in Qt Script, [#173](https://github.com/zloirock/core-js/issues/173) - Added one more fallback for IE11 `Script Access Denied` error with iframes, [#165](https://github.com/zloirock/core-js/issues/165) ##### [2.1.3 - 2016.02.29](https://github.com/zloirock/core-js/releases/tag/v2.1.3) - Added fallback for [`es6-promise` package bug](https://github.com/stefanpenner/es6-promise/issues/169), [#176](https://github.com/zloirock/core-js/issues/176) ##### [2.1.2 - 2016.02.29](https://github.com/zloirock/core-js/releases/tag/v2.1.2) - Some minor `Promise` fixes: - Browsers `rejectionhandled` event better HTML spec complaint - Errors in unhandled rejection handlers should not cause any problems - Fixed typo in feature detection ##### [2.1.1 - 2016.02.22](https://github.com/zloirock/core-js/releases/tag/v2.1.1) - Some `Promise` improvements: - Feature detection: - **Added detection unhandled rejection tracking support - now it's available everywhere**, [#140](https://github.com/zloirock/core-js/issues/140) - Added detection `@@species` pattern support for completely correct subclassing - Removed usage `Object.setPrototypeOf` from feature detection and noisy console message about it in FF - `Promise.all` fixed for some very specific cases ##### [2.1.0 - 2016.02.09](https://github.com/zloirock/core-js/releases/tag/v2.1.0) - **API**: - ES5 polyfills are split and logic, used in other polyfills, moved to internal modules - **All entry point works in ES3 environment like IE8- without `core-js/(library/)es5`** - **Added all missed single entry points for ES5 polyfills** - Separated ES5 polyfills moved to the ES6 namespace. Why? - Mainly, for prevent duplication features in different namespaces - logic of most required ES5 polyfills changed in ES6+: - Already added changes for: `Object` statics - should accept primitives, new whitespaces lists in `String#trim`, `parse(Int|float)`, `RegExp#toString` logic, `String#split`, etc - Should be changed in the future: `@@species` and `ToLength` logic in `Array` methods, `Date` parsing, `Function#bind`, etc - Should not be changed only several features like `Array.isArray` and `Date.now` - Some ES5 polyfills required for modern engines - All old entry points should work fine, but in the next major release API can be changed - `Object.getOwnPropertyDescriptors` moved to the stage 3, [January TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2016-01/2016-01-28.md#objectgetownpropertydescriptors-to-stage-3-jordan-harband-low-priority-but-super-quick) - Added `umd` option for [custom build process](https://github.com/zloirock/core-js#custom-build-from-external-scripts), [#169](https://github.com/zloirock/core-js/issues/169) - Returned entry points for `Array` statics, removed in `2.0`, for compatibility with `babel` `6` and for future fixes - **Deprecated**: - `Reflect.enumerate` deprecated and will be removed from the next major release, [January TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2016-01/2016-01-28.md#5xix-revisit-proxy-enumerate---revisit-decision-to-exhaust-iterator) - **New Features**: - Added [`Reflect` metadata API](https://rbuckton.github.io/reflect-metadata/) as a pre-strawman feature, [#152](https://github.com/zloirock/core-js/issues/152): - `Reflect.defineMetadata` - `Reflect.deleteMetadata` - `Reflect.getMetadata` - `Reflect.getMetadataKeys` - `Reflect.getOwnMetadata` - `Reflect.getOwnMetadataKeys` - `Reflect.hasMetadata` - `Reflect.hasOwnMetadata` - `Reflect.metadata` - Implementation / fixes `Date#toJSON` - Fixes for `parseInt` and `Number.parseInt` - Fixes for `parseFloat` and `Number.parseFloat` - Fixes for `RegExp#toString` - Fixes for `Array#sort` - Fixes for `Number#toFixed` - Fixes for `Number#toPrecision` - Additional fixes for `String#split` (`RegExp#@@split`) - **Improvements**: - Correct subclassing wrapped collections, `Number` and `RegExp` constructors with native class syntax - Correct support `SharedArrayBuffer` and buffers from other realms in typed arrays wrappers - Additional validations for `Object.{defineProperty, getOwnPropertyDescriptor}` and `Reflect.defineProperty` - **Bug Fixes**: - Fixed some cases `Array#lastIndexOf` with negative second argument ##### [2.0.3 - 2016.01.11](https://github.com/zloirock/core-js/releases/tag/v2.0.3) - Added fallback for V8 ~ Chrome 49 `Promise` subclassing bug causes unhandled rejection on feature detection, [#159](https://github.com/zloirock/core-js/issues/159) - Added fix for very specific environments with global `window === null` ##### [2.0.2 - 2016.01.04](https://github.com/zloirock/core-js/releases/tag/v2.0.2) - Temporarily removed `length` validation from `Uint8Array` constructor wrapper. Reason - [bug in `ws` module](https://github.com/websockets/ws/pull/645) (-> `socket.io`) which passes to `Buffer` constructor -> `Uint8Array` float and uses [the `V8` bug](https://code.google.com/p/v8/issues/detail?id=4552) for conversion to int (by the spec should be thrown an error). [It creates problems for many people.](https://github.com/karma-runner/karma/issues/1768) I hope, it will be returned after fixing this bug in `V8`. ##### [2.0.1 - 2015.12.31](https://github.com/zloirock/core-js/releases/tag/v2.0.1) - Forced usage `Promise.resolve` polyfill in the `library` version for correct work with wrapper - `Object.assign` should be defined in the strict mode -> throw an error on extension non-extensible objects, [#154](https://github.com/zloirock/core-js/issues/154) ##### [2.0.0 - 2015.12.24](https://github.com/zloirock/core-js/releases/tag/v2.0.0) - Added implementations and fixes [Typed Arrays](https://github.com/zloirock/core-js#ecmascript-6-typed-arrays)-related features - `ArrayBuffer`, `ArrayBuffer.isView`, `ArrayBuffer#slice` - `DataView` with all getter / setter methods - `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array` and `Float64Array` constructors - `%TypedArray%.{for, of}`, `%TypedArray%#{copyWithin, every, fill, filter, find, findIndex, forEach, indexOf, includes, join, lastIndexOf, map, reduce, reduceRight, reverse, set, slice, some, sort, subarray, values, keys, entries, @@iterator, ...}` - Added [`System.global`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/tc39/proposal-global), [November TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-11/nov-19.md#systemglobal-jhd) - Added [`Error.isError`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/ljharb/proposal-is-error), [November TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-11/nov-19.md#jhd-erroriserror) - Added [`Math.{iaddh, isubh, imulh, umulh}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://gist.github.com/BrendanEich/4294d5c212a6d2254703) - `RegExp.escape` moved from the `es7` to the non-standard `core` namespace, [July TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-07/july-28.md#62-regexpescape) - too slow, but it's condition of stability, [#116](https://github.com/zloirock/core-js/issues/116) - [`Promise`](https://github.com/zloirock/core-js#ecmascript-6-promise) - Some performance optimisations - Added basic support [`rejectionHandled` event / `onrejectionhandled` handler](https://github.com/zloirock/core-js#unhandled-rejection-tracking) to the polyfill - Removed usage `@@species` from `Promise.{all, race}`, [November TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-11/nov-18.md#conclusionresolution-2) - Some improvements [collections polyfills](https://github.com/zloirock/core-js#ecmascript-6-collections) - `O(1)` and preventing possible leaks with frozen keys, [#134](https://github.com/zloirock/core-js/issues/134) - Correct observable state object keys - Renamed `String#{padLeft, padRight}` -> [`String#{padStart, padEnd}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/tc39/proposal-string-pad-start-end), [November TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-11/nov-17.md#conclusionresolution-2) (they want to rename it on each meeting?O_o), [#132](https://github.com/zloirock/core-js/issues/132) - Added [`String#{trimStart, trimEnd}` as aliases for `String#{trimLeft, trimRight}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/sebmarkbage/ecmascript-string-left-right-trim), [November TC39 meeting](https://github.com/tc39/notes/blob/main/meetings/2015-11/nov-17.md#conclusionresolution-2) - Added [annex B HTML methods](https://github.com/zloirock/core-js#ecmascript-6-string) - ugly, but also [the part of the spec](https://262.ecma-international.org/6.0/#sec-string.prototype.anchor) - Added little fix for [`Date#toString`](https://github.com/zloirock/core-js#ecmascript-6-date) - `new Date(NaN).toString()` [should be `'Invalid Date'`](https://262.ecma-international.org/6.0/#sec-todatestring) - Added [`{keys, values, entries, @@iterator}` methods to DOM collections](https://github.com/zloirock/core-js#iterable-dom-collections) which should have [iterable interface](https://heycam.github.io/webidl/#idl-iterable) or should be [inherited from `Array`](https://heycam.github.io/webidl/#LegacyArrayClass) - `NodeList`, `DOMTokenList`, `MediaList`, `StyleSheetList`, `CSSRuleList`. - Removed Mozilla `Array` generics - [deprecated and will be removed from FF](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Array_generic_methods), [looks like strawman is dead](https://web.archive.org/web/20160805230354/http://wiki.ecmascript.org/doku.php?id=strawman:array_statics), available [alternative shim](https://github.com/plusdude/array-generics) - Removed `core.log` module - CommonJS API - Added entry points for [virtual methods](https://github.com/zloirock/core-js#commonjs-and-prototype-methods-without-global-namespace-pollution) - Added entry points for [stages proposals](https://github.com/zloirock/core-js#ecmascript-7-proposals) - Some other minor changes - [Custom build from external scripts](https://github.com/zloirock/core-js#custom-build-from-external-scripts) moved to the separate package for preventing problems with dependencies - Changed `$` prefix for internal modules file names because Team Foundation Server does not support it, [#129](https://github.com/zloirock/core-js/issues/129) - Additional fix for `SameValueZero` in V8 ~ Chromium 39-42 collections - Additional fix for FF27 `Array` iterator - Removed usage shortcuts for `arguments` object - old WebKit bug, [#150](https://github.com/zloirock/core-js/issues/150) - `{Map, Set}#forEach` non-generic, [#144](https://github.com/zloirock/core-js/issues/144) - Many other improvements ##### [1.2.6 - 2015.11.09](https://github.com/zloirock/core-js/releases/tag/v1.2.6) - Reject with `TypeError` on attempt resolve promise itself - Correct behavior with broken `Promise` subclass constructors / methods - Added `Promise`-based fallback for microtask - Fixed V8 and FF `Array#{values, @@iterator}.name` - Fixed IE7- `[1, 2].join(undefined) -> '1,2'` - Some other fixes / improvements / optimizations ##### [1.2.5 - 2015.11.02](https://github.com/zloirock/core-js/releases/tag/v1.2.5) - Some more `Number` constructor fixes: - Fixed V8 ~ Node 0.8 bug: `Number('+0x1')` should be `NaN` - Fixed `Number(' 0b1\n')` case, should be `1` - Fixed `Number()` case, should be `0` ##### [1.2.4 - 2015.11.01](https://github.com/zloirock/core-js/releases/tag/v1.2.4) - Fixed `Number('0b12') -> NaN` case in the shim - Fixed V8 ~ Chromium 40- bug - `Weak(Map|Set)#{delete, get, has}` should not throw errors [#124](https://github.com/zloirock/core-js/issues/124) - Some other fixes and optimizations ##### [1.2.3 - 2015.10.23](https://github.com/zloirock/core-js/releases/tag/v1.2.3) - Fixed some problems related old V8 bug `Object('a').propertyIsEnumerable(0) // => false`, for example, `Object.assign({}, 'qwe')` from the last release - Fixed `.name` property and `Function#toString` conversion some polyfilled methods - Fixed `Math.imul` arity in Safari 8- ##### [1.2.2 - 2015.10.18](https://github.com/zloirock/core-js/releases/tag/v1.2.2) - Improved optimisations for V8 - Fixed build process from external packages, [#120](https://github.com/zloirock/core-js/pull/120) - One more `Object.{assign, values, entries}` fix for [**very** specific case](https://github.com/ljharb/proposal-object-values-entries/issues/5) ##### [1.2.1 - 2015.10.02](https://github.com/zloirock/core-js/releases/tag/v1.2.1) - Replaced fix `JSON.stringify` + `Symbol` behavior from `.toJSON` method to wrapping `JSON.stringify` - little more correct, [compat-table/642](https://github.com/kangax/compat-table/pull/642) - Fixed typo which broke tasks scheduler in WebWorkers in old FF, [#114](https://github.com/zloirock/core-js/pull/114) ##### [1.2.0 - 2015.09.27](https://github.com/zloirock/core-js/releases/tag/v1.2.0) - Added browser [`Promise` rejection hook](#unhandled-rejection-tracking), [#106](https://github.com/zloirock/core-js/issues/106) - Added correct [`IsRegExp`](https://262.ecma-international.org/6.0/#sec-isregexp) logic to [`String#{includes, startsWith, endsWith}`](https://github.com/zloirock/core-js/#ecmascript-6-string) and [`RegExp` constructor](https://github.com/zloirock/core-js/#ecmascript-6-regexp), `@@match` case, [example](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/match#Disabling_the_isRegExp_check) - Updated [`String#leftPad`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) [with proposal](https://github.com/ljharb/proposal-string-pad-left-right/issues/6): string filler truncated from the right side - Replaced V8 [`Object.assign`](https://github.com/zloirock/core-js/#ecmascript-6-object) - its properties order not only incorrect, it is non-deterministic and it causes some problems - Fixed behavior with deleted in getters properties for `Object.{`[`assign`](https://github.com/zloirock/core-js/#ecmascript-6-object)`, `[`entries, values`](https://github.com/zloirock/core-js/#ecmascript-7-proposals)`}`, [example](http://goo.gl/iQE01c) - Fixed [`Math.sinh`](https://github.com/zloirock/core-js/#ecmascript-6-math) with very small numbers in V8 near Chromium 38 - Some other fixes and optimizations ##### [1.1.4 - 2015.09.05](https://github.com/zloirock/core-js/releases/tag/v1.1.4) - Fixed support symbols in FF34-35 [`Object.assign`](https://github.com/zloirock/core-js/#ecmascript-6-object) - Fixed [collections iterators](https://github.com/zloirock/core-js/#ecmascript-6-iterators) in FF25-26 - Fixed non-generic WebKit [`Array.of`](https://github.com/zloirock/core-js/#ecmascript-6-array) - Some other fixes and optimizations ##### [1.1.3 - 2015.08.29](https://github.com/zloirock/core-js/releases/tag/v1.1.3) - Fixed support Node.js domains in [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise), [#103](https://github.com/zloirock/core-js/issues/103) ##### [1.1.2 - 2015.08.28](https://github.com/zloirock/core-js/releases/tag/v1.1.2) - Added `toJSON` method to [`Symbol`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) polyfill and to MS Edge implementation for expected `JSON.stringify` result w/o patching this method - Replaced [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) implementations w/o correct support third argument - Fixed `global` detection with changed `document.domain` in \~IE8, [#100](https://github.com/zloirock/core-js/issues/100) ##### [1.1.1 - 2015.08.20](https://github.com/zloirock/core-js/releases/tag/v1.1.1) - Added more correct microtask implementation for [`Promise`](#ecmascript-6-promise) ##### [1.1.0 - 2015.08.17](https://github.com/zloirock/core-js/releases/tag/v1.1.0) - Updated [string padding](https://github.com/zloirock/core-js/#ecmascript-7-proposals) to [actual proposal](https://github.com/ljharb/proposal-string-pad-left-right) - renamed, minor internal changes: - `String#lpad` -> `String#padLeft` - `String#rpad` -> `String#padRight` - Added [string trim functions](#ecmascript-7-proposals) - [proposal](https://github.com/sebmarkbage/ecmascript-string-left-right-trim), defacto standard - required only for IE11- and fixed for some old engines: - `String#trimLeft` - `String#trimRight` - [`String#trim`](https://github.com/zloirock/core-js/#ecmascript-6-string) fixed for some engines by es6 spec and moved from `es5` to single `es6` module - Split [`es6.object.statics-accept-primitives`](https://github.com/zloirock/core-js/#ecmascript-6-object) - Caps for `freeze`-family `Object` methods moved from `es5` to `es6` namespace and joined with [es6 wrappers](https://github.com/zloirock/core-js/#ecmascript-6-object) - `es5` [namespace](https://github.com/zloirock/core-js/#commonjs) also includes modules, moved to `es6` namespace - you can use it as before - Increased `MessageChannel` priority in `$.task`, [#95](https://github.com/zloirock/core-js/issues/95) - Does not get `global.Symbol` on each getting iterator, if you wanna use alternative `Symbol` shim - add it before `core-js` - [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) optimized and fixed for some cases - Simplified [`Reflect.enumerate`](https://github.com/zloirock/core-js/#ecmascript-6-reflect), see [this question](https://esdiscuss.org/topic/question-about-enumerate-and-property-decision-timing) - Some corrections in [`Math.acosh`](https://github.com/zloirock/core-js/#ecmascript-6-math) - Fixed [`Math.imul`](https://github.com/zloirock/core-js/#ecmascript-6-math) for old WebKit - Some fixes in string / RegExp [well-known symbols](https://github.com/zloirock/core-js/#ecmascript-6-regexp) logic - Some other fixes and optimizations ##### [1.0.1 - 2015.07.31](https://github.com/zloirock/core-js/releases/tag/v1.0.1) - Some fixes for final MS Edge, replaced broken native `Reflect.defineProperty` - Some minor fixes and optimizations - Changed compression `client/*.min.js` options for safe `Function#name` and `Function#length`, should be fixed [#92](https://github.com/zloirock/core-js/issues/92) ##### [1.0.0 - 2015.07.22](https://github.com/zloirock/core-js/releases/tag/v1.0.0) - Added logic for [well-known symbols](https://github.com/zloirock/core-js/#ecmascript-6-regexp): - `Symbol.match` - `Symbol.replace` - `Symbol.split` - `Symbol.search` - Actualized and optimized work with iterables: - Optimized [`Map`, `Set`, `WeakMap`, `WeakSet` constructors](https://github.com/zloirock/core-js/#ecmascript-6-collections), [`Promise.all`, `Promise.race`](https://github.com/zloirock/core-js/#ecmascript-6-promise) for default `Array Iterator` - Optimized [`Array.from`](https://github.com/zloirock/core-js/#ecmascript-6-array) for default `Array Iterator` - Added [`core.getIteratorMethod`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) helper - Uses enumerable properties in shimmed instances - collections, iterators, etc for optimize performance - Added support native constructors to [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) with 2 arguments - Added support native constructors to [`Function#bind`](https://github.com/zloirock/core-js/#ecmascript-5) shim with `new` - Removed obsolete `.clear` methods native [`Weak`-collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) - Maximum modularity, reduced minimal custom build size, separated into submodules: - [`es6.reflect`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) - [`es6.regexp`](https://github.com/zloirock/core-js/#ecmascript-6-regexp) - [`es6.math`](https://github.com/zloirock/core-js/#ecmascript-6-math) - [`es6.number`](https://github.com/zloirock/core-js/#ecmascript-6-number) - [`es7.object.to-array`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - [`core.object`](https://github.com/zloirock/core-js/#object) - [`core.string`](https://github.com/zloirock/core-js/#escaping-strings) - [`core.iter-helpers`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) - Internal modules (`$`, `$.iter`, etc) - Many other optimizations - Final cleaning non-standard features - Moved `$for` to [separate library](https://github.com/zloirock/forof). This work for syntax - `for-of` loop and comprehensions - Moved `Date#{format, formatUTC}` to [separate library](https://github.com/zloirock/dtf). Standard way for this - `ECMA-402` - Removed `Math` methods from `Number.prototype`. Slight sugar for simple `Math` methods calling - Removed `{Array#, Array, Dict}.turn` - Removed `core.global` - Uses `ToNumber` instead of `ToLength` in [`Number Iterator`](https://github.com/zloirock/core-js/#number-iterator), `Array.from(2.5)` will be `[0, 1, 2]` instead of `[0, 1]` - Fixed [#85](https://github.com/zloirock/core-js/issues/85) - invalid `Promise` unhandled rejection message in nested `setTimeout` - Fixed [#86](https://github.com/zloirock/core-js/issues/86) - support FF extensions - Fixed [#89](https://github.com/zloirock/core-js/issues/89) - behavior `Number` constructor in strange case ##### [0.9.18 - 2015.06.17](https://github.com/zloirock/core-js/releases/tag/v0.9.18) - Removed `/` from [`RegExp.escape`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) escaped characters ##### [0.9.17 - 2015.06.14](https://github.com/zloirock/core-js/releases/tag/v0.9.17) - Updated [`RegExp.escape`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) to the [latest proposal](https://github.com/benjamingr/RexExp.escape) - Fixed conflict with webpack dev server + IE buggy behavior ##### [0.9.16 - 2015.06.11](https://github.com/zloirock/core-js/releases/tag/v0.9.16) - More correct order resolving thenable in [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) polyfill - Uses polyfill instead of [buggy V8 `Promise`](https://github.com/zloirock/core-js/issues/78) ##### [0.9.15 - 2015.06.09](https://github.com/zloirock/core-js/releases/tag/v0.9.15) - [Collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) from `library` version return wrapped native instances - Fixed collections prototype methods in `library` version - Optimized [`Math.hypot`](https://github.com/zloirock/core-js/#ecmascript-6-math) ##### [0.9.14 - 2015.06.04](https://github.com/zloirock/core-js/releases/tag/v0.9.14) - Updated [`Promise.resolve` behavior](https://esdiscuss.org/topic/fixing-promise-resolve) - Added fallback for IE11 buggy `Object.getOwnPropertyNames` + iframe - Some other fixes ##### [0.9.13 - 2015.05.25](https://github.com/zloirock/core-js/releases/tag/v0.9.13) - Added fallback for [`Symbol` polyfill](https://github.com/zloirock/core-js/#ecmascript-6-symbol) for old Android - Some other fixes ##### [0.9.12 - 2015.05.24](https://github.com/zloirock/core-js/releases/tag/v0.9.12) - Different instances `core-js` should use / recognize the same symbols - Some fixes ##### [0.9.11 - 2015.05.18](https://github.com/zloirock/core-js/releases/tag/v0.9.11) - Simplified [custom build](https://github.com/zloirock/core-js/#custom-build) - Added custom build js api - Added `grunt-cli` to `devDependencies` for `npm run grunt` - Some fixes ##### [0.9.10 - 2015.05.16](https://github.com/zloirock/core-js/releases/tag/v0.9.10) - Wrapped `Function#toString` for correct work wrapped methods / constructors with methods similar to the [`lodash` `isNative`](https://github.com/lodash/lodash/issues/1197) - Added proto versions of methods to export object in `default` version for consistency with `library` version ##### [0.9.9 - 2015.05.14](https://github.com/zloirock/core-js/releases/tag/v0.9.9) - Wrapped `Object#propertyIsEnumerable` for [`Symbol` polyfill](https://github.com/zloirock/core-js/#ecmascript-6-symbol) - [Added proto versions of methods to `library` for ES7 bind syntax](https://github.com/zloirock/core-js/issues/65) - Some other fixes ##### [0.9.8 - 2015.05.12](https://github.com/zloirock/core-js/releases/tag/v0.9.8) - Fixed [`Math.hypot`](https://github.com/zloirock/core-js/#ecmascript-6-math) with negative arguments - Added `Object#toString.toString` as fallback for [`lodash` `isNative`](https://github.com/lodash/lodash/issues/1197) ##### [0.9.7 - 2015.05.07](https://github.com/zloirock/core-js/releases/tag/v0.9.7) - Added [support DOM collections](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice#Streamlining_cross-browser_behavior) to IE8- `Array#slice` ##### [0.9.6 - 2015.05.01](https://github.com/zloirock/core-js/releases/tag/v0.9.6) - Added [`String#lpad`, `String#rpad`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) ##### [0.9.5 - 2015.04.30](https://github.com/zloirock/core-js/releases/tag/v0.9.5) - Added cap for `Function#@@hasInstance` - Some fixes and optimizations ##### [0.9.4 - 2015.04.27](https://github.com/zloirock/core-js/releases/tag/v0.9.4) - Fixed `RegExp` constructor ##### [0.9.3 - 2015.04.26](https://github.com/zloirock/core-js/releases/tag/v0.9.3) - Some fixes and optimizations ##### [0.9.2 - 2015.04.25](https://github.com/zloirock/core-js/releases/tag/v0.9.2) - More correct [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) unhandled rejection tracking and resolving / rejection priority ##### [0.9.1 - 2015.04.25](https://github.com/zloirock/core-js/releases/tag/v0.9.1) - Fixed `__proto__`-based [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) subclassing in some environments ##### [0.9.0 - 2015.04.24](https://github.com/zloirock/core-js/releases/tag/v0.9.0) - Added correct [symbols](https://github.com/zloirock/core-js/#ecmascript-6-symbol) descriptors - Fixed behavior `Object.{assign, create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyDescriptors}` with symbols - Added [single entry points](https://github.com/zloirock/core-js/#commonjs) for `Object.{create, defineProperty, defineProperties}` - Added [`Map#toJSON`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - Removed non-standard methods `Object#[_]` and `Function#only` - they solves syntax problems, but now in compilers available arrows and ~~in near future will be available~~ [available](https://babeljs.io/blog/2015/05/14/function-bind/) [bind syntax](https://github.com/zenparsing/es-function-bind) - Removed non-standard undocumented methods `Symbol.{pure, set}` - Some fixes and internal changes ##### [0.8.4 - 2015.04.18](https://github.com/zloirock/core-js/releases/tag/v0.8.4) - Uses `webpack` instead of `browserify` for browser builds - more compression-friendly result ##### [0.8.3 - 2015.04.14](https://github.com/zloirock/core-js/releases/tag/v0.8.3) - Fixed `Array` statics with single entry points ##### [0.8.2 - 2015.04.13](https://github.com/zloirock/core-js/releases/tag/v0.8.2) - [`Math.fround`](https://github.com/zloirock/core-js/#ecmascript-6-math) now also works in IE9- - Added [`Set#toJSON`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - Some optimizations and fixes ##### [0.8.1 - 2015.04.03](https://github.com/zloirock/core-js/releases/tag/v0.8.1) - Fixed `Symbol.keyFor` ##### [0.8.0 - 2015.04.02](https://github.com/zloirock/core-js/releases/tag/v0.8.0) - Changed [CommonJS API](https://github.com/zloirock/core-js/#commonjs) - Split and renamed some modules - Added support ES3 environment (ES5 polyfill) to **all** default versions - size increases slightly (+ ~4kb w/o gzip), many issues disappear, if you don't need it - [simply include only required namespaces / features / modules](https://github.com/zloirock/core-js/#commonjs) - Removed [abstract references](https://github.com/zenparsing/es-abstract-refs) support - proposal has been superseded =\ - [`$for.isIterable` -> `core.isIterable`, `$for.getIterator` -> `core.getIterator`](https://github.com/zloirock/core-js/#ecmascript-6-iterators), temporary available in old namespace - Fixed iterators support in v8 `Promise.all` and `Promise.race` - Many other fixes ##### [0.7.2 - 2015.03.09](https://github.com/zloirock/core-js/releases/tag/v0.7.2) - Some fixes ##### [0.7.1 - 2015.03.07](https://github.com/zloirock/core-js/releases/tag/v0.7.1) - Some fixes ##### [0.7.0 - 2015.03.06](https://github.com/zloirock/core-js/releases/tag/v0.7.0) - Rewritten and split into [CommonJS modules](https://github.com/zloirock/core-js/#commonjs) ##### [0.6.1 - 2015.02.24](https://github.com/zloirock/core-js/releases/tag/v0.6.1) - Fixed support [`Object.defineProperty`](https://github.com/zloirock/core-js/#ecmascript-5) with accessors on DOM elements on IE8 ##### [0.6.0 - 2015.02.23](https://github.com/zloirock/core-js/releases/tag/v0.6.0) - Added support safe closing iteration - calling `iterator.return` on abort iteration, if it exists - Added basic support [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) unhandled rejection tracking in shim - Added [`Object.getOwnPropertyDescriptors`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - Removed `console` cap - creates too many problems - Restructuring [namespaces](https://github.com/zloirock/core-js/#custom-build) - Some fixes ##### [0.5.4 - 2015.02.15](https://github.com/zloirock/core-js/releases/tag/v0.5.4) - Some fixes ##### [0.5.3 - 2015.02.14](https://github.com/zloirock/core-js/releases/tag/v0.5.3) - Added [support binary and octal literals](https://github.com/zloirock/core-js/#ecmascript-6-number) to `Number` constructor - Added [`Date#toISOString`](https://github.com/zloirock/core-js/#ecmascript-5) ##### [0.5.2 - 2015.02.10](https://github.com/zloirock/core-js/releases/tag/v0.5.2) - Some fixes ##### [0.5.1 - 2015.02.09](https://github.com/zloirock/core-js/releases/tag/v0.5.1) - Some fixes ##### [0.5.0 - 2015.02.08](https://github.com/zloirock/core-js/releases/tag/v0.5.0) - Systematization of modules - Split [`es6` module](https://github.com/zloirock/core-js/#ecmascript-6) - Split `console` module: `web.console` - only cap for missing methods, `core.log` - bound methods & additional features - Added [`delay` method](https://github.com/zloirock/core-js/#delay) - Some fixes ##### [0.4.10 - 2015.01.28](https://github.com/zloirock/core-js/releases/tag/v0.4.10) - [`Object.getOwnPropertySymbols`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) polyfill returns array of wrapped keys ##### [0.4.9 - 2015.01.27](https://github.com/zloirock/core-js/releases/tag/v0.4.9) - FF20-24 fix ##### [0.4.8 - 2015.01.25](https://github.com/zloirock/core-js/releases/tag/v0.4.8) - Some [collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) fixes ##### [0.4.7 - 2015.01.25](https://github.com/zloirock/core-js/releases/tag/v0.4.7) - Added support frozen objects as [collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) keys ##### [0.4.6 - 2015.01.21](https://github.com/zloirock/core-js/releases/tag/v0.4.6) - Added [`Object.getOwnPropertySymbols`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) - Added [`NodeList.prototype[@@iterator]`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) - Added basic `@@species` logic - getter in native constructors - Removed `Function#by` - Some fixes ##### [0.4.5 - 2015.01.16](https://github.com/zloirock/core-js/releases/tag/v0.4.5) - Some fixes ##### [0.4.4 - 2015.01.11](https://github.com/zloirock/core-js/releases/tag/v0.4.4) - Enabled CSP support ##### [0.4.3 - 2015.01.10](https://github.com/zloirock/core-js/releases/tag/v0.4.3) - Added `Function` instances `name` property for IE9+ ##### [0.4.2 - 2015.01.10](https://github.com/zloirock/core-js/releases/tag/v0.4.2) - `Object` static methods accept primitives - `RegExp` constructor can alter flags (IE9+) - Added `Array.prototype[Symbol.unscopables]` ##### [0.4.1 - 2015.01.05](https://github.com/zloirock/core-js/releases/tag/v0.4.1) - Some fixes ##### [0.4.0 - 2015.01.03](https://github.com/zloirock/core-js/releases/tag/v0.4.0) - Added [`es6.reflect`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) module: - Added `Reflect.apply` - Added `Reflect.construct` - Added `Reflect.defineProperty` - Added `Reflect.deleteProperty` - Added `Reflect.enumerate` - Added `Reflect.get` - Added `Reflect.getOwnPropertyDescriptor` - Added `Reflect.getPrototypeOf` - Added `Reflect.has` - Added `Reflect.isExtensible` - Added `Reflect.preventExtensions` - Added `Reflect.set` - Added `Reflect.setPrototypeOf` - `core-js` methods now can use external `Symbol.iterator` polyfill - Some fixes ##### [0.3.3 - 2014.12.28](https://github.com/zloirock/core-js/releases/tag/v0.3.3) - [Console cap](https://github.com/zloirock/core-js/#console) excluded from node.js default builds ##### [0.3.2 - 2014.12.25](https://github.com/zloirock/core-js/releases/tag/v0.3.2) - Added cap for [ES5](https://github.com/zloirock/core-js/#ecmascript-5) freeze-family methods - Fixed `console` bug ##### [0.3.1 - 2014.12.23](https://github.com/zloirock/core-js/releases/tag/v0.3.1) - Some fixes ##### [0.3.0 - 2014.12.23](https://github.com/zloirock/core-js/releases/tag/v0.3.0) - Optimize [`Map` & `Set`](https://github.com/zloirock/core-js/#ecmascript-6-collections): - Use entries chain on hash table - Fast & correct iteration - Iterators moved to [`es6`](https://github.com/zloirock/core-js/#ecmascript-6) and [`es6.collections`](https://github.com/zloirock/core-js/#ecmascript-6-collections) modules ##### [0.2.5 - 2014.12.20](https://github.com/zloirock/core-js/releases/tag/v0.2.5) - `console` no longer shortcut for `console.log` (compatibility problems) - Some fixes ##### [0.2.4 - 2014.12.17](https://github.com/zloirock/core-js/releases/tag/v0.2.4) - Better compliance of ES6 - Added [`Math.fround`](https://github.com/zloirock/core-js/#ecmascript-6-math) (IE10+) - Some fixes ##### [0.2.3 - 2014.12.15](https://github.com/zloirock/core-js/releases/tag/v0.2.3) - [Symbols](https://github.com/zloirock/core-js/#ecmascript-6-symbol): - Added option to disable addition setter to `Object.prototype` for Symbol polyfill: - Added `Symbol.useSimple` - Added `Symbol.useSetter` - Added cap for well-known Symbols: - Added `Symbol.hasInstance` - Added `Symbol.isConcatSpreadable` - Added `Symbol.match` - Added `Symbol.replace` - Added `Symbol.search` - Added `Symbol.species` - Added `Symbol.split` - Added `Symbol.toPrimitive` - Added `Symbol.unscopables` ##### [0.2.2 - 2014.12.13](https://github.com/zloirock/core-js/releases/tag/v0.2.2) - Added [`RegExp#flags`](https://github.com/zloirock/core-js/#ecmascript-6-regexp) ([December 2014 Draft Rev 29](https://web.archive.org/web/20170119181824/http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts)) - Added [`String.raw`](https://github.com/zloirock/core-js/#ecmascript-6-string) ##### [0.2.1 - 2014.12.12](https://github.com/zloirock/core-js/releases/tag/v0.2.1) - Repair converting -0 to +0 in [native collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) ##### [0.2.0 - 2014.12.06](https://github.com/zloirock/core-js/releases/tag/v0.2.0) - Added [`es7.proposals`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) and [`es7.abstract-refs`](https://github.com/zenparsing/es-abstract-refs) modules - Added [`String#at`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - Added real [`String Iterator`](https://github.com/zloirock/core-js/#ecmascript-6-iterators), older versions used Array Iterator - Added abstract references support: - Added `Symbol.referenceGet` - Added `Symbol.referenceSet` - Added `Symbol.referenceDelete` - Added `Function#@@referenceGet` - Added `Map#@@referenceGet` - Added `Map#@@referenceSet` - Added `Map#@@referenceDelete` - Added `WeakMap#@@referenceGet` - Added `WeakMap#@@referenceSet` - Added `WeakMap#@@referenceDelete` - Added `Dict.{...methods}[@@referenceGet]` - Removed deprecated `.contains` methods - Some fixes ##### [0.1.5 - 2014.12.01](https://github.com/zloirock/core-js/releases/tag/v0.1.5) - Added [`Array#copyWithin`](https://github.com/zloirock/core-js/#ecmascript-6-array) - Added [`String#codePointAt`](https://github.com/zloirock/core-js/#ecmascript-6-string) - Added [`String.fromCodePoint`](https://github.com/zloirock/core-js/#ecmascript-6-string) ##### [0.1.4 - 2014.11.27](https://github.com/zloirock/core-js/releases/tag/v0.1.4) - Added [`Dict.mapPairs`](https://github.com/zloirock/core-js/#dict) ##### [0.1.3 - 2014.11.20](https://github.com/zloirock/core-js/releases/tag/v0.1.3) - [TC39 November meeting](https://github.com/tc39/notes/blob/main/meetings/2014-11): - [`.contains` -> `.includes`](https://github.com/tc39/notes/blob/main/meetings/2014-11/nov-18.md#51--44-arrayprototypecontains-and-stringprototypecontains) - `String#contains` -> [`String#includes`](https://github.com/zloirock/core-js/#ecmascript-6-string) - `Array#contains` -> [`Array#includes`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) - `Dict.contains` -> [`Dict.includes`](https://github.com/zloirock/core-js/#dict) - [Removed `WeakMap#clear`](https://github.com/tc39/notes/blob/main/meetings/2014-11/nov-19.md#412-should-weakmapweakset-have-a-clear-method-markm) - [Removed `WeakSet#clear`](https://github.com/tc39/notes/blob/main/meetings/2014-11/nov-19.md#412-should-weakmapweakset-have-a-clear-method-markm) ##### [0.1.2 - 2014.11.19](https://github.com/zloirock/core-js/releases/tag/v0.1.2) - `Map` & `Set` bug fix ##### [0.1.1 - 2014.11.18](https://github.com/zloirock/core-js/releases/tag/v0.1.1) - Public release core-js-3.33.2/CONTRIBUTING.md000066400000000000000000000244441451776221300154150ustar00rootroot00000000000000# Contributing Contributions are always welcome. Feel free to ask [**@zloirock**](https://github.com/zloirock) if you have some questions. ## I want to help with code, but I don't know how There is always some ["help wanted" issues](https://github.com/zloirock/core-js/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22). You can look at them first. Sure, other help is also required - you could ask [**@zloirock**](https://github.com/zloirock) about it or open issues if you have some ideas. ## How to add a new polyfill - The polyfill implementation should be added to the [`packages/core-js/modules`](./packages/core-js/modules) directory. - The polyfill should properly work in ES3 and all possible engines. If in some engines it cannot be implemented (for example, it striuctly requires more modern ES or unavailable platform features), it should not break any other `core-js` features or application in any way. - Avoid possible observing / breakage polyfills via patching built-ins at runtime: cache all global built-ins in the polyfills code and don't call prototype methods from instances. - Shared helpers should be added to the [`packages/core-js/internals`](./packages/core-js/internals) directory. Reuse already existing helpers. - Avoid direct import from `/modules/` path in `/internals|modules/` since it will break optimizations via Babel / `swc`. Specify such dependencies in `/es|stable|actual/full/` entries and use something like [`internals/get-built-in`](./packages/core-js/modules/get-built-in.js) helpers. - For export the polyfill, in all common cases use [`internals/export`](./packages/core-js/modules/export.js) helper. Use something else only if this helper is not applicable - for example, if you want to polyfill accessors. - If the code of the pure version implementation should significantly differ from the global version (*that's not a frequent situation, in most cases [`internals/is-pure`](./packages/core-js/modules/is-pure.js) constant is enough*), you can add it to [`packages/core-js-pure/override`](./packages/core-js-pure/override) directory. The rest parts of `core-js-pure` will be copied from `core-js` package. - Add the feature detection of the polyfill to [`tests/compat/tests.js`](./tests/compat/tests.js), add the compatibility data to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs), how to do it [see below](#how-to-update-core-js-compat-data), and the name of the polyfill module to [`packages/core-js-compat/src/modules-by-versions.mjs`](./packages/core-js-compat/src/modules-by-versions.mjs) (this data is also used for getting the default list of polyfills at bundling and generation indexes). - Add it to entry points where it's required: directories [`packages/core-js/es`](./packages/core-js/es), [`packages/core-js/stable`](./packages/core-js/stable), [`packages/core-js/actual`](./packages/core-js/actual), [`packages/core-js/full`](./packages/core-js/full), [`packages/core-js/proposals`](./packages/core-js/proposals), [`packages/core-js/stage`](./packages/core-js/stage) and [`packages/core-js/web`](./packages/core-js/web). - Add unit tests to [`tests/unit-global`](./tests/unit-global) and [`tests/unit-pure`](./tests/unit-pure). - Add tests of entry points to [`tests/entries/unit.mjs`](./tests/entries/unit.mjs). - Make sure that you are following [our coding style](#style-and-standards) and [all tests](#testing) are passed. - Document it in [README.md](./README.md) and [CHANGELOG.md](./CHANGELOG.md). [A simple example of adding a new polyfill.](https://github.com/zloirock/core-js/pull/1294/files) ## How to update `core-js-compat` data For updating `core-js-compat` data: - If you want to add a new data for a browser, run in this browser `tests/compat/index.html` (tests and results for the actual release are available at [`http://zloirock.github.io/core-js/compat/`](http://zloirock.github.io/core-js/compat/)) and you will see what `core-js` modules are required for this browser. ![compat-table](https://user-images.githubusercontent.com/2213682/217452234-ccdcfc5a-c7d3-40d1-ab3f-86902315b8c3.png) - If you want to add new data for NodeJS, run `npm run compat-node` with the installed required NodeJS version and you will see the results in the console. Use `npm run compat-node json` if you want to get the result as JSON. - If you want to add new data for Deno, run `npm run compat-deno` with the installed required Deno version and you will see the results in the console. Use `npm run compat-deno json` if you want to get the result as JSON. - If you want to add new data for Bun, run `npm run compat-bun` with the installed required Bun version and you will see the results in the console. - If you want to add new data for Rhino, set the required Rhino version in `compat-rhino` NPM script in [`package.json`](./package.json), run `npm run compat-rhino` and you will see the results in the console. - If you want to add new data for Hermes (incl. shipped with React Native), run `npm run compat-hermes YOR_PATH_TO_HERMES` and you will see the results in the console. - After getting this data, add it to [`packages/core-js-compat/src/data.mjs`](./packages/core-js-compat/src/data.mjs). - If you want to add new mapping (for example, to add a new iOS Safari version based on Safari or NodeJS based on Chrome), add it to [`packages/core-js-compat/src/mapping.mjs`](./packages/core-js-compat/src/mapping.mjs). engine | how to run tests | base data inherits from | mandatory check | mapping for a new version --- | --- | --- | --- | --- `android` | browser runner | `chrome`, `chrome-android` | | `bun` | bun runner | `safari` (only ES) | required | `chrome` | browser runner | | required | `chrome-android` | browser runner | `chrome` | | `deno` | deno runner | `chrome` (only ES) | non-ES features | required `edge` | browser runner | `ie`, `chrome` | required (<= 18) | `electron` | browser runner | `chrome` | | required `firefox` | browser runner | | required | `firefox-android` | browser runner | `firefox` | | `hermes` | hermes runner | | required | `ie` | browser runner | | required | `ios` | browser runner | `safari` | | if inconsistent (!= `safari`) `node` | node runner | `chrome` (only ES) | non-ES features | required `opera` | browser runner | `chrome` | | if inconsistent (!= `chrome` - 14) `opera-android` | browser runner | `opera`, `chrome-android` | | required `phantom` | browser runner | `safari` | | `quest` | browser runner | `chrome-android` | | required `react-native` | hermes runner | `hermes` | required | `rhino` | rhino runner | | required | `safari` | browser runner | | required | `samsung` | browser runner | `chrome-android` | | required If you have no access to all required browsers / versions of browsers, use [Sauce Labs](https://saucelabs.com/), [BrowserStack](https://www.browserstack.com/) or [Cloud Browser](https://ieonchrome.com/). ## Style and standards The coding style should follow our [`eslint.config.js`](./tests/eslint/eslint.config.js). You can test it by calling [`npm run lint`](#testing). Different places have different syntax and standard library limitations: - Polyfill implementations should use only ES3 syntax and standard library, they should not use other polyfills from the global scope. - Unit tests should use the modern syntax with our [minimalistic Babel config](./babel.config.js). Unit tests for the pure version should not use any modern standard library features. - Tools, scripts and tests, performed in NodeJS, should use only the syntax and the standard library available in NodeJS 8. File names should be in the kebab-case. Name of polyfill modules should follow the naming convention `namespace.subnamespace-where-required.feature-name`, for example, `esnext.set.intersection`. The top-level namespace should be `es` for stable ECMAScript features, `esnext` for ECMAScript proposals and `web` for other web standards. ## Testing Before testing, you should install dependencies: ```sh npm i ``` You can run the most tests by ```sh npm t ``` You can run parts of the test case separately: - Linting: ```sh npm run lint ``` - Unit test case in Karma (modern Chromium, Firefox, WebKit (Playwright) and ancient WebKit (PhantomJS)): ```sh npx run-s prepare bundle test-unit-karma ``` - Unit test case in NodeJS: ```sh npx run-s prepare bundle test-unit-node ``` - Unit test case in Bun (it's not included in `npm t` since required installed Bun): ```sh npx run-s prepare bundle test-unit-bun ``` - [Test262](https://github.com/tc39/test262) test case (it's not included to the default tests): ```sh npx run-s prepare bundle-package test262 ``` - [Promises/A+](https://github.com/promises-aplus/promises-tests) and [ES6 `Promise`](https://github.com/promises-es6/promises-es6) test cases: ```sh npx run-s prepare test-promises ``` - [ECMAScript `Observable` test case](https://github.com/tc39/proposal-observable): ```sh npx run-s prepare test-observables ``` - CommonJS entry points tests: ```sh npx run-s prepare test-entries ``` - `core-js-compat` tools tests: ```sh npx run-s prepare test-compat-tools ``` - `core-js-builder` tests: ```sh npx run-s prepare test-builder ``` - If you want to run tests in a certain browser, at first, you should build packages and test bundles: ```sh npx run-s prepare bundle ``` - For running the global version of the unit test case, use this file: ```sh tests/unit-browser/global.html ``` - For running the pure version of the unit test case, use this file: ```sh tests/unit-browser/pure.html ``` core-js-3.33.2/LICENSE000066400000000000000000000020501451776221300141560ustar00rootroot00000000000000Copyright (c) 2014-2023 Denis Pushkarev 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. core-js-3.33.2/README.md000066400000000000000000005523531451776221300144500ustar00rootroot00000000000000![logo](https://user-images.githubusercontent.com/2213682/146607186-8e13ddef-26a4-4ebf-befd-5aac9d77c090.png)
[![fundraising](https://opencollective.com/core-js/all/badge.svg?label=fundraising)](https://opencollective.com/core-js) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![core-js downloads](https://img.shields.io/npm/dm/core-js.svg?label=npm%20i%20core-js)](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18) [![core-js-pure downloads](https://img.shields.io/npm/dm/core-js-pure.svg?label=npm%20i%20core-js-pure)](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18) [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/core-js-bundle/badge?style=rounded)](https://www.jsdelivr.com/package/npm/core-js-bundle)
**I highly recommend reading this: [So, what's next?](https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md)** --- > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2023](#ecmascript): [promises](#ecmascript-promise), [symbols](#ecmascript-symbol), [collections](#ecmascript-collections), iterators, [typed arrays](#ecmascript-typed-arrays), many other features, [ECMAScript proposals](#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. **If you are looking for documentation for obsolete `core-js@2`, please, check [this branch](https://github.com/zloirock/core-js/tree/v2).** ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer if you are interested in `core-js`: [**Open Collective**](https://opencollective.com/core-js), [**Patreon**](https://patreon.com/zloirock), [**Boosty**](https://boosty.to/zloirock), **Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz )**, [**Alipay**](https://user-images.githubusercontent.com/2213682/219464783-c17ad329-17ce-4795-82a7-f609493345ed.png). --- --- --- [*Example of usage*](https://tinyurl.com/2mknex43): ```js import 'core-js/actual'; Promise.resolve(42).then(it => console.log(it)); // => 42 Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] [1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2] (function * (i) { while (true) yield i++; })(1) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) ``` *You can load only required features*: ```js import 'core-js/actual/promise'; import 'core-js/actual/set'; import 'core-js/actual/iterator'; import 'core-js/actual/array/from'; import 'core-js/actual/array/flat-map'; import 'core-js/actual/structured-clone'; Promise.resolve(42).then(it => console.log(it)); // => 42 Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] [1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2] (function * (i) { while (true) yield i++; })(1) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) ``` *Or use it without global namespace pollution*: ```js import Promise from 'core-js-pure/actual/promise'; import Set from 'core-js-pure/actual/set'; import Iterator from 'core-js-pure/actual/iterator'; import from from 'core-js-pure/actual/array/from'; import flatMap from 'core-js-pure/actual/array/flat-map'; import structuredClone from 'core-js-pure/actual/structured-clone'; Promise.resolve(42).then(it => console.log(it)); // => 42 from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] flatMap([1, 2], it => [it, it]); // => [1, 1, 2, 2] Iterator.from(function * (i) { while (true) yield i++; }(1)) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) ``` ### Index - [Usage](#usage) - [Installation](#installation) - [`postinstall` message](#postinstall-message) - [CommonJS API](#commonjs-api) - [Babel](#babel) - [`@babel/polyfill`](#babelpolyfill) - [`@babel/preset-env`](#babelpreset-env) - [`@babel/runtime`](#babelruntime) - [swc](#swc) - [Configurable level of aggressiveness](#configurable-level-of-aggressiveness) - [Custom build](#custom-build) - [Supported engines and compatibility data](#supported-engines-and-compatibility-data) - [Features](#features) - [ECMAScript](#ecmascript) - [ECMAScript: Object](#ecmascript-object) - [ECMAScript: Function](#ecmascript-function) - [ECMAScript: Error](#ecmascript-error) - [ECMAScript: Array](#ecmascript-array) - [ECMAScript: String and RegExp](#ecmascript-string-and-regexp) - [ECMAScript: Number](#ecmascript-number) - [ECMAScript: Math](#ecmascript-math) - [ECMAScript: Date](#ecmascript-date) - [ECMAScript: Promise](#ecmascript-promise) - [ECMAScript: Symbol](#ecmascript-symbol) - [ECMAScript: Collections](#ecmascript-collections) - [ECMAScript: Typed Arrays](#ecmascript-typed-arrays) - [ECMAScript: Reflect](#ecmascript-reflect) - [ECMAScript: JSON](#ecmascript-json) - [ECMAScript: globalThis](#ecmascript-globalthis) - [ECMAScript proposals](#ecmascript-proposals) - [Finished proposals](#finished-proposals) - [`globalThis`](#globalthis) - [Relative indexing method](#relative-indexing-method) - [`Array.prototype.includes`](#arrayprototypeincludes) - [`Array.prototype.flat` / `Array.prototype.flatMap`](#arrayprototypeflat--arrayprototypeflatmap) - [`Array` find from last](#array-find-from-last) - [Change `Array` by copy](#change-array-by-copy) - [`Object.values` / `Object.entries`](#objectvalues--objectentries) - [`Object.fromEntries`](#objectfromentries) - [`Object.getOwnPropertyDescriptors`](#objectgetownpropertydescriptors) - [Accessible `Object.prototype.hasOwnProperty`](#accessible-objectprototypehasownproperty) - [`String` padding](#string-padding) - [`String.prototype.matchAll`](#stringmatchall) - [`String.prototype.replaceAll`](#stringreplaceall) - [`String.prototype.trimStart` / `String.prototype.trimEnd`](#stringprototypetrimstart-stringprototypetrimend) - [`RegExp` `s` (`dotAll`) flag](#regexp-s-dotall-flag) - [`RegExp` named capture groups](#regexp-named-capture-groups) - [`Promise.allSettled`](#promiseallsettled) - [`Promise.any`](#promiseany) - [`Promise.prototype.finally`](#promiseprototypefinally) - [`Symbol.asyncIterator` for asynchronous iteration](#symbolasynciterator-for-asynchronous-iteration) - [`Symbol.prototype.description`](#symbolprototypedescription) - [Well-formed `JSON.stringify`](#well-formed-jsonstringify) - [Well-formed unicode strings](#well-formed-unicode-strings) - [Stage 3 proposals](#stage-3-proposals) - [`Iterator` helpers](#iterator-helpers) - [`Array` grouping](#array-grouping) - [`Array.fromAsync`](#arrayfromasync) - [New `Set` methods](#new-set-methods) - [`Promise.withResolvers`](#promisewithresolvers) - [`JSON.parse` source text access](#jsonparse-source-text-access) - [`Float16` methods](#float16-methods) - [`ArrayBuffer.prototype.transfer` and friends](#arraybufferprototypetransfer-and-friends) - [Explicit resource management](#explicit-resource-management) - [`Symbol.metadata` for decorators metadata proposal](#symbolmetadata-for-decorators-metadata-proposal) - [Stage 2 proposals](#stage-2-proposals) - [`AsyncIterator` helpers](#asynciterator-helpers) - [`Iterator.range`](#iteratorrange) - [`Map.prototype.emplace`](#mapprototypeemplace) - [`Array.isTemplateObject`](#arrayistemplateobject) - [`String.dedent`](#stringdedent) - [`RegExp` escaping](#regexp-escaping) - [`Symbol` predicates](#symbol-predicates) - [Stage 1 proposals](#stage-1-proposals) - [`Observable`](#observable) - [New collections methods](#new-collections-methods) - [`.of` and `.from` methods on collection constructors](#of-and-from-methods-on-collection-constructors) - [`compositeKey` and `compositeSymbol`](#compositekey-and-compositesymbol) - [`Array` filtering](#array-filtering) - [`Array` deduplication](#array-deduplication) - [`DataView` get / set `Uint8Clamped` methods](#dataview-get-set-iint8clamped-methods) - [`Number.fromString`](#numberfromstring) - [`Math` extensions](#math-extensions) - [`Math.signbit`](#mathsignbit) - [`String.cooked`](#stringcooked) - [`String.prototype.codePoints`](#stringprototypecodepoints) - [`Symbol.matcher` for pattern matching](#symbolmatcher-for-pattern-matching) - [Stage 0 proposals](#stage-0-proposals) - [`Function.prototype.demethodize`](#functionprototypedemethodize) - [`Function.{ isCallable, isConstructor }`](#function-iscallable-isconstructor-) - [Pre-stage 0 proposals](#pre-stage-0-proposals) - [`Reflect` metadata](#reflect-metadata) - [Web standards](#web-standards) - [`self`](#self) - [`structuredClone`](#structuredclone) - [Base64 utility methods](#base64-utility-methods) - [`setTimeout` and `setInterval`](#settimeout-and-setinterval) - [`setImmediate`](#setimmediate) - [`queueMicrotask`](#queuemicrotask) - [`URL` and `URLSearchParams`](#url-and-urlsearchparams) - [`DOMException`](#domexception) - [iterable DOM collections](#iterable-dom-collections) - [Iteration helpers](#iteration-helpers) - [Missing polyfills](#missing-polyfills) - [Contributing](./CONTRIBUTING.md) - [Security policy](https://github.com/zloirock/core-js/blob/master/SECURITY.md) - [Changelog](./CHANGELOG.md) ## Usage[⬆](#index) ### Installation:[⬆](#index) ```sh // global version npm install --save core-js@3.33.2 // version without global namespace pollution npm install --save core-js-pure@3.33.2 // bundled global version npm install --save core-js-bundle@3.33.2 ``` Or you can use `core-js` [from CDN](https://www.jsdelivr.com/package/npm/core-js-bundle). ### `postinstall` message[⬆](#index) The `core-js` project needs your help, so the package shows a message about it after installation. If it causes problems for you, you can disable it: ```sh ADBLOCK=true npm install // or DISABLE_OPENCOLLECTIVE=true npm install // or npm install --loglevel silent ``` ### CommonJS API[⬆](#index) You can import only-required-for-you polyfills, like in examples at the top of `README.md`. Available CommonJS entry points for all polyfilled methods / constructors and namespaces. Just some examples: ```js // polyfill all `core-js` features, including early-stage proposals: import "core-js"; // or: import "core-js/full"; // polyfill all actual features - stable ES, web standards and stage 3 ES proposals: import "core-js/actual"; // polyfill only stable features - ES and web standards: import "core-js/stable"; // polyfill only stable ES features: import "core-js/es"; // if you want to polyfill `Set`: // all `Set`-related features, with early-stage ES proposals: import "core-js/full/set"; // stable required for `Set` ES features, features from web standards and stage 3 ES proposals: import "core-js/actual/set"; // stable required for `Set` ES features and features from web standards // (DOM collections iterator in this case): import "core-js/stable/set"; // only stable ES features required for `Set`: import "core-js/es/set"; // the same without global namespace pollution: import Set from "core-js-pure/full/set"; import Set from "core-js-pure/actual/set"; import Set from "core-js-pure/stable/set"; import Set from "core-js-pure/es/set"; // if you want to polyfill just required methods: import "core-js/full/set/intersection"; import "core-js/actual/array/find-last"; import "core-js/stable/queue-microtask"; import "core-js/es/array/from"; // polyfill iterator helpers proposal: import "core-js/proposals/iterator-helpers"; // polyfill all stage 2+ proposals: import "core-js/stage/2"; ``` **Note: The usage of the `/actual/` namespace is recommended since it includes all actual JavaScript features and does not include unstable early-stage proposals that are available mainly for experiments.** ##### Caveats when using CommonJS API:[⬆](#index) * `modules` path is an internal API, does not inject all required dependencies and can be changed in minor or patch releases. Use it only for a custom build and/or if you know what are you doing. * If you use `core-js` with the extension of native objects, recommended load all `core-js` modules at the top of the entry point of your application, otherwise, you can have conflicts. * For example, Google Maps use their own `Symbol.iterator`, conflicting with `Array.from`, `URLSearchParams` and/or something else from `core-js`, see [related issues](https://github.com/zloirock/core-js/search?q=Google+Maps&type=Issues). * Such conflicts also resolvable by discovering and manual adding each conflicting entry from `core-js`. * `core-js` is extremely modular and uses a lot of very tiny modules, because of that for usage in browsers bundle up `core-js` instead of usage loader for each file, otherwise, you will have hundreds of requests. #### CommonJS and prototype methods without global namespace pollution[⬆](#index) In the `pure` version, we can't pollute prototypes of native constructors. Because of that, prototype methods transformed into static methods like in examples above. But with transpilers, we can use one more trick - [bind operator and virtual methods](https://github.com/tc39/proposal-bind-operator). Special for that, available `/virtual/` entry points. Example: ```js import fill from 'core-js-pure/actual/array/virtual/fill'; import findIndex from 'core-js-pure/actual/array/virtual/find-index'; Array(10)::fill(0).map((a, b) => b * b)::findIndex(it => it && !(it % 8)); // => 4 ``` > **Warning!** The bind operator is an early-stage ECMAScript proposal and usage of this syntax can be dangerous. ### Babel[⬆](#index) `core-js` is integrated with `babel` and is the base for polyfilling-related `babel` features: #### `@babel/polyfill`[⬆](#index) [`@babel/polyfill`](https://babeljs.io/docs/usage/polyfill) [**IS** just the import of stable `core-js` features and `regenerator-runtime`](https://github.com/babel/babel/blob/c8bb4500326700e7dc68ce8c4b90b6482c48d82f/packages/babel-polyfill/src/index.js) for generators and async functions, so if you load `@babel/polyfill` - you load the global version of `core-js` without ES proposals. Now it's deprecated in favour of separate inclusion of required parts of `core-js` and `regenerator-runtime` and, for preventing breaking changes, left on `core-js@2`. As a full equal of `@babel/polyfill`, you can use this: ```js import 'core-js/stable'; import 'regenerator-runtime/runtime'; ``` #### `@babel/preset-env`[⬆](#index) [`@babel/preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) has `useBuiltIns` option, which optimizes working with global version of `core-js`. With `useBuiltIns` option, you should also set `corejs` option to used version of `core-js`, like `corejs: '3.33'`. > **Warning!** Recommended to specify used minor `core-js` version, like `corejs: '3.33'`, instead of `corejs: 3`, since with `corejs: 3` will not be injected modules which were added in minor `core-js` releases. - `useBuiltIns: 'entry'` replaces imports of `core-js` to import only required for a target environment modules. So, for example, ```js import 'core-js/stable'; ``` with `chrome 71` target will be replaced just to: ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; ``` It works for all entry points of global version of `core-js` and their combinations, for example for ```js import 'core-js/es'; import 'core-js/proposals/set-methods'; import 'core-js/full/set/map'; ``` with `chrome 71` target you will have as a result: ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.set.difference"; import "core-js/modules/esnext.set.intersection"; import "core-js/modules/esnext.set.is-disjoint-from"; import "core-js/modules/esnext.set.is-subset-of"; import "core-js/modules/esnext.set.is-superset-of"; import "core-js/modules/esnext.set.map"; import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; ``` - `useBuiltIns: 'usage'` adds to the top of each file import of polyfills for features used in this file and not supported by target environments, so for: ```js // first file: var set = new Set([1, 2, 3]); // second file: var array = Array.of(1, 2, 3); ``` if target contains an old environment like `IE 11` we will have something like: ```js // first file: import 'core-js/modules/es.array.iterator'; import 'core-js/modules/es.object.to-string'; import 'core-js/modules/es.set'; var set = new Set([1, 2, 3]); // second file: import 'core-js/modules/es.array.of'; var array = Array.of(1, 2, 3); ``` By default, `@babel/preset-env` with `useBuiltIns: 'usage'` option only polyfills stable features, but you can enable polyfilling of proposals by `proposals` option, as `corejs: { version: '3.33', proposals: true }`. > **Warning!** In the case of `useBuiltIns: 'usage'`, you should not add `core-js` imports by yourself, they will be added automatically. #### `@babel/runtime`[⬆](#index) [`@babel/runtime`](https://babeljs.io/docs/plugins/transform-runtime/) with `corejs: 3` option simplifies work with `core-js-pure`. It automatically replaces usage of modern features from JS standard library to imports from the version of `core-js` without global namespace pollution, so instead of: ```js import from from 'core-js-pure/stable/array/from'; import flat from 'core-js-pure/stable/array/flat'; import Set from 'core-js-pure/stable/set'; import Promise from 'core-js-pure/stable/promise'; from(new Set([1, 2, 3, 2, 1])); flat([1, [2, 3], [4, [5]]], 2); Promise.resolve(32).then(x => console.log(x)); ``` you can write just: ```js Array.from(new Set([1, 2, 3, 2, 1])); [1, [2, 3], [4, [5]]].flat(2); Promise.resolve(32).then(x => console.log(x)); ``` By default, `@babel/runtime` only polyfills stable features, but like in `@babel/preset-env`, you can enable polyfilling of proposals by `proposals` option, as `corejs: { version: 3, proposals: true }`. > **Warning!** If you use `@babel/preset-env` and `@babel/runtime` together, use `corejs` option only in one place since it's duplicate functionality and will cause conflicts. ### swc[⬆](#index) Fast JavaScript transpiler `swc` [contains integration with `core-js`](https://swc.rs/docs/configuration/supported-browsers), that optimizes work with the global version of `core-js`. [Like `@babel/preset-env`](#babelpreset-env), it has 2 modes: `usage` and `entry`, but `usage` mode still works not so good like in `babel`. Example of configuration in `.swcrc`: ```json { "env": { "targets": "> 0.25%, not dead", "mode": "entry", "coreJs": "3.33" } } ``` ### Configurable level of aggressiveness[⬆](#index) By default, `core-js` sets polyfills only when they are required. That means that `core-js` checks if a feature is available and works correctly or not and if it has no problems, `core-js` use native implementation. But sometimes `core-js` feature detection could be too strict for your case. For example, `Promise` constructor requires the support of unhandled rejection tracking and `@@species`. Sometimes we could have inverse problem - knowingly broken environment with problems not covered by `core-js` feature detection. For those cases, we could redefine this behaviour for certain polyfills: ```js const configurator = require('core-js/configurator'); configurator({ useNative: ['Promise'], // polyfills will be used only if natives completely unavailable usePolyfill: ['Array.from', 'String.prototype.padEnd'], // polyfills will be used anyway useFeatureDetection: ['Map', 'Set'], // default behaviour }); require('core-js/actual'); ``` It does not work with some features. Also, if you change the default behaviour, even `core-js` internals may not work correctly. ### Custom build[⬆](#index) For some cases could be useful to exclude some `core-js` features or generate a polyfill for target engines. You could use [`core-js-builder`](/packages/core-js-builder) package for that. ## Supported engines and compatibility data[⬆](#index) `core-js` tries to support all possible JS engines and environments with ES3 support. Some features have a higher lower bar - for example, *some* accessors can properly work only from ES5, promises require a way to set a microtask or a task, etc. However, I have no possibility to test `core-js` absolutely everywhere - for example, testing in IE7- and some other ancient was stopped. The list of definitely supported engines you can see in the compatibility table by the link below. [Write](https://github.com/zloirock/core-js/issues) if you have issues or questions with the support of any engine. `core-js` project provides (as [`core-js-compat`](/packages/core-js-compat) package) all required data about the necessity of `core-js` modules, entry points, and tools for work with it - it's useful for integration with tools like `babel` or `swc`. If you wanna help, you could take a look at the related section of [`CONTRIBUTING.md`](/CONTRIBUTING.md#how-to-update-core-js-compat-data). The visualization of compatibility data and the browser tests runner is available [here](http://zloirock.github.io/core-js/compat/), the example: ![compat-table](https://user-images.githubusercontent.com/2213682/217452234-ccdcfc5a-c7d3-40d1-ab3f-86902315b8c3.png) ## Features:[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure) ``` ### ECMAScript[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es ``` #### ECMAScript: Object[⬆](#index) Modules [`es.object.assign`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.assign.js), [`es.object.create`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.create.js), [`es.object.define-getter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.define-getter.js), [`es.object.define-property`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.define-property.js), [`es.object.define-properties`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.define-properties.js), [`es.object.define-setter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.define-setter.js), [`es.object.entries`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.entries.js), [`es.object.freeze`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.freeze.js), [`es.object.from-entries`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.from-entries.js), [`es.object.get-own-property-descriptor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.get-own-property-descriptor.js), [`es.object.get-own-property-descriptors`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.get-own-property-descriptors.js), [`es.object.get-own-property-names`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.get-own-property-names.js), [`es.object.get-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.get-prototype-of.js), [`es.object.has-own`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.has-own.js), [`es.object.is`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.is.js), [`es.object.is-extensible`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.is-extensible.js), [`es.object.is-frozen`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.is-frozen.js), [`es.object.is-sealed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.is-sealed.js), [`es.object.keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.keys.js), [`es.object.lookup-setter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.lookup-setter.js), [`es.object.lookup-getter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.lookup-getter.js), [`es.object.prevent-extensions`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.prevent-extensions.js), [`es.object.proto`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.proto.js), [`es.object.to-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.to-string.js), [`es.object.seal`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.seal.js), [`es.object.set-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.set-prototype-of.js), [`es.object.values`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.object.values.js). ```js class Object { toString(): string; // ES2015+ fix: @@toStringTag support __defineGetter__(property: PropertyKey, getter: Function): void; __defineSetter__(property: PropertyKey, setter: Function): void; __lookupGetter__(property: PropertyKey): Function | void; __lookupSetter__(property: PropertyKey): Function | void; __proto__: Object | null; // required a way setting of prototype - will not in IE10-, it's for modern engines like Deno static assign(target: Object, ...sources: Array): Object; static create(prototype: Object | null, properties?: { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor })): Object; static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object; static entries(object: Object): Array<[string, mixed]>; static freeze(object: any): any; static fromEntries(iterable: Iterable<[key, value]>): Object; static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void; static getOwnPropertyDescriptors(object: any): { [property: PropertyKey]: PropertyDescriptor }; static getOwnPropertyNames(object: any): Array; static getPrototypeOf(object: any): Object | null; static hasOwn(object: object, key: PropertyKey): boolean; static is(value1: any, value2: any): boolean; static isExtensible(object: any): boolean; static isFrozen(object: any): boolean; static isSealed(object: any): boolean; static keys(object: any): Array; static preventExtensions(object: any): any; static seal(object: any): any; static setPrototypeOf(target: any, prototype: Object | null): any; // required __proto__ - IE11+ static values(object: any): Array; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/object core-js(-pure)/es|stable|actual|full/object/assign core-js(-pure)/es|stable|actual|full/object/is core-js(-pure)/es|stable|actual|full/object/set-prototype-of core-js(-pure)/es|stable|actual|full/object/get-prototype-of core-js(-pure)/es|stable|actual|full/object/create core-js(-pure)/es|stable|actual|full/object/define-property core-js(-pure)/es|stable|actual|full/object/define-properties core-js(-pure)/es|stable|actual|full/object/get-own-property-descriptor core-js(-pure)/es|stable|actual|full/object/get-own-property-descriptors core-js(-pure)/es|stable|actual|full/object/has-own core-js(-pure)/es|stable|actual|full/object/keys core-js(-pure)/es|stable|actual|full/object/values core-js(-pure)/es|stable|actual|full/object/entries core-js(-pure)/es|stable|actual|full/object/get-own-property-names core-js(-pure)/es|stable|actual|full/object/freeze core-js(-pure)/es|stable|actual|full/object/from-entries core-js(-pure)/es|stable|actual|full/object/seal core-js(-pure)/es|stable|actual|full/object/prevent-extensions core-js/es|stable|actual|full/object/proto core-js(-pure)/es|stable|actual|full/object/is-frozen core-js(-pure)/es|stable|actual|full/object/is-sealed core-js(-pure)/es|stable|actual|full/object/is-extensible core-js/es|stable|actual|full/object/to-string core-js(-pure)/es|stable|actual|full/object/define-getter core-js(-pure)/es|stable|actual|full/object/define-setter core-js(-pure)/es|stable|actual|full/object/lookup-getter core-js(-pure)/es|stable|actual|full/object/lookup-setter ``` [*Examples*](https://is.gd/udzZq0): ```js let foo = { q: 1, w: 2 }; let bar = { e: 3, r: 4 }; let baz = { t: 5, y: 6 }; Object.assign(foo, bar, baz); // => foo = { q: 1, w: 2, e: 3, r: 4, t: 5, y: 6 } Object.is(NaN, NaN); // => true Object.is(0, -0); // => false Object.is(42, 42); // => true Object.is(42, '42'); // => false function Parent() {} function Child() {} Object.setPrototypeOf(Child.prototype, Parent.prototype); new Child() instanceof Child; // => true new Child() instanceof Parent; // => true let object = { [Symbol.toStringTag]: 'Foo' }; '' + object; // => '[object Foo]' Object.keys('qwe'); // => ['0', '1', '2'] Object.getPrototypeOf('qwe') === String.prototype; // => true Object.values({ a: 1, b: 2, c: 3 }); // => [1, 2, 3] Object.entries({ a: 1, b: 2, c: 3 }); // => [['a', 1], ['b', 2], ['c', 3]] for (let [key, value] of Object.entries({ a: 1, b: 2, c: 3 })) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } // Shallow object cloning with prototype and descriptors: let copy = Object.create(Object.getPrototypeOf(object), Object.getOwnPropertyDescriptors(object)); // Mixin: Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); const map = new Map([['a', 1], ['b', 2]]); Object.fromEntries(map); // => { a: 1, b: 2 } class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102)]); Object.fromEntries(units.entries()); // => { unit101: Unit { id: 101 }, unit102: Unit { id: 102 } } Object.hasOwn({ foo: 42 }, 'foo'); // => true Object.hasOwn({ foo: 42 }, 'bar'); // => false Object.hasOwn({}, 'toString'); // => false ``` #### ECMAScript: Function[⬆](#index) Modules [`es.function.name`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.name.js), [`es.function.has-instance`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.has-instance.js). Just ES5: [`es.function.bind`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.bind.js). ```js class Function { name: string; bind(thisArg: any, ...args: Array): Function; @@hasInstance(value: any): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|actual|full/function core-js/es|stable|actual|full/function/name core-js/es|stable|actual|full/function/has-instance core-js(-pure)/es|stable|actual|full/function/bind core-js(-pure)/es|stable|actual|full/function/virtual/bind ``` [*Example*](https://goo.gl/zqu3Wp): ```js (function foo() {}).name // => 'foo' console.log.bind(console, 42)(43); // => 42 43 ``` #### ECMAScript: Error[⬆](#index) Modules [`es.aggregate-error`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.aggregate-error.js), [`es.aggregate-error.cause`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.aggregate-error.cause.js), [`es.error.cause`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.error.cause.js). ```js class [ Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, WebAssembly.CompileError, WebAssembly.LinkError, WebAssembly.RuntimeError, ] { constructor(message: string, { cause: any }): %Error%; } class AggregateError extends Error { constructor(errors: Iterable, message?: string, { cause: any }?): AggregateError; errors: Array; message: string; cause: any; } class Error { toString(): string; // different fixes } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/aggregate-error core-js/es|stable|actual|full/error core-js/es|stable|actual|full/error/constructor core-js/es|stable|actual|full/error/to-string ``` [*Example*](https://is.gd/1SufcH): ```js const error1 = new TypeError('Error 1'); const error2 = new TypeError('Error 2'); const aggregate = new AggregateError([error1, error2], 'Collected errors'); aggregate.errors[0] === error1; // => true aggregate.errors[1] === error2; // => true const cause = new TypeError('Something wrong'); const error = new TypeError('Here explained what`s wrong', { cause }); error.cause === cause; // => true Error.prototype.toString.call({ message: 1, name: 2 }) === '2: 1'; // => true ``` #### ECMAScript: Array[⬆](#index) Modules [`es.array.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.from.js), [`es.array.is-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.is-array.js), [`es.array.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.of.js), [`es.array.copy-within`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.copy-within.js), [`es.array.fill`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.fill.js), [`es.array.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find.js), [`es.array.find-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-index.js), [`es.array.find-last`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-last.js), [`es.array.find-last-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-last-index.js), [`es.array.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.iterator.js), [`es.array.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.includes.js), [`es.array.push`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.push.js), [`es.array.slice`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.slice.js), [`es.array.join`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.join.js), [`es.array.unshift`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unshift.js), [`es.array.index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.index-of.js), [`es.array.last-index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.last-index-of.js), [`es.array.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.every.js), [`es.array.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.some.js), [`es.array.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.for-each.js), [`es.array.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.map.js), [`es.array.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.filter.js), [`es.array.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reduce.js), [`es.array.reduce-right`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reduce-right.js), [`es.array.reverse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reverse.js), [`es.array.sort`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.sort.js), [`es.array.flat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.flat.js), [`es.array.flat-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.flat-map.js), [`es.array.unscopables.flat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unscopables.flat.js), [`es.array.unscopables.flat-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unscopables.flat-map.js), [`es.array.at`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.at.js), [`es.array.to-reversed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.to-reversed.js), [`es.array.to-sorted`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.to-sorted.js), [`es.array.to-spliced`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.to-spliced.js), [`es.array.with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.with.js). ```js class Array { at(index: int): any; concat(...args: Array): Array; // with adding support of @@isConcatSpreadable and @@species copyWithin(target: number, start: number, end?: number): this; entries(): Iterator<[index, value]>; every(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean; fill(value: any, start?: number, end?: number): this; filter(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): Array; // with adding support of @@species find(callbackfn: (value: any, index: number, target: any) => boolean), thisArg?: any): any; findIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint; findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any; findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint; flat(depthArg?: number = 1): Array; flatMap(mapFn: (value: any, index: number, target: any) => any, thisArg: any): Array; forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg?: any): void; includes(searchElement: any, from?: number): boolean; indexOf(searchElement: any, from?: number): number; join(separator: string = ','): string; keys(): Iterator; lastIndexOf(searchElement: any, from?: number): number; map(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Array; // with adding support of @@species push(...args: Array): uint; reduce(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any; reduceRight(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any; reverse(): this; // Safari 12.0 bug fix slice(start?: number, end?: number): Array; // with adding support of @@species splice(start?: number, deleteCount?: number, ...items: Array): Array; // with adding support of @@species some(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean; sort(comparefn?: (a: any, b: any) => number): this; // with modern behavior like stable sort toReversed(): Array; toSpliced(start?: number, deleteCount?: number, ...items: Array): Array; toSorted(comparefn?: (a: any, b: any) => number): Array; unshift(...args: Array): uint; values(): Iterator; with(index: includes, value: any): Array; @@iterator(): Iterator; @@unscopables: { [newMethodNames: string]: true }; static from(items: Iterable | ArrayLike, mapFn?: (value: any, index: number) => any, thisArg?: any): Array; static isArray(value: any): boolean; static of(...args: Array): Array; } class Arguments { @@iterator(): Iterator; // available only in core-js methods } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/array core-js(-pure)/es|stable|actual|full/array/from core-js(-pure)/es|stable|actual|full/array/of core-js(-pure)/es|stable|actual|full/array/is-array core-js(-pure)/es|stable|actual|full/array(/virtual)/at core-js(-pure)/es|stable|actual|full/array(/virtual)/concat core-js(-pure)/es|stable|actual|full/array(/virtual)/copy-within core-js(-pure)/es|stable|actual|full/array(/virtual)/entries core-js(-pure)/es|stable|actual|full/array(/virtual)/every core-js(-pure)/es|stable|actual|full/array(/virtual)/fill core-js(-pure)/es|stable|actual|full/array(/virtual)/filter core-js(-pure)/es|stable|actual|full/array(/virtual)/find core-js(-pure)/es|stable|actual|full/array(/virtual)/find-index core-js(-pure)/es|stable|actual|full/array(/virtual)/find-last core-js(-pure)/es|stable|actual|full/array(/virtual)/find-last-index core-js(-pure)/es|stable|actual|full/array(/virtual)/flat core-js(-pure)/es|stable|actual|full/array(/virtual)/flat-map core-js(-pure)/es|stable|actual|full/array(/virtual)/for-each core-js(-pure)/es|stable|actual|full/array(/virtual)/includes core-js(-pure)/es|stable|actual|full/array(/virtual)/index-of core-js(-pure)/es|stable|actual|full/array(/virtual)/iterator core-js(-pure)/es|stable|actual|full/array(/virtual)/join core-js(-pure)/es|stable|actual|full/array(/virtual)/keys core-js(-pure)/es|stable|actual|full/array(/virtual)/last-index-of core-js(-pure)/es|stable|actual|full/array(/virtual)/map core-js(-pure)/es|stable|actual|full/array(/virtual)/push core-js(-pure)/es|stable|actual|full/array(/virtual)/reduce core-js(-pure)/es|stable|actual|full/array(/virtual)/reduce-right core-js(-pure)/es|stable|actual|full/array(/virtual)/reverse core-js(-pure)/es|stable|actual|full/array(/virtual)/slice core-js(-pure)/es|stable|actual|full/array(/virtual)/some core-js(-pure)/es|stable|actual|full/array(/virtual)/sort core-js(-pure)/es|stable|actual|full/array(/virtual)/splice core-js(-pure)/es|stable|actual|full/array(/virtual)/to-reversed core-js(-pure)/es|stable|actual|full/array(/virtual)/to-sorted core-js(-pure)/es|stable|actual|full/array(/virtual)/to-spliced core-js(-pure)/es|stable|actual|full/array(/virtual)/unshift core-js(-pure)/es|stable|actual|full/array(/virtual)/values core-js(-pure)/es|stable|actual|full/array(/virtual)/with ``` [*Examples*](https://tinyurl.com/2oaa8x2x): ```js Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] Array.from({ 0: 1, 1: 2, 2: 3, length: 3 }); // => [1, 2, 3] Array.from('123', Number); // => [1, 2, 3] Array.from('123', it => it * it); // => [1, 4, 9] Array.of(1); // => [1] Array.of(1, 2, 3); // => [1, 2, 3] let array = ['a', 'b', 'c']; for (let value of array) console.log(value); // => 'a', 'b', 'c' for (let value of array.values()) console.log(value); // => 'a', 'b', 'c' for (let key of array.keys()) console.log(key); // => 0, 1, 2 for (let [key, value] of array.entries()) { console.log(key); // => 0, 1, 2 console.log(value); // => 'a', 'b', 'c' } function isOdd(value) { return value % 2; } [4, 8, 15, 16, 23, 42].find(isOdd); // => 15 [4, 8, 15, 16, 23, 42].findIndex(isOdd); // => 2 [1, 2, 3, 4].findLast(isOdd); // => 3 [1, 2, 3, 4].findLastIndex(isOdd); // => 2 Array(5).fill(42); // => [42, 42, 42, 42, 42] [1, 2, 3, 4, 5].copyWithin(0, 3); // => [4, 5, 3, 4, 5] [1, 2, 3].includes(2); // => true [1, 2, 3].includes(4); // => false [1, 2, 3].includes(2, 2); // => false [NaN].indexOf(NaN); // => -1 [NaN].includes(NaN); // => true Array(1).indexOf(undefined); // => -1 Array(1).includes(undefined); // => true [1, [2, 3], [4, 5]].flat(); // => [1, 2, 3, 4, 5] [1, [2, [3, [4]]], 5].flat(); // => [1, 2, [3, [4]], 5] [1, [2, [3, [4]]], 5].flat(3); // => [1, 2, 3, 4, 5] [{ a: 1, b: 2 }, { a: 3, b: 4 }, { a: 5, b: 6 }].flatMap(it => [it.a, it.b]); // => [1, 2, 3, 4, 5, 6] [1, 2, 3].at(1); // => 2 [1, 2, 3].at(-1); // => 3 const sequence = [1, 2, 3]; sequence.toReversed(); // => [3, 2, 1] sequence; // => [1, 2, 3] const array = [1, 2, 3, 4]; array.toSpliced(1, 2, 5, 6, 7); // => [1, 5, 6, 7, 4] array; // => [1, 2, 3, 4] const outOfOrder = [3, 1, 2]; outOfOrder.toSorted(); // => [1, 2, 3] outOfOrder; // => [3, 1, 2] const correctionNeeded = [1, 1, 3]; correctionNeeded.with(1, 2); // => [1, 2, 3] correctionNeeded; // => [1, 1, 3] ``` #### ECMAScript: String and RegExp[⬆](#index) The main part of `String` features: modules [`es.string.from-code-point`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.from-code-point.js), [`es.string.raw`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.raw.js), [`es.string.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.iterator.js), [`es.string.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js), [`es.string.code-point-at`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.code-point-at.js), [`es.string.ends-with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.ends-with.js), [`es.string.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.includes.js), [`es.string.repeat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.repeat.js), [`es.string.pad-start`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.pad-start.js), [`es.string.pad-end`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.pad-end.js), [`es.string.starts-with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.starts-with.js), [`es.string.trim`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim.js), [`es.string.trim-start`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim-start.js), [`es.string.trim-end`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim-end.js), [`es.string.match-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.match-all.js), [`es.string.replace-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.replace-all.js), [`es.string.at-alternative`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.at-alternative.js), [`es.string.is-well-formed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.is-well-formed.js), [`es.string.to-well-formed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.to-well-formed.js). Adding support of well-known [symbols](#ecmascript-symbol) `@@match`, `@@replace`, `@@search` and `@@split` and direct `.exec` calls to related `String` methods, modules [`es.string.match`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.match.js), [`es.string.replace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.replace.js), [`es.string.search`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.search.js) and [`es.string.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js). Annex B methods. Modules [`es.string.anchor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.anchor.js), [`es.string.big`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.big.js), [`es.string.blink`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.blink.js), [`es.string.bold`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.bold.js), [`es.string.fixed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fixed.js), [`es.string.fontcolor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fontcolor.js), [`es.string.fontsize`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fontsize.js), [`es.string.italics`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.italics.js), [`es.string.link`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.link.js), [`es.string.small`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.small.js), [`es.string.strike`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.strike.js), [`es.string.sub`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.sub.js), [`es.string.sup`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.sup.js), [`es.string.substr`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.substr.js), [`es.escape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.escape.js) and [`es.unescape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.unescape.js). `RegExp` features: modules [`es.regexp.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.constructor.js), [`es.regexp.dot-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.dot-all.js), [`es.regexp.flags`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.flags.js), [`es.regexp.sticky`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.sticky.js) and [`es.regexp.test`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.test.js). ```js class String { static fromCodePoint(...codePoints: Array): string; static raw({ raw: Array }, ...substitutions: Array): string; at(index: int): string; includes(searchString: string, position?: number): boolean; startsWith(searchString: string, position?: number): boolean; endsWith(searchString: string, position?: number): boolean; repeat(count: number): string; padStart(length: number, fillStr?: string = ' '): string; padEnd(length: number, fillStr?: string = ' '): string; codePointAt(pos: number): number | void; match(template: any): any; // ES2015+ fix for support @@match matchAll(regexp: RegExp): Iterator; replace(template: any, replacer: any): any; // ES2015+ fix for support @@replace replaceAll(searchValue: string | RegExp, replaceString: string | (searchValue, index, this) => string): string; search(template: any): any; // ES2015+ fix for support @@search split(template: any, limit?: int): Array;; // ES2015+ fix for support @@split, some fixes for old engines trim(): string; trimLeft(): string; trimRight(): string; trimStart(): string; trimEnd(): string; isWellFormed(): boolean; toWellFormed(): string; anchor(name: string): string; big(): string; blink(): string; bold(): string; fixed(): string; fontcolor(color: string): string; fontsize(size: any): string; italics(): string; link(url: string): string; small(): string; strike(): string; sub(): string; substr(start: int, length?: int): string; sup(): string; @@iterator(): Iterator; } class RegExp { // support of sticky (`y`) flag, dotAll (`s`) flag, named capture groups, can alter flags constructor(pattern: RegExp | string, flags?: string): RegExp; exec(): Array | null; // IE8 fixes test(string: string): boolean; // delegation to `.exec` toString(): string; // ES2015+ fix - generic @@match(string: string): Array | null; @@matchAll(string: string): Iterator; @@replace(string: string, replaceValue: Function | string): string; @@search(string: string): number; @@split(string: string, limit: number): Array; readonly attribute dotAll: boolean; // IE9+ readonly attribute flags: string; // IE9+ readonly attribute sticky: boolean; // IE9+ } function escape(string: string): string; function unescape(string: string): string; ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/string core-js(-pure)/es|stable|actual|full/string/from-code-point core-js(-pure)/es|stable|actual|full/string/raw core-js/es|stable|actual|full/string/match core-js/es|stable|actual|full/string/replace core-js/es|stable|actual|full/string/search core-js/es|stable|actual|full/string/split core-js(-pure)/es|stable|actual/string(/virtual)/at core-js(-pure)/es|stable|actual|full/string(/virtual)/code-point-at core-js(-pure)/es|stable|actual|full/string(/virtual)/ends-with core-js(-pure)/es|stable|actual|full/string(/virtual)/includes core-js(-pure)/es|stable|actual|full/string(/virtual)/starts-with core-js(-pure)/es|stable|actual|full/string(/virtual)/match-all core-js(-pure)/es|stable|actual|full/string(/virtual)/pad-start core-js(-pure)/es|stable|actual|full/string(/virtual)/pad-end core-js(-pure)/es|stable|actual|full/string(/virtual)/repeat core-js(-pure)/es|stable|actual|full/string(/virtual)/replace-all core-js(-pure)/es|stable|actual|full/string(/virtual)/trim core-js(-pure)/es|stable|actual|full/string(/virtual)/trim-start core-js(-pure)/es|stable|actual|full/string(/virtual)/trim-end core-js(-pure)/es|stable|actual|full/string(/virtual)/trim-left core-js(-pure)/es|stable|actual|full/string(/virtual)/trim-right core-js(-pure)/es|stable|actual|full/string(/virtual)/is-well-formed core-js(-pure)/es|stable|actual|full/string(/virtual)/to-well-formed core-js(-pure)/es|stable|actual|full/string(/virtual)/anchor core-js(-pure)/es|stable|actual|full/string(/virtual)/big core-js(-pure)/es|stable|actual|full/string(/virtual)/blink core-js(-pure)/es|stable|actual|full/string(/virtual)/bold core-js(-pure)/es|stable|actual|full/string(/virtual)/fixed core-js(-pure)/es|stable|actual|full/string(/virtual)/fontcolor core-js(-pure)/es|stable|actual|full/string(/virtual)/fontsize core-js(-pure)/es|stable|actual|full/string(/virtual)/italics core-js(-pure)/es|stable|actual|full/string(/virtual)/link core-js(-pure)/es|stable|actual|full/string(/virtual)/small core-js(-pure)/es|stable|actual|full/string(/virtual)/strike core-js(-pure)/es|stable|actual|full/string(/virtual)/sub core-js(-pure)/es|stable|actual|full/string(/virtual)/substr core-js(-pure)/es|stable|actual|full/string(/virtual)/sup core-js(-pure)/es|stable|actual|full/string(/virtual)/iterator core-js/es|stable|actual|full/regexp core-js/es|stable|actual|full/regexp/constructor core-js/es|stable|actual|full/regexp/dot-all core-js(-pure)/es|stable|actual|full/regexp/flags core-js/es|stable|actual|full/regexp/sticky core-js/es|stable|actual|full/regexp/test core-js/es|stable|actual|full/regexp/to-string core-js/es|stable|actual|full/escape core-js/es|stable|actual|full/unescape ``` [*Examples*](https://tinyurl.com/22uafm3p): ```js for (let value of 'a𠮷b') { console.log(value); // => 'a', '𠮷', 'b' } 'foobarbaz'.includes('bar'); // => true 'foobarbaz'.includes('bar', 4); // => false 'foobarbaz'.startsWith('foo'); // => true 'foobarbaz'.startsWith('bar', 3); // => true 'foobarbaz'.endsWith('baz'); // => true 'foobarbaz'.endsWith('bar', 6); // => true 'string'.repeat(3); // => 'stringstringstring' 'hello'.padStart(10); // => ' hello' 'hello'.padStart(10, '1234'); // => '12341hello' 'hello'.padEnd(10); // => 'hello ' 'hello'.padEnd(10, '1234'); // => 'hello12341' '𠮷'.codePointAt(0); // => 134071 String.fromCodePoint(97, 134071, 98); // => 'a𠮷b' let name = 'Bob'; String.raw`Hi\n${name}!`; // => 'Hi\\nBob!' (ES2015 template string syntax) String.raw({ raw: 'test' }, 0, 1, 2); // => 't0e1s2t' 'foo'.bold(); // => 'foo' 'bar'.anchor('a"b'); // => 'bar' 'baz'.link('https://example.com'); // => 'baz' RegExp('.', 's').test('\n'); // => true RegExp('.', 's').dotAll; // => true RegExp('foo:(?\\w+),bar:(?\\w+)').exec('foo:abc,bar:def').groups.bar; // => 'def' 'foo:abc,bar:def'.replace(RegExp('foo:(?\\w+),bar:(?\\w+)'), '$,$'); // => 'def,abc' RegExp(/./g, 'm'); // => /./m /foo/.flags; // => '' /foo/gim.flags; // => 'gim' RegExp('foo', 'y').sticky; // => true const text = 'First line\nSecond line'; const regex = RegExp('(\\S+) line\\n?', 'y'); regex.exec(text)[1]; // => 'First' regex.exec(text)[1]; // => 'Second' regex.exec(text); // => null 'foo'.match({ [Symbol.match]: () => 1 }); // => 1 'foo'.replace({ [Symbol.replace]: () => 2 }); // => 2 'foo'.search({ [Symbol.search]: () => 3 }); // => 3 'foo'.split({ [Symbol.split]: () => 4 }); // => 4 RegExp.prototype.toString.call({ source: 'foo', flags: 'bar' }); // => '/foo/bar' ' hello '.trimLeft(); // => 'hello ' ' hello '.trimRight(); // => ' hello' ' hello '.trimStart(); // => 'hello ' ' hello '.trimEnd(); // => ' hello' for (let [_, d, D] of '1111a2b3cccc'.matchAll(/(\d)(\D)/g)) { console.log(d, D); // => 1 a, 2 b, 3 c } 'Test abc test test abc test.'.replaceAll('abc', 'foo'); // -> 'Test foo test test foo test.' 'abc'.at(1); // => 'b' 'abc'.at(-1); // => 'c' 'a💩b'.isWellFormed(); // => true 'a\uD83Db'.isWellFormed(); // => false 'a💩b'.toWellFormed(); // => 'a💩b' 'a\uD83Db'.toWellFormed(); // => 'a�b' ``` #### ECMAScript: Number[⬆](#index) Module [`es.number.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.constructor.js). `Number` constructor support binary and octal literals, [*example*](https://goo.gl/jRd6b3): ```js Number('0b1010101'); // => 85 Number('0o7654321'); // => 2054353 ``` Modules [`es.number.epsilon`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.epsilon.js), [`es.number.is-finite`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-finite.js), [`es.number.is-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-integer.js), [`es.number.is-nan`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-nan.js), [`es.number.is-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-safe-integer.js), [`es.number.max-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.max-safe-integer.js), [`es.number.min-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.min-safe-integer.js), [`es.number.parse-float`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.parse-float.js), [`es.number.parse-int`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.parse-int.js), [`es.number.to-exponential`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-exponential.js), [`es.number.to-fixed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-fixed.js), [`es.number.to-precision`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-precision.js), [`es.parse-int`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.parse-int.js), [`es.parse-float`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.parse-float.js). ```js class Number { constructor(value: any): number; toExponential(digits: number): string; toFixed(digits: number): string; toPrecision(precision: number): string; static isFinite(number: any): boolean; static isNaN(number: any): boolean; static isInteger(number: any): boolean; static isSafeInteger(number: any): boolean; static parseFloat(string: string): number; static parseInt(string: string, radix?: number = 10): number; static EPSILON: number; static MAX_SAFE_INTEGER: number; static MIN_SAFE_INTEGER: number; } function parseFloat(string: string): number; function parseInt(string: string, radix?: number = 10): number; ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/number core-js(-pure)/es|stable|actual|full/number/constructor core-js(-pure)/es|stable|actual|full/number/is-finite core-js(-pure)/es|stable|actual|full/number/is-nan core-js(-pure)/es|stable|actual|full/number/is-integer core-js(-pure)/es|stable|actual|full/number/is-safe-integer core-js(-pure)/es|stable|actual|full/number/parse-float core-js(-pure)/es|stable|actual|full/number/parse-int core-js(-pure)/es|stable|actual|full/number/epsilon core-js(-pure)/es|stable|actual|full/number/max-safe-integer core-js(-pure)/es|stable|actual|full/number/min-safe-integer core-js(-pure)/es|stable|actual|full/number(/virtual)/to-exponential core-js(-pure)/es|stable|actual|full/number(/virtual)/to-fixed core-js(-pure)/es|stable|actual|full/number(/virtual)/to-precision core-js(-pure)/es|stable|actual|full/parse-float core-js(-pure)/es|stable|actual|full/parse-int ``` #### ECMAScript: Math[⬆](#index) Modules [`es.math.acosh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.acosh.js), [`es.math.asinh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.asinh.js), [`es.math.atanh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.atanh.js), [`es.math.cbrt`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.cbrt.js), [`es.math.clz32`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.clz32.js), [`es.math.cosh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.cosh.js), [`es.math.expm1`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.expm1.js), [`es.math.fround`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.fround.js), [`es.math.hypot`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.hypot.js), [`es.math.imul`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.imul.js), [`es.math.log10`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.log10.js), [`es.math.log1p`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.log1p.js), [`es.math.log2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.log2.js), [`es.math.sign`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.sign.js), [`es.math.sinh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.sinh.js), [`es.math.tanh`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.tanh.js), [`es.math.trunc`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.trunc.js). ```js namespace Math { acosh(number: number): number; asinh(number: number): number; atanh(number: number): number; cbrt(number: number): number; clz32(number: number): number; cosh(number: number): number; expm1(number: number): number; fround(number: number): number; hypot(...args: Array): number; imul(number1: number, number2: number): number; log1p(number: number): number; log10(number: number): number; log2(number: number): number; sign(number: number): 1 | -1 | 0 | -0 | NaN; sinh(number: number): number; tanh(number: number): number; trunc(number: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/math core-js(-pure)/es|stable|actual|full/math/acosh core-js(-pure)/es|stable|actual|full/math/asinh core-js(-pure)/es|stable|actual|full/math/atanh core-js(-pure)/es|stable|actual|full/math/cbrt core-js(-pure)/es|stable|actual|full/math/clz32 core-js(-pure)/es|stable|actual|full/math/cosh core-js(-pure)/es|stable|actual|full/math/expm1 core-js(-pure)/es|stable|actual|full/math/fround core-js(-pure)/es|stable|actual|full/math/hypot core-js(-pure)/es|stable|actual|full/math/imul core-js(-pure)/es|stable|actual|full/math/log1p core-js(-pure)/es|stable|actual|full/math/log10 core-js(-pure)/es|stable|actual|full/math/log2 core-js(-pure)/es|stable|actual|full/math/sign core-js(-pure)/es|stable|actual|full/math/sinh core-js(-pure)/es|stable|actual|full/math/tanh core-js(-pure)/es|stable|actual|full/math/trunc ``` #### ECMAScript: Date[⬆](#index) Modules [`es.date.to-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-string.js), ES5 features with fixes: [`es.date.now`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.now.js), [`es.date.to-iso-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-iso-string.js), [`es.date.to-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-json.js) and [`es.date.to-primitive`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-primitive.js). Annex B methods. Modules [`es.date.get-year`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.get-year.js), [`es.date.set-year`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.set-year.js) and [`es.date.to-gmt-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-gmt-string.js). ```js class Date { getYear(): int; setYear(year: int): number; toGMTString(): string; toISOString(): string; toJSON(): string; toString(): string; @@toPrimitive(hint: 'default' | 'number' | 'string'): string | number; static now(): number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|actual|full/date core-js/es|stable|actual|full/date/to-string core-js(-pure)/es|stable|actual|full/date/now core-js(-pure)/es|stable|actual|full/date/get-year core-js(-pure)/es|stable|actual|full/date/set-year core-js(-pure)/es|stable|actual|full/date/to-gmt-string core-js(-pure)/es|stable|actual|full/date/to-iso-string core-js(-pure)/es|stable|actual|full/date/to-json core-js(-pure)/es|stable|actual|full/date/to-primitive ``` [*Example*](https://goo.gl/haeHLR): ```js new Date(NaN).toString(); // => 'Invalid Date' ``` #### ECMAScript: Promise[⬆](#index) Modules [`es.promise`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.js), [`es.promise.all-settled`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.all-settled.js), [`es.promise.any`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.any.js) and [`es.promise.finally`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.finally.js). ```js class Promise { constructor(executor: (resolve: Function, reject: Function) => void): Promise; then(onFulfilled: Function, onRejected: Function): Promise; catch(onRejected: Function): Promise; finally(onFinally: Function): Promise; static resolve(x: any): Promise; static reject(r: any): Promise; static all(iterable: Iterable): Promise; static allSettled(iterable: Iterable): Promise; static any(promises: Iterable): Promise; static race(iterable: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/promise core-js(-pure)/es|stable|actual|full/promise/all-settled core-js(-pure)/es|stable|actual|full/promise/any core-js(-pure)/es|stable|actual|full/promise/finally ``` Basic [*example*](https://goo.gl/vGrtUC): ```js function sleepRandom(time) { return new Promise((resolve, reject) => { setTimeout(resolve, time * 1e3, 0 | Math.random() * 1e3); }); } console.log('Run'); // => Run sleepRandom(5).then(result => { console.log(result); // => 869, after 5 sec. return sleepRandom(10); }).then(result => { console.log(result); // => 202, after 10 sec. }).then(() => { console.log('immediately after'); // => immediately after throw Error('Irror!'); }).then(() => { console.log('will not be displayed'); }).catch(x => console.log(x)); // => => Error: Irror! ``` `Promise.resolve` and `Promise.reject` [*example*](https://goo.gl/vr8TN3): ```js Promise.resolve(42).then(x => console.log(x)); // => 42 Promise.reject(42).catch(x => console.log(x)); // => 42 Promise.resolve($.getJSON('/data.json')); // => ES promise ``` `Promise#finally` [*example*](https://goo.gl/AhyBbJ): ```js Promise.resolve(42).finally(() => console.log('You will see it anyway')); Promise.reject(42).finally(() => console.log('You will see it anyway')); ``` `Promise.all` [*example*](https://goo.gl/RdoDBZ): ```js Promise.all([ 'foo', sleepRandom(5), sleepRandom(15), sleepRandom(10) // after 15 sec: ]).then(x => console.log(x)); // => ['foo', 956, 85, 382] ``` `Promise.race` [*example*](https://goo.gl/L8ovkJ): ```js function timeLimit(promise, time) { return Promise.race([promise, new Promise((resolve, reject) => { setTimeout(reject, time * 1e3, Error('Await > ' + time + ' sec')); })]); } timeLimit(sleepRandom(5), 10).then(x => console.log(x)); // => 853, after 5 sec. timeLimit(sleepRandom(15), 10).catch(x => console.log(x)); // Error: Await > 10 sec ``` `Promise.allSettled` [*example*](https://goo.gl/PXXLNJ): ```js Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(console.log); // => [{ value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }] ``` `Promise.any` [*example*](https://goo.gl/iErvmp): ```js Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(console.log); // => 1 Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).catch(({ errors }) => console.log(errors)); // => [1, 2, 3] ``` [Example](https://goo.gl/wnQS4j) with async functions: ```js let delay = time => new Promise(resolve => setTimeout(resolve, time)) async function sleepRandom(time) { await delay(time * 1e3); return 0 | Math.random() * 1e3; } async function sleepError(time, msg) { await delay(time * 1e3); throw Error(msg); } (async () => { try { console.log('Run'); // => Run console.log(await sleepRandom(5)); // => 936, after 5 sec. let [a, b, c] = await Promise.all([ sleepRandom(5), sleepRandom(15), sleepRandom(10) ]); console.log(a, b, c); // => 210 445 71, after 15 sec. await sleepError(5, 'Error!'); console.log('Will not be displayed'); } catch (e) { console.log(e); // => Error: 'Error!', after 5 sec. } })(); ``` ##### Unhandled rejection tracking[⬆](#index) In Node.js, like in native implementation, available events [`unhandledRejection`](https://nodejs.org/api/process.html#process_event_unhandledrejection) and [`rejectionHandled`](https://nodejs.org/api/process.html#process_event_rejectionhandled): ```js process.on('unhandledRejection', (reason, promise) => console.log('unhandled', reason, promise)); process.on('rejectionHandled', (promise) => console.log('handled', promise)); let promise = Promise.reject(42); // unhandled 42 [object Promise] setTimeout(() => promise.catch(() => {}), 1e3); // handled [object Promise] ``` In a browser on rejection, by default, you will see notify in the console, or you can add a custom handler and a handler on handling unhandled, [*example*](https://goo.gl/Wozskl): ```js window.addEventListener('unhandledrejection', e => console.log('unhandled', e.reason, e.promise)); window.addEventListener('rejectionhandled', e => console.log('handled', e.reason, e.promise)); // or window.onunhandledrejection = e => console.log('unhandled', e.reason, e.promise); window.onrejectionhandled = e => console.log('handled', e.reason, e.promise); let promise = Promise.reject(42); // => unhandled 42 [object Promise] setTimeout(() => promise.catch(() => {}), 1e3); // => handled 42 [object Promise] ``` #### ECMAScript: Symbol[⬆](#index) Modules [`es.symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.js), [`es.symbol.async-iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.async-iterator.js), [`es.symbol.description`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.description.js), [`es.symbol.has-instance`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.has-instance.js), [`es.symbol.is-concat-spreadable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.is-concat-spreadable.js), [`es.symbol.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.iterator.js), [`es.symbol.match`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.match.js), [`es.symbol.replace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.replace.js), [`es.symbol.search`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.search.js), [`es.symbol.species`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.species.js), [`es.symbol.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.split.js), [`es.symbol.to-primitive`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.to-primitive.js), [`es.symbol.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.to-string-tag.js), [`es.symbol.unscopables`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.unscopables.js), [`es.math.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.to-string-tag.js). ```js class Symbol { constructor(description?): symbol; readonly attribute description: string | void; static asyncIterator: @@asyncIterator; static hasInstance: @@hasInstance; static isConcatSpreadable: @@isConcatSpreadable; static iterator: @@iterator; static match: @@match; static replace: @@replace; static search: @@search; static species: @@species; static split: @@split; static toPrimitive: @@toPrimitive; static toStringTag: @@toStringTag; static unscopables: @@unscopables; static for(key: string): symbol; static keyFor(sym: symbol): string; static useSimple(): void; static useSetter(): void; } class Object { static getOwnPropertySymbols(object: any): Array; } ``` Also wrapped some methods for correct work with `Symbol` polyfill. ```js class Object { static create(prototype: Object | null, properties?: { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor })): Object; static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object; static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void; static getOwnPropertyNames(object: any): Array; propertyIsEnumerable(key: PropertyKey): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/symbol core-js(-pure)/es|stable|actual|full/symbol/async-iterator core-js/es|stable|actual|full/symbol/description core-js(-pure)/es|stable|actual|full/symbol/has-instance core-js(-pure)/es|stable|actual|full/symbol/is-concat-spreadable core-js(-pure)/es|stable|actual|full/symbol/iterator core-js(-pure)/es|stable|actual|full/symbol/match core-js(-pure)/es|stable|actual|full/symbol/replace core-js(-pure)/es|stable|actual|full/symbol/search core-js(-pure)/es|stable|actual|full/symbol/species core-js(-pure)/es|stable|actual|full/symbol/split core-js(-pure)/es|stable|actual|full/symbol/to-primitive core-js(-pure)/es|stable|actual|full/symbol/to-string-tag core-js(-pure)/es|stable|actual|full/symbol/unscopables core-js(-pure)/es|stable|actual|full/symbol/for core-js(-pure)/es|stable|actual|full/symbol/key-for core-js(-pure)/es|stable|actual|full/object/get-own-property-symbols core-js(-pure)/es|stable|actual|full/math/to-string-tag ``` [*Basic example*](https://goo.gl/BbvWFc): ```js let Person = (() => { let NAME = Symbol('name'); return class { constructor(name) { this[NAME] = name; } getName() { return this[NAME]; } } })(); let person = new Person('Vasya'); console.log(person.getName()); // => 'Vasya' console.log(person['name']); // => undefined console.log(person[Symbol('name')]); // => undefined, symbols are uniq for (let key in person) console.log(key); // => nothing, symbols are not enumerable ``` `Symbol.for` & `Symbol.keyFor` [*example*](https://goo.gl/0pdJjX): ```js let symbol = Symbol.for('key'); symbol === Symbol.for('key'); // true Symbol.keyFor(symbol); // 'key' ``` [*Example*](https://goo.gl/mKVOQJ) with methods for getting own object keys: ```js let object = { a: 1 }; Object.defineProperty(object, 'b', { value: 2 }); object[Symbol('c')] = 3; Object.keys(object); // => ['a'] Object.getOwnPropertyNames(object); // => ['a', 'b'] Object.getOwnPropertySymbols(object); // => [Symbol(c)] Reflect.ownKeys(object); // => ['a', 'b', Symbol(c)] ``` [*Symbol#description getter*](https://goo.gl/MWizfc): ```js Symbol('foo').description; // => 'foo' Symbol().description; // => undefined ``` ##### Caveats when using `Symbol` polyfill:[⬆](#index) * We can't add new primitive type, `Symbol` returns object. * `Symbol.for` and `Symbol.keyFor` can't be polyfilled cross-realm. * By default, to hide the keys, `Symbol` polyfill defines setter in `Object.prototype`. For this reason, uncontrolled creation of symbols can cause memory leak and the `in` operator is not working correctly with `Symbol` polyfill: `Symbol() in {} // => true`. You can disable defining setters in `Object.prototype`. [Example](https://goo.gl/N5UD7J): ```js Symbol.useSimple(); let symbol1 = Symbol('symbol1'); let object1 = {}; object1[symbol1] = true; for (let key in object1) console.log(key); // => 'Symbol(symbol1)_t.qamkg9f3q', w/o native Symbol Symbol.useSetter(); let symbol2 = Symbol('symbol2'); let object2 = {}; object2[symbol2] = true; for (let key in object2) console.log(key); // nothing ``` * Currently, `core-js` not adds setters to `Object.prototype` for well-known symbols for correct work something like `Symbol.iterator in foo`. It can cause problems with their enumerability. * Some problems possible with environment exotic objects (for example, IE `localStorage`). #### ECMAScript: Collections[⬆](#index) `core-js` uses native collections in most case, just fixes methods / constructor, if it's required, and in old environment uses fast polyfill (O(1) lookup). #### Map[⬆](#index) Module [`es.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.map.js). ```js class Map { constructor(iterable?: Iterable<[key, value]>): Map; clear(): void; delete(key: any): boolean; forEach(callbackfn: (value: any, key: any, target: any) => void, thisArg: any): void; get(key: any): any; has(key: any): boolean; set(key: any, val: any): this; values(): Iterator; keys(): Iterator; entries(): Iterator<[key, value]>; @@iterator(): Iterator<[key, value]>; readonly attribute size: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/map ``` [*Examples*](https://goo.gl/GWR7NI): ```js let array = [1]; let map = new Map([['a', 1], [42, 2]]); map.set(array, 3).set(true, 4); console.log(map.size); // => 4 console.log(map.has(array)); // => true console.log(map.has([1])); // => false console.log(map.get(array)); // => 3 map.forEach((val, key) => { console.log(val); // => 1, 2, 3, 4 console.log(key); // => 'a', 42, [1], true }); map.delete(array); console.log(map.size); // => 3 console.log(map.get(array)); // => undefined console.log(Array.from(map)); // => [['a', 1], [42, 2], [true, 4]] let map = new Map([['a', 1], ['b', 2], ['c', 3]]); for (let [key, value] of map) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } for (let value of map.values()) console.log(value); // => 1, 2, 3 for (let key of map.keys()) console.log(key); // => 'a', 'b', 'c' for (let [key, value] of map.entries()) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } ``` #### Set[⬆](#index) Module [`es.set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.js). ```js class Set { constructor(iterable?: Iterable): Set; add(key: any): this; clear(): void; delete(key: any): boolean; forEach((value: any, key: any, target: any) => void, thisArg: any): void; has(key: any): boolean; values(): Iterator; keys(): Iterator; entries(): Iterator<[value, value]>; @@iterator(): Iterator; readonly attribute size: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/set ``` [*Examples*](https://goo.gl/bmhLwg): ```js let set = new Set(['a', 'b', 'a', 'c']); set.add('d').add('b').add('e'); console.log(set.size); // => 5 console.log(set.has('b')); // => true set.forEach(it => { console.log(it); // => 'a', 'b', 'c', 'd', 'e' }); set.delete('b'); console.log(set.size); // => 4 console.log(set.has('b')); // => false console.log(Array.from(set)); // => ['a', 'c', 'd', 'e'] let set = new Set([1, 2, 3, 2, 1]); for (let value of set) console.log(value); // => 1, 2, 3 for (let value of set.values()) console.log(value); // => 1, 2, 3 for (let key of set.keys()) console.log(key); // => 1, 2, 3 for (let [key, value] of set.entries()) { console.log(key); // => 1, 2, 3 console.log(value); // => 1, 2, 3 } ``` #### WeakMap[⬆](#index) Module [`es.weak-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.weak-map.js). ```js class WeakMap { constructor(iterable?: Iterable<[key, value]>): WeakMap; delete(key: Object): boolean; get(key: Object): any; has(key: Object): boolean; set(key: Object, val: any): this; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/weak-map ``` [*Examples*](https://goo.gl/SILXyw): ```js let a = [1]; let b = [2]; let c = [3]; let weakmap = new WeakMap([[a, 1], [b, 2]]); weakmap.set(c, 3).set(b, 4); console.log(weakmap.has(a)); // => true console.log(weakmap.has([1])); // => false console.log(weakmap.get(a)); // => 1 weakmap.delete(a); console.log(weakmap.get(a)); // => undefined // Private properties store: let Person = (() => { let names = new WeakMap; return class { constructor(name) { names.set(this, name); } getName() { return names.get(this); } } })(); let person = new Person('Vasya'); console.log(person.getName()); // => 'Vasya' for (let key in person) console.log(key); // => only 'getName' ``` #### WeakSet[⬆](#index) Module [`es.weak-set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.weak-set.js). ```js class WeakSet { constructor(iterable?: Iterable): WeakSet; add(key: Object): this; delete(key: Object): boolean; has(key: Object): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/weak-set ``` [*Examples*](https://goo.gl/TdFbEx): ```js let a = [1]; let b = [2]; let c = [3]; let weakset = new WeakSet([a, b, a]); weakset.add(c).add(b).add(c); console.log(weakset.has(b)); // => true console.log(weakset.has([2])); // => false weakset.delete(b); console.log(weakset.has(b)); // => false ``` ##### Caveats when using collections polyfill:[⬆](#index) * Weak-collections polyfill stores values as hidden properties of keys. It works correct and not leak in most cases. However, it is desirable to store a collection longer than its keys. * Native symbols as `WeakMap` keys can't be properly polyfilled without memory leaks. #### ECMAScript: Typed Arrays[⬆](#index) Implementations and fixes for `ArrayBuffer`, `DataView`, Typed Arrays constructors, static and prototype methods. Typed arrays work only in environments with support descriptors (IE9+), `ArrayBuffer` and `DataView` should work anywhere. Modules [`es.array-buffer.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.constructor.js), [`es.array-buffer.is-view`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.is-view.js), [`es.array-buffer.slice`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.slice.js), [`es.data-view`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.data-view.js), [`es.typed-array.int8-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int8-array.js), [`es.typed-array.uint8-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint8-array.js), [`es.typed-array.uint8-clamped-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint8-clamped-array.js), [`es.typed-array.int16-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int16-array.js), [`es.typed-array.uint16-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint16-array.js), [`es.typed-array.int32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int32-array.js), [`es.typed-array.uint32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint32-array.js), [`es.typed-array.float32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.float32-array.js), [`es.typed-array.float64-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.float64-array.js), [`es.typed-array.copy-within`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.copy-within.js), [`es.typed-array.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.every.js), [`es.typed-array.fill`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.fill.js), [`es.typed-array.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.filter.js), [`es.typed-array.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find.js), [`es.typed-array.find-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-index.js), [`es.typed-array.find-last`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-last.js), [`es.typed-array.find-last-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-last-index.js), [`es.typed-array.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.for-each.js), [`es.typed-array.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.from.js), [`es.typed-array.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.includes.js), [`es.typed-array.index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.index-of.js), [`es.typed-array.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.iterator.js), [`es.typed-array.last-index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.last-index-of.js), [`es.typed-array.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.map.js), [`es.typed-array.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.of.js), [`es.typed-array.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.reduce.js), [`es.typed-array.reduce-right`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.reduce-right.js), [`es.typed-array.reverse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.reverse.js), [`es.typed-array.set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.set.js), [`es.typed-array.slice`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.slice.js), [`es.typed-array.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.some.js), [`es.typed-array.sort`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.sort.js), [`es.typed-array.subarray`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.subarray.js), [`es.typed-array.to-locale-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.to-locale-string.js), [`es.typed-array.to-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.to-string.js), [`es.typed-array.at`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.at.js), [`es.typed-array.to-reversed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.to-reversed.js), [`es.typed-array.to-sorted`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.to-sorted.js), [`es.typed-array.with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.with.js). ```js class ArrayBuffer { constructor(length: any): ArrayBuffer; slice(start: any, end: any): ArrayBuffer; readonly attribute byteLength: number; static isView(arg: any): boolean; } class DataView { constructor(buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; getInt8(offset: any): int8; getUint8(offset: any): uint8 getInt16(offset: any, littleEndian?: boolean = false): int16; getUint16(offset: any, littleEndian?: boolean = false): uint16; getInt32(offset: any, littleEndian?: boolean = false): int32; getUint32(offset: any, littleEndian?: boolean = false): uint32; getFloat32(offset: any, littleEndian?: boolean = false): float32; getFloat64(offset: any, littleEndian?: boolean = false): float64; setInt8(offset: any, value: any): void; setUint8(offset: any, value: any): void; setInt16(offset: any, value: any, littleEndian?: boolean = false): void; setUint16(offset: any, value: any, littleEndian?: boolean = false): void; setInt32(offset: any, value: any, littleEndian?: boolean = false): void; setUint32(offset: any, value: any, littleEndian?: boolean = false): void; setFloat32(offset: any, value: any, littleEndian?: boolean = false): void; setFloat64(offset: any, value: any, littleEndian?: boolean = false): void; readonly attribute buffer: ArrayBuffer; readonly attribute byteLength: number; readonly attribute byteOffset: number; } class [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ] extends %TypedArray% { constructor(length: number): %TypedArray%; constructor(object: %TypedArray% | Iterable | ArrayLike): %TypedArray%; constructor(buffer: ArrayBuffer, byteOffset?: number, length?: number): %TypedArray% } class %TypedArray% { at(index: int): number; copyWithin(target: number, start: number, end?: number): this; entries(): Iterator<[index, value]>; every(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): boolean; fill(value: number, start?: number, end?: number): this; filter(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): %TypedArray%; find(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean), thisArg?: any): any; findIndex(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint; findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any; findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint; forEach(callbackfn: (value: number, index: number, target: %TypedArray%) => void, thisArg?: any): void; includes(searchElement: any, from?: number): boolean; indexOf(searchElement: any, from?: number): number; join(separator: string = ','): string; keys(): Iterator; lastIndexOf(searchElement: any, from?: number): number; map(mapFn: (value: number, index: number, target: %TypedArray%) => number, thisArg?: any): %TypedArray%; reduce(callbackfn: (memo: any, value: number, index: number, target: %TypedArray%) => any, initialValue?: any): any; reduceRight(callbackfn: (memo: any, value: number, index: number, target: %TypedArray%) => any, initialValue?: any): any; reverse(): this; set(array: ArrayLike, offset?: number): void; slice(start?: number, end?: number): %TypedArray%; some(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): boolean; sort(comparefn?: (a: number, b: number) => number): this; // with modern behavior like stable sort subarray(begin?: number, end?: number): %TypedArray%; toReversed(): %TypedArray%; toSorted(comparefn?: (a: any, b: any) => number): %TypedArray%; toString(): string; toLocaleString(): string; values(): Iterator; with(index: includes, value: any): %TypedArray%; @@iterator(): Iterator; readonly attribute buffer: ArrayBuffer; readonly attribute byteLength: number; readonly attribute byteOffset: number; readonly attribute length: number; BYTES_PER_ELEMENT: number; static from(items: Iterable | ArrayLike, mapFn?: (value: any, index: number) => any, thisArg?: any): %TypedArray%; static of(...args: Array): %TypedArray%; static BYTES_PER_ELEMENT: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|actual|full/array-buffer core-js/es|stable|actual|full/array-buffer/constructor core-js/es|stable|actual|full/array-buffer/is-view core-js/es|stable|actual|full/array-buffer/slice core-js/es|stable|actual|full/data-view core-js/es|stable|actual|full/typed-array core-js/es|stable|actual|full/typed-array/int8-array core-js/es|stable|actual|full/typed-array/uint8-array core-js/es|stable|actual|full/typed-array/uint8-clamped-array core-js/es|stable|actual|full/typed-array/int16-array core-js/es|stable|actual|full/typed-array/uint16-array core-js/es|stable|actual|full/typed-array/int32-array core-js/es|stable|actual|full/typed-array/uint32-array core-js/es|stable|actual|full/typed-array/float32-array core-js/es|stable|actual|full/typed-array/float64-array core-js/es|stable|actual|full/typed-array/at core-js/es|stable|actual|full/typed-array/copy-within core-js/es|stable|actual|full/typed-array/entries core-js/es|stable|actual|full/typed-array/every core-js/es|stable|actual|full/typed-array/fill core-js/es|stable|actual|full/typed-array/filter core-js/es|stable|actual|full/typed-array/find core-js/es|stable|actual|full/typed-array/find-index core-js/es|stable|actual|full/typed-array/find-last core-js/es|stable|actual|full/typed-array/find-last-index core-js/es|stable|actual|full/typed-array/for-each core-js/es|stable|actual|full/typed-array/from core-js/es|stable|actual|full/typed-array/includes core-js/es|stable|actual|full/typed-array/index-of core-js/es|stable|actual|full/typed-array/iterator core-js/es|stable|actual|full/typed-array/join core-js/es|stable|actual|full/typed-array/keys core-js/es|stable|actual|full/typed-array/last-index-of core-js/es|stable|actual|full/typed-array/map core-js/es|stable|actual|full/typed-array/of core-js/es|stable|actual|full/typed-array/reduce core-js/es|stable|actual|full/typed-array/reduce-right core-js/es|stable|actual|full/typed-array/reverse core-js/es|stable|actual|full/typed-array/set core-js/es|stable|actual|full/typed-array/slice core-js/es|stable|actual|full/typed-array/some core-js/es|stable|actual|full/typed-array/sort core-js/es|stable|actual|full/typed-array/subarray core-js/es|stable|actual|full/typed-array/to-locale-string core-js/es|stable|actual|full/typed-array/to-reversed core-js/es|stable|actual|full/typed-array/to-sorted core-js/es|stable|actual|full/typed-array/to-string core-js/es|stable|actual|full/typed-array/values core-js/es|stable|actual|full/typed-array/with ``` [*Examples*](https://is.gd/Eo7ltU): ```js new Int32Array(4); // => [0, 0, 0, 0] new Uint8ClampedArray([1, 2, 3, 666]); // => [1, 2, 3, 255] new Float32Array(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] let buffer = new ArrayBuffer(8); let view = new DataView(buffer); view.setFloat64(0, 123.456, true); new Uint8Array(buffer.slice(4)); // => [47, 221, 94, 64] Int8Array.of(1, 1.5, 5.7, 745); // => [1, 1, 5, -23] Uint8Array.from([1, 1.5, 5.7, 745]); // => [1, 1, 5, 233] let typed = new Uint8Array([1, 2, 3]); let a = typed.slice(1); // => [2, 3] typed.buffer === a.buffer; // => false let b = typed.subarray(1); // => [2, 3] typed.buffer === b.buffer; // => true typed.filter(it => it % 2); // => [1, 3] typed.map(it => it * 1.5); // => [1, 3, 4] for (let value of typed) console.log(value); // => 1, 2, 3 for (let value of typed.values()) console.log(value); // => 1, 2, 3 for (let key of typed.keys()) console.log(key); // => 0, 1, 2 for (let [key, value] of typed.entries()) { console.log(key); // => 0, 1, 2 console.log(value); // => 1, 2, 3 } new Int32Array([1, 2, 3]).at(1); // => 2 new Int32Array([1, 2, 3]).at(-1); // => 3 ``` ##### Caveats when using typed arrays polyfills:[⬆](#index) * Polyfills of Typed Arrays constructors work completely how should work by the spec, but because of internal usage of getters / setters on each instance, are slow and consumes significant memory. However, polyfills of Typed Arrays constructors required mainly for old IE, all modern engines have native Typed Arrays constructors and require only fixes of constructors and polyfills of methods. #### ECMAScript: Reflect[⬆](#index) Modules [`es.reflect.apply`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.apply.js), [`es.reflect.construct`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.construct.js), [`es.reflect.define-property`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.define-property.js), [`es.reflect.delete-property`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.delete-property.js), [`es.reflect.get`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get.js), [`es.reflect.get-own-property-descriptor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get-own-property-descriptor.js), [`es.reflect.get-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get-prototype-of.js), [`es.reflect.has`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.has.js), [`es.reflect.is-extensible`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.is-extensible.js), [`es.reflect.own-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.own-keys.js), [`es.reflect.prevent-extensions`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.prevent-extensions.js), [`es.reflect.set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.set.js), [`es.reflect.set-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.set-prototype-of.js). ```js namespace Reflect { apply(target: Function, thisArgument: any, argumentsList: Array): any; construct(target: Function, argumentsList: Array, newTarget?: Function): Object; defineProperty(target: Object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; deleteProperty(target: Object, propertyKey: PropertyKey): boolean; get(target: Object, propertyKey: PropertyKey, receiver?: any): any; getOwnPropertyDescriptor(target: Object, propertyKey: PropertyKey): PropertyDescriptor | void; getPrototypeOf(target: Object): Object | null; has(target: Object, propertyKey: PropertyKey): boolean; isExtensible(target: Object): boolean; ownKeys(target: Object): Array; preventExtensions(target: Object): boolean; set(target: Object, propertyKey: PropertyKey, V: any, receiver?: any): boolean; setPrototypeOf(target: Object, proto: Object | null): boolean; // required __proto__ - IE11+ } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|actual|full/reflect core-js(-pure)/es|stable|actual|full/reflect/apply core-js(-pure)/es|stable|actual|full/reflect/construct core-js(-pure)/es|stable|actual|full/reflect/define-property core-js(-pure)/es|stable|actual|full/reflect/delete-property core-js(-pure)/es|stable|actual|full/reflect/get core-js(-pure)/es|stable|actual|full/reflect/get-own-property-descriptor core-js(-pure)/es|stable|actual|full/reflect/get-prototype-of core-js(-pure)/es|stable|actual|full/reflect/has core-js(-pure)/es|stable|actual|full/reflect/is-extensible core-js(-pure)/es|stable|actual|full/reflect/own-keys core-js(-pure)/es|stable|actual|full/reflect/prevent-extensions core-js(-pure)/es|stable|actual|full/reflect/set core-js(-pure)/es|stable|actual|full/reflect/set-prototype-of ``` [*Examples*](https://goo.gl/gVT0cH): ```js let object = { a: 1 }; Object.defineProperty(object, 'b', { value: 2 }); object[Symbol('c')] = 3; Reflect.ownKeys(object); // => ['a', 'b', Symbol(c)] function C(a, b) { this.c = a + b; } let instance = Reflect.construct(C, [20, 22]); instance.c; // => 42 ``` #### ECMAScript: JSON[⬆](#index) Since `JSON` object is missed only in very old engines like IE7-, `core-js` does not provide a full `JSON` polyfill, however, fix already existing implementations by the current standard, for example, [well-formed `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify). `JSON` also fixed in other modules - for example, `Symbol` polyfill fixes `JSON.stringify` for correct work with symbols. Module [`es.json.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.json.to-string-tag.js) and [`es.json.stringify`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.json.stringify.js). ```js namespace JSON { stringify(value: any, replacer?: Array | (this: any, key: string, value: any) => any, space?: string | number): string | void; @@toStringTag: 'JSON'; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/es|stable|actual|full/json/stringify core-js(-pure)/es|stable|actual|full/json/to-string-tag ``` [*Examples*](https://is.gd/izZqKn): ```js JSON.stringify({ '𠮷': ['\uDF06\uD834'] }); // => '{"𠮷":["\\udf06\\ud834"]}' ``` #### ECMAScript: globalThis[⬆](#index) Module [`es.global-this`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.global-this.js). ```js let globalThis: GlobalThisValue; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/es|stable|actual|full/global-this ``` [*Examples*](https://goo.gl/LAifsc): ```js globalThis.Array === Array; // => true ``` ### ECMAScript proposals[⬆](#index) [The TC39 process.](https://tc39.github.io/process-document/) #### Finished proposals[⬆](#index) Finished (stage 4) proposals already marked in `core-js` as stable ECMAScript, they are available in `core-js/stable` and `core-js/es` namespace, you can find then in related sections of this doc. However, even for finished proposals, `core-js` provide a way to include only features for a specific proposal like `core-js/proposals/proposal-name`. ##### [`globalThis`](https://github.com/tc39/proposal-global)[⬆](#index) ```js let globalThis: Object; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/global-this ``` ##### [Relative indexing method](https://github.com/tc39/proposal-relative-indexing-method)[⬆](#index) ```js class Array { at(index: int): any; } class String { at(index: int): string; } class %TypedArray% { at(index: int): number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/relative-indexing-method ``` ##### [`Array.prototype.includes`](https://github.com/tc39/proposal-Array.prototype.includes)[⬆](#index) ```js class Array { includes(searchElement: any, from?: number): boolean; } class %TypedArray% { includes(searchElement: any, from?: number): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-includes ``` ##### [`Array.prototype.flat` / `Array.prototype.flatMap`](https://github.com/tc39/proposal-flatMap)[⬆](#index) ```js class Array { flat(depthArg?: number = 1): Array; flatMap(mapFn: (value: any, index: number, target: any) => any, thisArg: any): Array; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-flat-map ``` ##### [Array find from last](https://github.com/tc39/proposal-array-find-from-last)[⬆](#index) ```js class Array { findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any; findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint; } class %TypedArray% { findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any; findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-find-from-last ``` ##### [Change `Array` by copy](https://github.com/tc39/proposal-change-array-by-copy)[⬆](#index) ```js class Array { toReversed(): Array; toSpliced(start?: number, deleteCount?: number, ...items: Array): Array; toSorted(comparefn?: (a: any, b: any) => number): Array; with(index: includes, value: any): Array; } class %TypedArray% { toReversed(): %TypedArray%; toSorted(comparefn?: (a: any, b: any) => number): %TypedArray%; with(index: includes, value: any): %TypedArray%; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/change-array-by-copy-stage-4 core-js(-pure)/es|stable|actual|full/array(/virtual)/to-reversed core-js(-pure)/es|stable|actual|full/array(/virtual)/to-sorted core-js(-pure)/es|stable|actual|full/array(/virtual)/to-spliced core-js(-pure)/es|stable|actual|full/array(/virtual)/with core-js/es|stable|actual|full/typed-array/to-reversed core-js/es|stable|actual|full/typed-array/to-sorted core-js/es|stable|actual|full/typed-array/with ``` ##### [`Object.values` / `Object.entries`](https://github.com/tc39/proposal-object-values-entries)[⬆](#index) ```js class Object { static entries(object: Object): Array<[string, mixed]>; static values(object: any): Array; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/object-values-entries ``` ##### [`Object.fromEntries`](https://github.com/tc39/proposal-object-from-entries)[⬆](#index) ```js class Object { static fromEntries(iterable: Iterable<[key, value]>): Object; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/object-from-entries ``` ##### [`Object.getOwnPropertyDescriptors`](https://github.com/tc39/proposal-object-getownpropertydescriptors)[⬆](#index) ```js class Object { static getOwnPropertyDescriptors(object: any): { [property: PropertyKey]: PropertyDescriptor }; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/object-getownpropertydescriptors ``` ##### [Accessible `Object.prototype.hasOwnProperty`](https://github.com/tc39/proposal-accessible-object-hasownproperty)[⬆](#index) ```js class Object { static hasOwn(object: object, key: PropertyKey): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/accessible-object-hasownproperty ``` ##### [`String` padding](https://github.com/tc39/proposal-string-pad-start-end)[⬆](#index) ```js class String { padStart(length: number, fillStr?: string = ' '): string; padEnd(length: number, fillStr?: string = ' '): string; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/string-padding ``` ##### [`String#matchAll`](https://github.com/tc39/proposal-string-matchall)[⬆](#index). ```js class String { matchAll(regexp: RegExp): Iterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-match-all ``` ##### [`String#replaceAll`](https://github.com/tc39/proposal-string-replace-all)[⬆](#index) ```js class String { replaceAll(searchValue: string | RegExp, replaceString: string | (searchValue, index, this) => string): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-replace-all-stage-4 ``` ##### [`String.prototype.trimStart` / `String.prototype.trimEnd`](https://github.com/tc39/proposal-string-left-right-trim)[⬆](#index) ```js class String { trimLeft(): string; trimRight(): string; trimStart(): string; trimEnd(): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-left-right-trim ``` ##### [`RegExp` `s` (`dotAll`) flag](https://github.com/tc39/proposal-regexp-dotall-flag)[⬆](#index) ```js // patched for support `RegExp` dotAll (`s`) flag: class RegExp { constructor(pattern: RegExp | string, flags?: string): RegExp; exec(): Array | null; readonly attribute dotAll: boolean; readonly attribute flags: string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/regexp-dotall-flag ``` ##### [`RegExp` named capture groups](https://github.com/tc39/proposal-regexp-named-groups)[⬆](#index) ```js // patched for support `RegExp` named capture groups: class RegExp { constructor(pattern: RegExp | string, flags?: string): RegExp; exec(): Array | null; @@replace(string: string, replaceValue: Function | string): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/regexp-named-groups ``` ##### [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled)[⬆](#index) ```js class Promise { static allSettled(iterable: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-all-settled ``` ##### [`Promise.any`](https://github.com/tc39/proposal-promise-any)[⬆](#index) ```js class AggregateError { constructor(errors: Iterable, message: string): AggregateError; errors: Array; message: string; } class Promise { static any(promises: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-any ``` ##### [`Promise.prototype.finally`](https://github.com/tc39/proposal-promise-finally)[⬆](#index) ```js class Promise { finally(onFinally: Function): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-finally ``` ##### [`Symbol.asyncIterator` for asynchronous iteration](https://github.com/tc39/proposal-async-iteration)[⬆](#index) ```js class Symbol { static asyncIterator: @@asyncIterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/async-iteration ``` ##### [`Symbol.prototype.description`](https://github.com/tc39/proposal-Symbol-description)[⬆](#index) ```js class Symbol { readonly attribute description: string | void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/symbol-description ``` ##### [Well-formed `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify)[⬆](#index) ```js namespace JSON { stringify(target: any, replacer?: Function | Array, space?: string | number): string | void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/well-formed-stringify ``` ##### [Well-formed unicode strings](https://github.com/tc39/proposal-is-usv-string)[⬆](#index) ```js class String { isWellFormed(): boolean; toWellFormed(): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/well-formed-unicode-strings ``` #### Stage 3 proposals[⬆](#index) `core-js/stage/3` entry point contains only stage 3 proposals, `core-js/stage/2` - stage 2 and stage 3, etc. [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/3 ``` ##### [`Iterator` helpers](https://github.com/tc39/proposal-iterator-helpers)[⬆](#index) Modules [`esnext.iterator.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.constructor.js), [`esnext.iterator.drop`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.drop.js), [`esnext.iterator.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.every.js), [`esnext.iterator.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.filter.js), [`esnext.iterator.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.find.js), [`esnext.iterator.flat-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.flat-map.js), [`esnext.iterator.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.for-each.js), [`esnext.iterator.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.from.js), [`esnext.iterator.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.map.js), [`esnext.iterator.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.reduce.js), [`esnext.iterator.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.some.js), [`esnext.iterator.take`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.take.js), [`esnext.iterator.to-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.to-array.js) ```js class Iterator { static from(iterable: Iterable | Iterator): Iterator; drop(limit: uint): Iterator; every(callbackfn: (value: any, counter: uint) => boolean): boolean; filter(callbackfn: (value: any, counter: uint) => boolean): Iterator; find(callbackfn: (value: any, counter: uint) => boolean)): any; flatMap(callbackfn: (value: any, counter: uint) => Iterable | Iterator): Iterator; forEach(callbackfn: (value: any, counter: uint) => void): void; map(callbackfn: (value: any, counter: uint) => any): Iterator; reduce(callbackfn: (memo: any, value: any, counter: uint) => any, initialValue: any): any; some(callbackfn: (value: any, counter: uint) => boolean): boolean; take(limit: uint): Iterator; toArray(): Array; @@toStringTag: 'Iterator' } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/iterator-helpers-stage-3-2 core-js(-pure)/actual|full/iterator core-js(-pure)/actual|full/iterator/drop core-js(-pure)/actual|full/iterator/every core-js(-pure)/actual|full/iterator/filter core-js(-pure)/actual|full/iterator/find core-js(-pure)/actual|full/iterator/flat-map core-js(-pure)/actual|full/iterator/for-each core-js(-pure)/actual|full/iterator/from core-js(-pure)/actual|full/iterator/map core-js(-pure)/actual|full/iterator/reduce core-js(-pure)/actual|full/iterator/some core-js(-pure)/actual|full/iterator/take core-js(-pure)/actual|full/iterator/to-array ``` [Examples](https://tinyurl.com/249jw4e4): ```js [1, 2, 3, 4, 5, 6, 7].values() .drop(1) .take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] Iterator.from({ next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) }).toArray(); // => [7, 6, 3, 0, 2, 8] ``` ###### Caveats:[⬆](#index) - For preventing prototypes pollution, in the `pure` version, new `%IteratorPrototype%` methods are not added to the real `%IteratorPrototype%`, they available only on wrappers - instead of `[].values().map(fn)` use `Iterator.from([]).map(fn)`. ##### [`Array` grouping](https://github.com/tc39/proposal-array-grouping)[⬆](#index) Modules [`esnext.object.group-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.object.group-by.js), [`esnext.map.group-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.group-by.js). ```js class Object { groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): { [key]: Array }; } class Map { groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): Map>; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-grouping-v2 core-js(-pure)/full/map/group-by core-js(-pure)/full/object/group-by ``` [*Examples*](https://is.gd/3a0PbH): ```js Object.groupBy([1, 2, 3, 4, 5], it => it % 2); // => { 1: [1, 3, 5], 0: [2, 4] } const map = Map.groupBy([1, 2, 3, 4, 5], it => it % 2); map.get(1); // => [1, 3, 5] map.get(0); // => [2, 4] ```` ##### [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async)[⬆](#index) Modules [`esnext.array.from-async`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.from-async.js). ```js class Array { static fromAsync(asyncItems: AsyncIterable | Iterable | ArrayLike, mapfn?: (value: any, index: number) => any, thisArg?: any): Array; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/array-from-async-stage-2 core-js(-pure)/full/array/from-async ``` [*Example*](https://goo.gl/Jt7SsD): ```js await Array.fromAsync((async function * (){ yield * [1, 2, 3] })(), i => i * i); // => [1, 4, 9] ``` ##### [New `Set` methods](https://github.com/tc39/proposal-set-methods)[⬆](#index) Modules [`esnext.set.difference.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.difference.v2.js), [`esnext.set.intersection.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.intersection.v2.js), [`esnext.set.is-disjoint-from.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-disjoint-from.v2.js), [`esnext.set.is-subset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-subset-of.v2.js), [`esnext.set.is-superset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-superset-of.v2.js), [`esnext.set.symmetric-difference.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.symmetric-difference.v2.js), [`esnext.set.union.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.union.v2.js) ```js class Set { difference(other: SetLike): Set; intersection(other: SetLike): Set; isDisjointFrom(other: SetLike): boolean; isSubsetOf(other: SetLike): boolean; isSupersetOf(other: SetLike): boolean; symmetricDifference(other: SetLike): Set; union(other: SetLike): Set; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/set-methods-v2 core-js(-pure)/actual|full/set/difference core-js(-pure)/actual|full/set/intersection core-js(-pure)/actual|full/set/is-disjoint-from core-js(-pure)/actual|full/set/is-subset-of core-js(-pure)/actual|full/set/is-superset-of core-js(-pure)/actual|full/set/symmetric-difference core-js(-pure)/actual|full/set/union ``` [*Examples*](https://tinyurl.com/2henaoac): ```js new Set([1, 2, 3]).union(new Set([3, 4, 5])); // => Set {1, 2, 3, 4, 5} new Set([1, 2, 3]).intersection(new Set([3, 4, 5])); // => Set {3} new Set([1, 2, 3]).difference(new Set([3, 4, 5])); // => Set {1, 2} new Set([1, 2, 3]).symmetricDifference(new Set([3, 4, 5])); // => Set {1, 2, 4, 5} new Set([1, 2, 3]).isDisjointFrom(new Set([4, 5, 6])); // => true new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2, 1])); // => true new Set([5, 4, 3, 2, 1]).isSupersetOf(new Set([1, 2, 3])); // => true ``` ##### [`Promise.withResolvers`](https://github.com/tc39/proposal-promise-with-resolvers)[⬆](#index) Module [`esnext.promise.with-resolvers`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.promise.with-resolvers.js) ```js class Promise { static withResolvers(): { promise: Promise, resolve: function, reject: function }; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-with-resolvers core-js(-pure)/full/promise/with-resolvers ``` [*Examples*](https://tinyurl.com/2gx4t3xu): ```js const d = Promise.withResolvers(); d.resolve(42); d.promise.then(console.log); // => 42 ``` ##### [`JSON.parse` source text access](https://github.com/tc39/proposal-json-parse-with-source)[⬆](#index) Modules [`esnext.json.is-raw-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.is-raw-json.js), [`esnext.json.parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.parse.js), [`esnext.json.raw-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.raw-json.js). ```js namespace JSON { isRawJSON(O: any): boolean; // patched for source support parse(text: string, reviver?: (this: any, key: string, value: any, context: { source?: string }) => any): any; rawJSON(text: any): RawJSON; // patched for `JSON.rawJSON` support stringify(value: any, replacer?: Array | (this: any, key: string, value: any) => any, space?: string | number): string | void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/json-parse-with-source core-js(-pure)/actual|full/json/is-raw-json core-js(-pure)/actual|full/json/parse core-js(-pure)/actual|full/json/raw-json core-js(-pure)/actual|full/json/stringify ``` [*Examples*](https://tinyurl.com/22phm569): ```js function digitsToBigInt(key, val, { source }) { return /^[0-9]+$/.test(source) ? BigInt(source) : val; } function bigIntToRawJSON(key, val) { return typeof val === "bigint" ? JSON.rawJSON(String(val)) : val; } const tooBigForNumber = BigInt(Number.MAX_SAFE_INTEGER) + 2n; JSON.parse(String(tooBigForNumber), digitsToBigInt) === tooBigForNumber; // true const wayTooBig = BigInt("1" + "0".repeat(1000)); JSON.parse(String(wayTooBig), digitsToBigInt) === wayTooBig; // true const embedded = JSON.stringify({ tooBigForNumber }, bigIntToRawJSON); embedded === '{"tooBigForNumber":9007199254740993}'; // true ``` ##### [`Float16` methods](https://github.com/tc39/proposal-float16array)[⬆](#index) Modules [`esnext.data-view.get-float16`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-float16.js), [`esnext.data-view.set-float16`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-float16.js) and [`esnext.math.f16round`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.f16round.js) ```js class DataView { getFloat16(offset: any): number setFloat16(offset: any, value: any): void; } namespace Math { fround(number: any): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/float16 core-js/actual|full/dataview/get-float16 core-js/actual|full/dataview/set-float16 core-js/actual|full/math/f16round ``` [Examples](https://tinyurl.com/2zxkrwub): ```js console.log(Math.f16round(1.337)); // => 1.3369140625 const view = new DataView(new ArrayBuffer(2)); view.setFloat16(0, 1.337); console.log(view.getFloat16(0)); // => 1.3369140625 ``` ##### [`ArrayBuffer.prototype.transfer` and friends](https://github.com/tc39/proposal-arraybuffer-transfer)[⬆](#index) Note: **`ArrayBuffer.prototype.{ transfer, transferToFixedLength }` polyfilled only in runtime with native `structuredClone` with `ArrayBuffer` transfer or `MessageChannel` support.** Modules [`esnext.array-buffer.detached`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.detached.js), [`esnext.array-buffer.transfer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.transfer.js), [`esnext.array-buffer.transfer-to-fixed-length`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js). ```js class ArrayBuffer { readonly attribute detached: boolean; transfer(newLength?: number): ArrayBuffer; transferToFixedLength(newLength?: number): ArrayBuffer; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/array-buffer-transfer core-js/actual|full/array-buffer core-js/actual|full/array-buffer/detached core-js/actual|full/array-buffer/transfer core-js/actual|full/array-buffer/transfer-to-fixed-length ``` [*Examples*](https://tinyurl.com/2y99jj9k): ```js const buffer = Int8Array.of(1, 2, 3, 4, 5, 6, 7, 8).buffer; console.log(buffer.byteLength); // => 8 console.log(buffer.detached); // => false const newBuffer = buffer.transfer(4); console.log(buffer.byteLength); // => 0 console.log(buffer.detached); // => true console.log(newBuffer.byteLength); // => 4 console.log(newBuffer.detached); // => false console.log([...new Int8Array(newBuffer)]); // => [1, 2, 3, 4] ``` ##### [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management)[⬆](#index) Note: **This is only built-ins for this proposal, `using` syntax support requires transpiler support.** Modules [`esnext.symbol.dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.dispose.js), [`esnext.disposable-stack.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.disposable-stack.constructor.js), [`esnext.suppressed-error.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.suppressed-error.constructor.js), [`esnext.iterator.dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.dispose.js), [`esnext.symbol.async-dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.async-dispose.js), [`esnext.async-disposable-stack.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-disposable-stack.constructor.js), [`esnext.async-iterator.async-dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.async-dispose.js). ```js class Symbol { static asyncDispose: @@asyncDispose; static dispose: @@dispose; } class DisposableStack { constructor(): DisposableStack; dispose(): undefined; use(value: Disposable): value; adopt(value: object, onDispose: Function): value; defer(onDispose: Function): undefined; @@dispose(): undefined; @@toStringTag: 'DisposableStack'; } class AsyncDisposableStack { constructor(): AsyncDisposableStack; disposeAsync(): Promise; use(value: AsyncDisposable | Disposable): value; adopt(value: object, onDispose: Function): value; defer(onDispose: Function): undefined; @@asyncDispose(): Promise; @@toStringTag: 'AsyncDisposableStack'; } class SuppressedError extends Error { constructor(error: any, suppressed: any, message?: string): SuppressedError; error: any; suppressed: any; message: string; cause: any; } class Iterator { @@dispose(): undefined; } class AsyncIterator { @@asyncDispose(): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/explicit-resource-management core-js(-pure)/actual|full/symbol/async-dispose core-js(-pure)/actual|full/symbol/dispose core-js(-pure)/actual|full/disposable-stack core-js(-pure)/actual|full/async-disposable-stack core-js(-pure)/actual|full/suppressed-error core-js(-pure)/actual|full/iterator/dispose core-js(-pure)/actual|full/async-iterator/async-dispose ``` ##### [`Symbol.metadata` for decorators metadata proposal](https://github.com/tc39/proposal-decorator-metadata)[⬆](#index) Modules [`esnext.symbol.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.metadata.js) and [`esnext.function.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.metadata.js). ```js class Symbol { static metadata: @@metadata; } class Function { @@metadata: null; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/decorator-metadata-v2 core-js(-pure)/actual|full/symbol/metadata core-js(-pure)/actual|full/function/metadata ``` #### Stage 2 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/stage/2 ``` ##### [`AsyncIterator` helpers](https://github.com/tc39/proposal-async-iterator-helpers)[⬆](#index) Modules [`esnext.async-iterator.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.constructor.js), [`esnext.async-iterator.drop`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.drop.js), [`esnext.async-iterator.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.every.js), [`esnext.async-iterator.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.filter.js), [`esnext.async-iterator.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.find.js), [`esnext.async-iterator.flat-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.flat-map.js), [`esnext.async-iterator.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.for-each.js), [`esnext.async-iterator.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.from.js), [`esnext.async-iterator.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.map.js), [`esnext.async-iterator.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.reduce.js), [`esnext.async-iterator.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.some.js), [`esnext.async-iterator.take`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.take.js), [`esnext.async-iterator.to-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.to-array.js), , [`esnext.iterator.to-async`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.to-async.js) ```js class Iterator { toAsync(): AsyncIterator; } class AsyncIterator { static from(iterable: AsyncIterable | Iterable | AsyncIterator): AsyncIterator; drop(limit: uint): AsyncIterator; every(async callbackfn: (value: any, counter: uint) => boolean): Promise; filter(async callbackfn: (value: any, counter: uint) => boolean): AsyncIterator; find(async callbackfn: (value: any, counter: uint) => boolean)): Promise; flatMap(async callbackfn: (value: any, counter: uint) => AsyncIterable | Iterable | AsyncIterator): AsyncIterator; forEach(async callbackfn: (value: any, counter: uint) => void): Promise; map(async callbackfn: (value: any, counter: uint) => any): AsyncIterator; reduce(async callbackfn: (memo: any, value: any, counter: uint) => any, initialValue: any): Promise; some(async callbackfn: (value: any, counter: uint) => boolean): Promise; take(limit: uint): AsyncIterator; toArray(): Promise; @@toStringTag: 'AsyncIterator' } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/async-iterator-helpers core-js(-pure)/actual|full/async-iterator core-js(-pure)/actual|full/async-iterator/drop core-js(-pure)/actual|full/async-iterator/every core-js(-pure)/actual|full/async-iterator/filter core-js(-pure)/actual|full/async-iterator/find core-js(-pure)/actual|full/async-iterator/flat-map core-js(-pure)/actual|full/async-iterator/for-each core-js(-pure)/actual|full/async-iterator/from core-js(-pure)/actual|full/async-iterator/map core-js(-pure)/actual|full/async-iterator/reduce core-js(-pure)/actual|full/async-iterator/some core-js(-pure)/actual|full/async-iterator/take core-js(-pure)/actual|full/async-iterator/to-array core-js(-pure)/actual|full/iterator/to-async ``` [Examples](https://tinyurl.com/28tet4ek): ```js await AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) .drop(1) .take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] await [1, 2, 3].values().toAsync().map(async it => it ** 2).toArray(); // => [1, 4, 9] ``` ###### Caveats:[⬆](#index) - For preventing prototypes pollution, in the `pure` version, new `%AsyncIteratorPrototype%` methods are not added to the real `%AsyncIteratorPrototype%`, they available only on wrappers - instead of `[].values().toAsync().map(fn)` use `AsyncIterator.from([]).map(fn)`. - Now, we have access to the real `%AsyncIteratorPrototype%` only with usage async generators syntax. So, for compatibility the library with old browsers, we should use `Function` constructor. However, that breaks compatibility with CSP. So, if you wanna use the real `%AsyncIteratorPrototype%`, you should set `USE_FUNCTION_CONSTRUCTOR` option in the `core-js/configurator` to `true`: ```js const configurator = require('core-js/configurator'); configurator({ USE_FUNCTION_CONSTRUCTOR: true }); require('core-js/actual/async-iterator'); (async function * () { /* empty */ })() instanceof AsyncIterator; // => true ``` - As an alternative, you could pass to the `core-js/configurator` an object that will be considered as `%AsyncIteratorPrototype%`: ```js const configurator = require('core-js/configurator'); const { getPrototypeOf } = Object; configurator({ AsyncIteratorPrototype: getPrototypeOf(getPrototypeOf(getPrototypeOf(async function * () { /* empty */ }()))) }); require('core-js/actual/async-iterator'); (async function * () { /* empty */ })() instanceof AsyncIterator; // => true ``` ##### [`Iterator.range`](https://github.com/tc39/proposal-Number.range)[⬆](#index) Module [`esnext.iterator.range`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.range.js) ```js class Iterator { range(start: number, end: number, options: { step: number = 1, inclusive: boolean = false } | step: number = 1): NumericRangeIterator; range(start: bigint, end: bigint | Infinity | -Infinity, options: { step: bigint = 1n, inclusive: boolean = false } | step: bigint = 1n): NumericRangeIterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/number-range core-js(-pure)/full/iterator/range ``` [*Example*](https://tinyurl.com/2gobe777): ```js for (const i of Iterator.range(1, 10)) { console.log(i); // => 1, 2, 3, 4, 5, 6, 7, 8, 9 } for (const i of Iterator.range(1, 10, { step: 3, inclusive: true })) { console.log(i); // => 1, 4, 7, 10 } ``` ##### [`Map.prototype.emplace`](https://github.com/thumbsupep/proposal-upsert)[⬆](#index) Modules [`esnext.map.emplace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.emplace.js) and [`esnext.weak-map.emplace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.emplace.js) ```js class Map { emplace(key: any, { update: (value: any, key: any, handler: object) => updated: any, insert: (key: any, handler: object) => value: any): updated | value; } class WeakMap { emplace(key: any, { update: (value: any, key: any, handler: object) => updated: any, insert: (key: any, handler: object) => value: any): updated | value; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/map-upsert-stage-2 core-js(-pure)/full/map/emplace core-js(-pure)/full/weak-map/emplace ``` [*Examples*](https://is.gd/ty5I2v): ```js const map = new Map([['a', 2]]); map.emplace('a', { update: it => it ** 2, insert: () => 3}); // => 4 map.emplace('b', { update: it => it ** 2, insert: () => 3}); // => 3 console.log(map); // => Map { 'a': 4, 'b': 3 } ``` ##### [`Array.isTemplateObject`](https://github.com/tc39/proposal-array-is-template-object)[⬆](#index) Module [`esnext.array.is-template-object`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.is-template-object.js) ```js class Array { static isTemplateObject(value: any): boolean } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/array-is-template-object core-js(-pure)/full/array/is-template-object ``` *Example*: ```js console.log(Array.isTemplateObject((it => it)`qwe${ 123 }asd`)); // => true ``` ##### [`String.dedent`](https://github.com/tc39/proposal-string-dedent)[⬆](#index) Module [`esnext.string.dedent`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.dedent.js) ```js class String { static dedent(templateOrTag: { raw: Array } | function, ...substitutions: Array): string | function; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-dedent core-js(-pure)/full/string/dedent ``` [*Example*](https://tinyurl.com/2lbnofgo): ```js const message = 42; console.log(String.dedent` print('${ message }') `); // => print('42') String.dedent(console.log)` print('${ message }') `; // => ["print('", "')", raw: Array(2)], 42 ``` ##### [`RegExp` escaping](https://github.com/tc39/proposal-regex-escaping)[⬆](#index) Module [`esnext.regexp.escape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.regexp.escape.js) ```js class RegExp { static escape(value: string): string } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/regexp-escaping core-js(-pure)/full/regexp/escape ``` [*Example*](https://tinyurl.com/yqvehz5c): ```js console.log(RegExp.escape('10$')); // => '\\x310\\$' console.log(RegExp.escape('abcdefg_123456')); // => 'abcdefg_123456' console.log(RegExp.escape('(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`')); // => '\\(\\)\\{\\}\\[\\]\\|\\,\\.\\?\\*\\+\\-\\^\\$\\=\\<\\>\\\\\\/\\#\\&\\!\\%\\:\\;\\@\\~\\\'\\"\\`' ``` ##### [`Symbol` predicates](https://github.com/tc39/proposal-symbol-predicates)[⬆](#index) Modules [`esnext.symbol.is-registered-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-registered-symbol.js), [`esnext.symbol.is-well-known-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-well-known-symbol.js). ```js class Symbol { static isRegisteredSymbol(value: any): boolean; static isWellKnownSymbol(value: any): boolean; } ``` ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/symbol-predicates-v2 core-js(-pure)/full/symbol/is-registered-symbol core-js(-pure)/full/symbol/is-well-known-symbol ``` [*Example*](https://tinyurl.com/2oqoaq7t): ```js Symbol.isRegisteredSymbol(Symbol.for('key')); // => true Symbol.isRegisteredSymbol(Symbol('key')); // => false Symbol.isWellKnownSymbol(Symbol.iterator); // => true Symbol.isWellKnownSymbol(Symbol('key')); // => false ``` #### Stage 1 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/1 ``` ##### [`Observable`](https://github.com/zenparsing/es-observable)[⬆](#index) Modules [`esnext.observable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.observable.js) and [`esnext.symbol.observable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.observable.js) ```js class Observable { constructor(subscriber: Function): Observable; subscribe(observer: Function | { next?: Function, error?: Function, complete?: Function }): Subscription; @@observable(): this; static of(...items: Array): Observable; static from(x: Observable | Iterable): Observable; static readonly attribute @@species: this; } class Symbol { static observable: @@observable; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/observable core-js(-pure)/full/observable core-js(-pure)/full/symbol/observable ``` [*Examples*](https://goo.gl/1LDywi): ```js new Observable(observer => { observer.next('hello'); observer.next('world'); observer.complete(); }).subscribe({ next(it) { console.log(it); }, complete() { console.log('!'); } }); ``` ##### [New collections methods](https://github.com/tc39/proposal-collection-methods)[⬆](#index) Modules [`esnext.set.add-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.add-all.js), [`esnext.set.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.delete-all.js), [`esnext.set.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.every.js), [`esnext.set.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.filter.js), [`esnext.set.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.find.js), [`esnext.set.join`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.join.js), [`esnext.set.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.map.js), [`esnext.set.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.reduce.js), [`esnext.set.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.some.js), [`esnext.map.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.delete-all.js), [`esnext.map.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.every.js), [`esnext.map.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.filter.js), [`esnext.map.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.find.js), [`esnext.map.find-key`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.find-key.js), [`esnext.map.group-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.group-by.js), [`esnext.map.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.includes.js), [`esnext.map.key-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.key-by.js), [`esnext.map.key-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.key-of.js), [`esnext.map.map-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.map-keys.js), [`esnext.map.map-values`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.map-values.js), [`esnext.map.merge`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.merge.js), [`esnext.map.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.reduce.js), [`esnext.map.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.some.js), [`esnext.map.update`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.update.js), [`esnext.weak-set.add-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.add-all.js), [`esnext.weak-set.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.delete-all.js), [`esnext.weak-map.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.delete-all.js) ##### [`.of` and `.from` methods on collection constructors](https://github.com/tc39/proposal-setmap-offrom)[⬆](#index) Modules [`esnext.set.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.of.js), [`esnext.set.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.from.js), [`esnext.map.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.of.js), [`esnext.map.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.from.js), [`esnext.weak-set.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.of.js), [`esnext.weak-set.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.from.js), [`esnext.weak-map.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.of.js), [`esnext.weak-map.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.from.js) ```js class Set { static of(...args: Array): Set; static from(iterable: Iterable, mapFn?: (value: any, index: number) => any, thisArg?: any): Set; addAll(...args: Array): this; deleteAll(...args: Array): boolean; every(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; filter(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): Set; find(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; join(separator: string = ','): string; map(callbackfn: (value: any, key: any, target: any) => any, thisArg?: any): Set; reduce(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue?: any): any; some(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; } class Map { static groupBy(iterable: Iterable, callbackfn?: (value: any) => any): Map; static of(...args: Array<[key, value]>): Map; static from(iterable: Iterable, mapFn?: (value: any, index: number) => [key: any, value: any], thisArg?: any): Map; static keyBy(iterable: Iterable, callbackfn?: (value: any) => any): Map; deleteAll(...args: Array): boolean; every(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; filter(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): Map; find(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; findKey(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; includes(searchElement: any): boolean; keyOf(searchElement: any): any; mapKeys(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Map; mapValues(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Map; merge(...iterables: Array): this; reduce(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue?: any): any; some(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; update(key: any, callbackfn: (value: any, key: any, target: any) => any, thunk?: (key: any, target: any) => any): this; } class WeakSet { static of(...args: Array): WeakSet; static from(iterable: Iterable, mapFn?: (value: any, index: number) => Object, thisArg?: any): WeakSet; addAll(...args: Array): this; deleteAll(...args: Array): boolean; } class WeakMap { static of(...args: Array<[key, value]>): WeakMap; static from(iterable: Iterable, mapFn?: (value: any, index: number) => [key: Object, value: any], thisArg?: any): WeakMap; deleteAll(...args: Array): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/collection-methods core-js/proposals/collection-of-from core-js(-pure)/full/set/add-all core-js(-pure)/full/set/delete-all core-js(-pure)/full/set/every core-js(-pure)/full/set/filter core-js(-pure)/full/set/find core-js(-pure)/full/set/from core-js(-pure)/full/set/join core-js(-pure)/full/set/map core-js(-pure)/full/set/of core-js(-pure)/full/set/reduce core-js(-pure)/full/set/some core-js(-pure)/full/map/delete-all core-js(-pure)/full/map/every core-js(-pure)/full/map/filter core-js(-pure)/full/map/find core-js(-pure)/full/map/find-key core-js(-pure)/full/map/from core-js(-pure)/full/map/group-by core-js(-pure)/full/map/includes core-js(-pure)/full/map/key-by core-js(-pure)/full/map/key-of core-js(-pure)/full/map/map-keys core-js(-pure)/full/map/map-values core-js(-pure)/full/map/merge core-js(-pure)/full/map/of core-js(-pure)/full/map/reduce core-js(-pure)/full/map/some core-js(-pure)/full/map/update core-js(-pure)/full/weak-set/add-all core-js(-pure)/full/weak-set/delete-all core-js(-pure)/full/weak-set/of core-js(-pure)/full/weak-set/from core-js(-pure)/full/weak-map/delete-all core-js(-pure)/full/weak-map/of core-js(-pure)/full/weak-map/from ``` `.of` / `.from` [*examples*](https://goo.gl/mSC7eU): ```js Set.of(1, 2, 3, 2, 1); // => Set {1, 2, 3} Map.from([[1, 2], [3, 4]], ([key, value]) => [key ** 2, value ** 2]); // => Map { 1: 4, 9: 16 } ``` ##### [`compositeKey` and `compositeSymbol`](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey)[⬆](#index) Modules [`esnext.composite-key`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.composite-key.js) and [`esnext.composite-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.composite-symbol.js) ```js function compositeKey(...args: Array): object; function compositeSymbol(...args: Array): symbol; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/keys-composition core-js(-pure)/full/composite-key core-js(-pure)/full/composite-symbol ``` [*Examples*](https://goo.gl/2oPAH7): ```js // returns a symbol const symbol = compositeSymbol({}); console.log(typeof symbol); // => 'symbol' // works the same, but returns a plain frozen object without a prototype const key = compositeKey({}); console.log(typeof key); // => 'object' console.log({}.toString.call(key)); // => '[object Object]' console.log(Object.getPrototypeOf(key)); // => null console.log(Object.isFrozen(key)); // => true const a = ['a']; const b = ['b']; const c = ['c']; console.log(compositeSymbol(a) === compositeSymbol(a)); // => true console.log(compositeSymbol(a) !== compositeSymbol(['a'])); // => true console.log(compositeSymbol(a, 1) === compositeSymbol(a, 1)); // => true console.log(compositeSymbol(a, b) !== compositeSymbol(b, a)); // => true console.log(compositeSymbol(a, b, c) === compositeSymbol(a, b, c)); // => true console.log(compositeSymbol(1, a) === compositeSymbol(1, a)); // => true console.log(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); // => true console.log(compositeSymbol(a, a) === compositeSymbol(a, a)); // => true ``` ##### [Array filtering](https://github.com/tc39/proposal-array-filtering)[⬆](#index) Modules [`esnext.array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.filter-reject.js) and [`esnext.typed-array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.typed-array.filter-reject.js). ```js class Array { filterReject(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): Array; } class %TypedArray% { filterReject(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): %TypedArray%; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-filtering-stage-1 core-js(-pure)/full/array(/virtual)/filter-reject core-js/full/typed-array/filter-reject ``` [*Examples*](https://is.gd/jJcoWw): ```js [1, 2, 3, 4, 5].filterReject(it => it % 2); // => [2, 4] ```` ##### [Array deduplication](https://github.com/tc39/proposal-array-unique)[⬆](#index) Modules [`esnext.array.unique-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.unique-by.js) and [`esnext.typed-array.unique-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.typed-array.unique-by.js) ```js class Array { uniqueBy(resolver?: (item: any) => any): Array; } class %TypedArray% { uniqueBy(resolver?: (item: any) => any): %TypedArray%;; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/array-unique core-js(-pure)/full/array(/virtual)/unique-by core-js/full/typed-array/unique-by ``` [*Examples*](https://is.gd/lilNPu): ```js [1, 2, 3, 2, 1].uniqueBy(); // [1, 2, 3] [ { id: 1, uid: 10000 }, { id: 2, uid: 10000 }, { id: 3, uid: 10001 } ].uniqueBy(it => it.uid); // => [{ id: 1, uid: 10000 }, { id: 3, uid: 10001 }] ``` ##### [`DataView` get / set `Uint8Clamped` methods](https://github.com/tc39/proposal-dataview-get-set-uint8clamped)[⬆](#index) Modules [`esnext.data-view.get-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-uint8-clamped.js) and [`esnext.data-view.set-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-uint8-clamped.js) ```js class DataView { getUint8Clamped(offset: any): uint8 setUint8Clamped(offset: any, value: any): void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/data-view-get-set-uint8-clamped core-js/full/dataview/get-uint8-clamped core-js/full/dataview/set-uint8-clamped ``` [Examples](https://tinyurl.com/2h4zv8sw): ```js const view = new DataView(new ArrayBuffer(1)); view.setUint8Clamped(0, 100500); console.log(view.getUint8Clamped(0)); // => 255 ``` ##### [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring)[⬆](#index) Module [`esnext.number.from-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.number.from-string.js) ```js class Number { fromString(string: string, radix: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/number-from-string core-js(-pure)/full/number/from-string ``` ##### [`Math` extensions](https://github.com/rwaldron/proposal-math-extensions)[⬆](#index) Modules [`esnext.math.clamp`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.clamp.js), [`esnext.math.deg-per-rad`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.deg-per-rad.js), [`esnext.math.degrees`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.degrees.js), [`esnext.math.fscale`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.fscale.js), [`esnext.math.rad-per-deg`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.rad-per-deg.js), [`esnext.math.radians`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.radians.js) and [`esnext.math.scale`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.scale.js) ```js namespace Math { DEG_PER_RAD: number; RAD_PER_DEG: number; clamp(x: number, lower: number, upper: number): number; degrees(radians: number): number; fscale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number; radians(degrees: number): number; scale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/math-extensions core-js(-pure)/full/math/clamp core-js(-pure)/full/math/deg-per-rad core-js(-pure)/full/math/degrees core-js(-pure)/full/math/fscale core-js(-pure)/full/math/rad-per-deg core-js(-pure)/full/math/radians core-js(-pure)/full/math/scale ``` ##### [`Math.signbit`](https://github.com/tc39/proposal-Math.signbit)[⬆](#index) Module [`esnext.math.signbit`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.signbit.js) ```js namespace Math { signbit(x: number): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/math-signbit core-js(-pure)/full/math/signbit ``` [*Examples*](https://goo.gl/rPWbzZ): ```js Math.signbit(NaN); // => false Math.signbit(1); // => false Math.signbit(-1); // => true Math.signbit(0); // => false Math.signbit(-0); // => true ``` ##### [`String.cooked`](https://github.com/tc39/proposal-string-cooked)[⬆](#index) Module [`esnext.string.cooked`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.cooked.js) ```js class String { static cooked(template: Array, ...substitutions: Array): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-cooked core-js(-pure)/full/string/cooked ``` [*Example*](https://is.gd/7QPnss): ```js function safePath(strings, ...subs) { return String.cooked(strings, ...subs.map(sub => encodeURIComponent(sub))); } let id = 'spottie?'; safePath`/cats/${ id }`; // => /cats/spottie%3F ``` ##### [`String.prototype.codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints)[⬆](#index) Module [`esnext.string.code-points`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.code-points.js) ```js class String { codePoints(): Iterator<{ codePoint, position }>; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-code-points core-js(-pure)/full/string/code-points ``` [*Example*](https://goo.gl/Jt7SsD): ```js for (let { codePoint, position } of 'qwe'.codePoints()) { console.log(codePoint); // => 113, 119, 101 console.log(position); // => 0, 1, 2 } ``` ##### [`Symbol.matcher` for pattern matching](https://github.com/tc39/proposal-pattern-matching)[⬆](#index) Module [`esnext.symbol.matcher`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.matcher.js). ```js class Symbol { static matcher: @@matcher; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/pattern-matching core-js(-pure)/full/symbol/matcher ``` #### Stage 0 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/0 ``` ##### [`Function.prototype.demethodize`](https://github.com/js-choi/proposal-function-demethodize)[⬆](#index) Module [`esnext.function.demethodize`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.demethodize.js) ```js class Function { demethodize(): Function; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/proposals/function-demethodize core-js(-pure)/full/function/demethodize core-js(-pure)/full/function/virtual/demethodize ``` [*Examples*](https://tinyurl.com/2ltmohgl): ```js const slice = Array.prototype.slice.demethodize(); slice([1, 2, 3], 1); // => [2, 3] ``` ##### [`Function.{ isCallable, isConstructor }`](https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md)[⬆](#index) Modules [`esnext.function.is-callable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.is-callable.js), [`esnext.function.is-constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.is-constructor.js) ```js class Function { static isCallable(value: any): boolean; static isConstructor(value: any): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/function-is-callable-is-constructor core-js(-pure)/full/function/is-callable core-js(-pure)/full/function/is-constructor ``` [*Examples*](https://is.gd/Kof1he): ```js Function.isCallable(null); // => false Function.isCallable({}); // => false Function.isCallable(function () {}); // => true Function.isCallable(() => {}); // => true Function.isCallable(class {}); // => false Function.isConstructor(null); // => false Function.isConstructor({}); // => false Function.isConstructor(function () {}); // => true Function.isConstructor(() => {}); // => false Function.isConstructor(class {}); // => true ``` #### Pre-stage 0 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/pre ``` ##### [`Reflect` metadata](https://github.com/rbuckton/reflect-metadata)[⬆](#index) Modules [`esnext.reflect.define-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.define-metadata.js), [`esnext.reflect.delete-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.delete-metadata.js), [`esnext.reflect.get-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata.js), [`esnext.reflect.get-metadata-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata-keys.js), [`esnext.reflect.get-own-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-own-metadata.js), [`esnext.reflect.get-own-metadata-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js), [`esnext.reflect.has-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.has-metadata.js), [`esnext.reflect.has-own-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.has-own-metadata.js) and [`esnext.reflect.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.metadata.js). ```js namespace Reflect { defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey?: PropertyKey): void; getMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; getOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; hasMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; hasOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; deleteMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; getMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; getOwnMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; metadata(metadataKey: any, metadataValue: any): decorator(target: Object, targetKey?: PropertyKey) => void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/reflect-metadata core-js(-pure)/full/reflect/define-metadata core-js(-pure)/full/reflect/delete-metadata core-js(-pure)/full/reflect/get-metadata core-js(-pure)/full/reflect/get-metadata-keys core-js(-pure)/full/reflect/get-own-metadata core-js(-pure)/full/reflect/get-own-metadata-keys core-js(-pure)/full/reflect/has-metadata core-js(-pure)/full/reflect/has-own-metadata core-js(-pure)/full/reflect/metadata ``` [*Examples*](https://goo.gl/KCo3PS): ```js let object = {}; Reflect.defineMetadata('foo', 'bar', object); Reflect.ownKeys(object); // => [] Reflect.getOwnMetadataKeys(object); // => ['foo'] Reflect.getOwnMetadata('foo', object); // => 'bar' ``` ### Web standards[⬆](#index) #### `self`[⬆](#index) [Spec](https://html.spec.whatwg.org/multipage/window-object.html#dom-self), module [`web.self`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.self.js) ```js getter self: GlobalThisValue; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/self ``` [*Examples*](https://tinyurl.com/27nghouh): ```js self.Array === Array; // => true ``` #### `structuredClone`[⬆](#index) [Spec](https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone), module [`web.structured-clone`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.structured-clone.js) ```js function structuredClone(value: Serializable, { transfer?: Sequence }): any; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/structured-clone ``` [*Examples*](https://is.gd/RhK7TW): ```js const structured = [{ a: 42 }]; const sclone = structuredClone(structured); console.log(sclone); // => [{ a: 42 }] console.log(structured !== sclone); // => true console.log(structured[0] !== sclone[0]); // => true const circular = {}; circular.circular = circular; const cclone = structuredClone(circular); console.log(cclone.circular === cclone); // => true structuredClone(42); // => 42 structuredClone({ x: 42 }); // => { x: 42 } structuredClone([1, 2, 3]); // => [1, 2, 3] structuredClone(new Set([1, 2, 3])); // => Set{ 1, 2, 3 } structuredClone(new Map([['a', 1], ['b', 2]])); // => Map{ a: 1, b: 2 } structuredClone(new Int8Array([1, 2, 3])); // => new Int8Array([1, 2, 3]) structuredClone(new AggregateError([1, 2, 3], 'message')); // => new AggregateError([1, 2, 3], 'message')) structuredClone(new TypeError('message', { cause: 42 })); // => new TypeError('message', { cause: 42 }) structuredClone(new DOMException('message', 'DataCloneError')); // => new DOMException('message', 'DataCloneError') structuredClone(document.getElementById('myfileinput')); // => new FileList structuredClone(new DOMPoint(1, 2, 3, 4)); // => new DOMPoint(1, 2, 3, 4) structuredClone(new Blob(['test'])); // => new Blob(['test']) structuredClone(new ImageData(8, 8)); // => new ImageData(8, 8) // etc. structuredClone(new WeakMap()); // => DataCloneError on non-serializable types ``` ##### Caveats when using `structuredClone` polyfill:[⬆](#index) * Many platform types cannot be transferred in most engines since we have no way to polyfill this behavior, however `.transfer` option works for some platform types. I recommend avoiding this option. * Some specific platform types can't be cloned in old engines. Mainly it's very specific types or very old engines, but here are some exceptions. For example, we have no sync way to clone `ImageBitmap` in Safari 14.0- or Firefox 83-, so it's recommended to look to the [polyfill source](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.structured-clone.js) if you wanna clone something specific. #### Base64 utility methods[⬆](#index) [Specification](https://html.spec.whatwg.org/multipage/webappapis.html#atob), [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Base64). Modules [`web.atob`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.atob.js), [`web.btoa`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.btoa.js). ```js function atob(data: string): string; function btoa(data: string): string; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/atob core-js(-pure)/stable|actual|full/btoa ``` [*Examples*](https://is.gd/4Nxmzn): ```js btoa('hi, core-js'); // => 'aGksIGNvcmUtanM=' atob('aGksIGNvcmUtanM='); // => 'hi, core-js' ``` #### `setTimeout` and `setInterval`[⬆](#index) Module [`web.timers`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.timers.js). Additional arguments fix for IE9-. ```js function setTimeout(callback: any, time: any, ...args: Array): number; function setInterval(callback: any, time: any, ...args: Array): number; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/set-timeout core-js(-pure)/stable|actual|full/set-interval ``` ```js // Before: setTimeout(log.bind(null, 42), 1000); // After: setTimeout(log, 1000, 42); ``` #### `setImmediate`[⬆](#index) Module [`web.immediate`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.immediate.js). [`setImmediate`](https://w3c.github.io/setImmediate/) polyfill. ```js function setImmediate(callback: any, ...args: Array): number; function clearImmediate(id: number): void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/set-immediate core-js(-pure)/stable|actual|full/clear-immediate ``` [*Examples*](https://goo.gl/6nXGrx): ```js setImmediate((arg1, arg2) => { console.log(arg1, arg2); // => Message will be displayed with minimum delay }, 'Message will be displayed', 'with minimum delay'); clearImmediate(setImmediate(() => { console.log('Message will not be displayed'); })); ``` #### `queueMicrotask`[⬆](#index) [Spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask), module [`web.queue-microtask`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.queue-microtask.js) ```js function queueMicrotask(fn: Function): void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/queue-microtask ``` [*Examples*](https://goo.gl/nsW8P9): ```js queueMicrotask(() => console.log('called as microtask')); ``` #### `URL` and `URLSearchParams`[⬆](#index) [`URL` standard](https://url.spec.whatwg.org/) implementation. Modules [`web.url`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.js), [`web.url.can-parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.can-parse.js), [`web.url.to-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.to-json.js), [`web.url-search-params`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.js), [`web.url-search-params.delete`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.delete.js), [`web.url-search-params.has`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.has.js), [`web.url-search-params.size`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.size.js). ```js class URL { constructor(url: string, base?: string); attribute href: string; readonly attribute origin: string; attribute protocol: string; attribute username: string; attribute password: string; attribute host: string; attribute hostname: string; attribute port: string; attribute pathname: string; attribute search: string; readonly attribute searchParams: URLSearchParams; attribute hash: string; toJSON(): string; toString(): string; static canParse(url: string, base?: string): boolean; } class URLSearchParams { constructor(params?: string | Iterable<[key, value]> | Object); append(name: string, value: string): void; delete(name: string, value?: string): void; get(name: string): string | void; getAll(name: string): Array; has(name: string, value?: string): boolean; set(name: string, value: string): void; sort(): void; toString(): string; forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void; entries(): Iterator<[key, value]>; keys(): Iterator; values(): Iterator; @@iterator(): Iterator<[key, value]>; readonly attribute size: number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/url core-js(-pure)/stable|actual|full/url core-js(-pure)/stable|actual|full/url/can-parse core-js/stable|actual|full/url/to-json core-js(-pure)/stable|actual|full/url-search-params ``` [*Examples*](https://tinyurl.com/2j35uor6): ```js URL.canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); // => true URL.canParse('https'); // => false const url = new URL('https://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment'); console.log(url.href); // => 'https://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment' console.log(url.origin); // => 'https://example.com:8080' console.log(url.protocol); // => 'https:' console.log(url.username); // => 'login' console.log(url.password); // => 'password' console.log(url.host); // => 'example.com:8080' console.log(url.hostname); // => 'example.com' console.log(url.port); // => '8080' console.log(url.pathname); // => '/foo/bar' console.log(url.search); // => '?a=1&b=2&a=3' console.log(url.hash); // => '#fragment' console.log(url.toJSON()); // => 'https://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment' console.log(url.toString()); // => 'https://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment' for (let [key, value] of url.searchParams) { console.log(key); // => 'a', 'b', 'a' console.log(value); // => '1', '2', '3' } url.pathname = ''; url.searchParams.append('c', 4); console.log(url.search); // => '?a=1&b=2&a=3&c=4' console.log(url.href); // => 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment' const params = new URLSearchParams('?a=1&b=2&a=3'); params.append('c', 4); params.append('a', 2); params.delete('a', 1); params.sort(); console.log(params.size); // => 4 for (let [key, value] of params) { console.log(key); // => 'a', 'a', 'b', 'c' console.log(value); // => '3', '2', '2', '4' } console.log(params.has('a')); // => true console.log(params.has('a', 3)); // => true console.log(params.has('a', 4)); // => false console.log(params.toString()); // => 'a=3&a=2&b=2&c=4' ``` ##### Caveats when using `URL` and `URLSearchParams`:[⬆](#index) - IE8 does not support setters, so they do not work on `URL` instances. However, `URL` constructor can be used for basic `URL` parsing. - Legacy encodings in a search query are not supported. Also, `core-js` implementation has some other encoding-related issues. - `URL` implementations from all of the popular browsers have much more problems than `core-js`, however, replacing all of them does not looks like a good idea. You can customize the aggressiveness of polyfill [by your requirements](#configurable-level-of-aggressiveness). ##### `DOMException`:[⬆](#index) [The specification.](https://webidl.spec.whatwg.org/#idl-DOMException) Modules [`web.dom-exception.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.constructor.js), [`web.dom-exception.stack`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.stack.js), [`web.dom-exception.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.to-string-tag.js). ```js class DOMException { constructor(message: string, name?: string); readonly attribute name: string; readonly attribute message: string; readonly attribute code: string; attribute stack: string; // in engines that should have it @@toStringTag: 'DOMException'; } ```` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/dom-exception core-js(-pure)/stable|actual|full/dom-exception/constructor core-js/stable|actual|full/dom-exception/to-string-tag ``` [*Examples*](https://is.gd/pI6oTN): ```js const exception = new DOMException('error', 'DataCloneError'); console.log(exception.name); // => 'DataCloneError' console.log(exception.message); // => 'error' console.log(exception.code); // => 25 console.log(typeof exception.stack); // => 'string' console.log(exception instanceof DOMException); // => true console.log(exception instanceof Error); // => true console.log(exception.toString()); // => 'DataCloneError: error' console.log(Object.prototype.toString.call(exception)); // => '[object DOMException]' ``` #### Iterable DOM collections[⬆](#index) Some DOM collections should have [iterable interface](https://heycam.github.io/webidl/#idl-iterable) or should be [inherited from `Array`](https://heycam.github.io/webidl/#LegacyArrayClass). That means they should have `forEach`, `keys`, `values`, `entries` and `@@iterator` methods for iteration. So add them. Modules [`web.dom-collections.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-collections.iterator.js) and [`web.dom-collections.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-collections.for-each.js). ```js class [ CSSRuleList, CSSStyleDeclaration, CSSValueList, ClientRectList, DOMRectList, DOMStringList, DataTransferItemList, FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLSelectElement, MediaList, MimeTypeArray, NamedNodeMap, PaintRequestList, Plugin, PluginArray, SVGLengthList, SVGNumberList, SVGPathSegList, SVGPointList, SVGStringList, SVGTransformList, SourceBufferList, StyleSheetList, TextTrackCueList, TextTrackList, TouchList, ] { @@iterator(): Iterator; } class [DOMTokenList, NodeList] { forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void; entries(): Iterator<[key, value]>; keys(): Iterator; values(): Iterator; @@iterator(): Iterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stable|actual|full/dom-collections/iterator core-js/stable|actual|full/dom-collections/for-each ``` [*Examples*](https://goo.gl/lfXVFl): ```js for (let { id } of document.querySelectorAll('*')) { if (id) console.log(id); } for (let [index, { id }] of document.querySelectorAll('*').entries()) { if (id) console.log(index, id); } document.querySelectorAll('*').forEach(it => console.log(it.id)); ``` ### Iteration helpers[⬆](#index) Helpers for check iterability / get iterator in the `pure` version or, for example, for `arguments` object: ```js function isIterable(value: any): boolean; function getIterator(value: any): Object; function getIteratorMethod(value: any): Function | void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js-pure/es|stable|actual|full/is-iterable core-js-pure/es|stable|actual|full/get-iterator core-js-pure/es|stable|actual|full/get-iterator-method ``` [*Examples*](https://goo.gl/SXsM6D): ```js import isIterable from 'core-js-pure/actual/is-iterable'; import getIterator from 'core-js-pure/actual/get-iterator'; import getIteratorMethod from 'core-js-pure/actual/get-iterator-method'; let list = (function () { return arguments; })(1, 2, 3); console.log(isIterable(list)); // true; let iterator = getIterator(list); console.log(iterator.next().value); // 1 console.log(iterator.next().value); // 2 console.log(iterator.next().value); // 3 console.log(iterator.next().value); // undefined getIterator({}); // TypeError: [object Object] is not iterable! let method = getIteratorMethod(list); console.log(typeof method); // 'function' let iterator = method.call(list); console.log(iterator.next().value); // 1 console.log(iterator.next().value); // 2 console.log(iterator.next().value); // 3 console.log(iterator.next().value); // undefined console.log(getIteratorMethod({})); // undefined ``` ## Missing polyfills[⬆](#index) - ES `BigInt` can't be polyfilled since it requires changes in the behavior of operators, you could find more info [here](https://github.com/zloirock/core-js/issues/381). You could try to use [`JSBI`](https://github.com/GoogleChromeLabs/jsbi). - ES `Proxy` can't be polyfilled, you can try to use [`proxy-polyfill`](https://github.com/GoogleChrome/proxy-polyfill) which provides a very little subset of features. - ES `String#normalize` is not a very useful feature, but this polyfill will be very large. If you need it, you can use [unorm](https://github.com/walling/unorm/). - ECMA-402 `Intl` is missed because of the size. You can use [those polyfills](https://formatjs.io/docs/polyfills). - `window.fetch` is not a cross-platform feature, in some environments, it makes no sense. For this reason, I don't think it should be in `core-js`. Looking at a large number of requests it *might be* added in the future. Now you can use, for example, [this polyfill](https://github.com/github/fetch). core-js-3.33.2/SECURITY.md000066400000000000000000000005741451776221300147530ustar00rootroot00000000000000# Security Policy ## Supported Versions The [latest released version](https://github.com/zloirock/core-js/releases) of `core-js` is supported. ## Reporting a Vulnerability To report a vulnerability please send an email with the details to zloirock@zloirock.ru. This will help us to assess the risk and start the necessary steps. Thanks for helping to keep `core-js` secure! core-js-3.33.2/babel.config.js000066400000000000000000000042011451776221300160200ustar00rootroot00000000000000'use strict'; module.exports = { // use transforms which does not use ES5+ builtins plugins: [ ['@babel/transform-member-expression-literals'], ['@babel/transform-property-literals'], ['@babel/transform-arrow-functions'], ['@babel/transform-block-scoped-functions'], ['@babel/transform-block-scoping'], // it seems `setClassMethods` unlike `loose` does not work ['@babel/transform-classes', { loose: true }], // private instance props in IE8- only with polyfills ['@babel/transform-class-properties'], ['@babel/transform-class-static-block'], ['@babel/transform-computed-properties'], ['@babel/transform-destructuring'], ['@babel/transform-exponentiation-operator'], ['@babel/transform-for-of'], ['@babel/transform-literals'], ['@babel/transform-logical-assignment-operators'], ['@babel/transform-new-target'], ['@babel/transform-nullish-coalescing-operator'], ['@babel/transform-numeric-separator'], ['@babel/transform-object-rest-spread'], ['@babel/transform-object-super'], ['@babel/transform-optional-catch-binding'], ['@babel/transform-optional-chaining'], ['@babel/transform-parameters'], ['@babel/transform-private-methods'], ['@babel/transform-private-property-in-object'], ['@babel/transform-reserved-words'], ['@babel/transform-shorthand-properties'], ['@babel/transform-spread'], ['@babel/transform-template-literals'], ['@babel/transform-unicode-regex'], // use it instead of webpack es modules for support engines without descriptors ['@babel/transform-modules-commonjs'], ], assumptions: { constantReexports: true, constantSuper: true, enumerableModuleMeta: true, iterableIsArray: true, mutableTemplateObject: false, noClassCalls: true, noDocumentAll: true, noIncompleteNsImportDetection: true, noNewArrows: true, objectRestNoSymbols: true, privateFieldsAsProperties: true, setClassMethods: true, setComputedProperties: true, setPublicClassFields: true, setSpreadProperties: true, skipForOfIteratorClosing: true, superIsCallableConstructor: true, }, }; core-js-3.33.2/deno/000077500000000000000000000000001451776221300141015ustar00rootroot00000000000000core-js-3.33.2/deno/corejs/000077500000000000000000000000001451776221300153665ustar00rootroot00000000000000core-js-3.33.2/deno/corejs/LICENSE000066400000000000000000000020501451776221300163700ustar00rootroot00000000000000Copyright (c) 2014-2023 Denis Pushkarev 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. core-js-3.33.2/deno/corejs/README.md000066400000000000000000000122731451776221300166520ustar00rootroot00000000000000![logo](https://user-images.githubusercontent.com/2213682/146607186-8e13ddef-26a4-4ebf-befd-5aac9d77c090.png)
[![fundraising](https://opencollective.com/core-js/all/badge.svg?label=fundraising)](https://opencollective.com/core-js) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![core-js downloads](https://img.shields.io/npm/dm/core-js.svg?label=npm%20i%20core-js)](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18) [![core-js-pure downloads](https://img.shields.io/npm/dm/core-js-pure.svg?label=npm%20i%20core-js-pure)](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18) [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/core-js-bundle/badge?style=rounded)](https://www.jsdelivr.com/package/npm/core-js-bundle)
**I highly recommend reading this: [So, what's next?](https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md)** --- > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2021](https://github.com/zloirock/core-js#ecmascript): [promises](https://github.com/zloirock/core-js#ecmascript-promise), [symbols](https://github.com/zloirock/core-js#ecmascript-symbol), [collections](https://github.com/zloirock/core-js#ecmascript-collections), iterators, [typed arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays), many other features, [ECMAScript proposals](https://github.com/zloirock/core-js#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](https://github.com/zloirock/core-js#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer if you are interested in `core-js`: [**Open Collective**](https://opencollective.com/core-js), [**Patreon**](https://patreon.com/zloirock), [**Boosty**](https://boosty.to/zloirock), **Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz )**, [**Alipay**](https://user-images.githubusercontent.com/2213682/219464783-c17ad329-17ce-4795-82a7-f609493345ed.png). --- --- --- *Example*: ```js import 'https://deno.land/x/corejs@v3.33.2/index.js'; // <- at the top of your entry point Object.hasOwn({ foo: 42 }, 'foo'); // => true [1, 2, 3, 4, 5, 6, 7].at(-3); // => 5 [1, 2, 3, 4, 5].group(it => it % 2); // => { 1: [1, 3, 5], 0: [2, 4] } Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(console.log); // => 1 (function * (i) { while (true) yield i++; })(1) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] ``` **It's a bundled global version for Deno 1.0+, for more info see [`core-js` documentation](https://github.com/zloirock/core-js/blob/master/README.md).** core-js-3.33.2/deno/corejs/index.js000066400000000000000000016215671451776221300170550ustar00rootroot00000000000000/** * core-js 3.33.2 * © 2014-2023 Denis Pushkarev (zloirock.ru) * license: https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE * source: https://github.com/zloirock/core-js */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ var __webpack_require__ = function (moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(1); __webpack_require__(83); __webpack_require__(99); __webpack_require__(100); __webpack_require__(102); __webpack_require__(104); __webpack_require__(105); __webpack_require__(109); __webpack_require__(111); __webpack_require__(114); __webpack_require__(115); __webpack_require__(117); __webpack_require__(118); __webpack_require__(120); __webpack_require__(152); __webpack_require__(153); __webpack_require__(154); __webpack_require__(155); __webpack_require__(156); __webpack_require__(158); __webpack_require__(159); __webpack_require__(160); __webpack_require__(164); __webpack_require__(165); __webpack_require__(168); __webpack_require__(169); __webpack_require__(170); __webpack_require__(173); __webpack_require__(174); __webpack_require__(175); __webpack_require__(178); __webpack_require__(179); __webpack_require__(189); __webpack_require__(193); __webpack_require__(195); __webpack_require__(197); __webpack_require__(200); __webpack_require__(201); __webpack_require__(202); __webpack_require__(203); __webpack_require__(204); __webpack_require__(208); __webpack_require__(211); __webpack_require__(217); __webpack_require__(218); __webpack_require__(220); __webpack_require__(221); __webpack_require__(225); __webpack_require__(226); __webpack_require__(228); __webpack_require__(229); __webpack_require__(230); __webpack_require__(231); __webpack_require__(233); __webpack_require__(234); __webpack_require__(236); __webpack_require__(237); __webpack_require__(238); __webpack_require__(239); __webpack_require__(240); __webpack_require__(241); __webpack_require__(242); __webpack_require__(246); __webpack_require__(263); __webpack_require__(264); __webpack_require__(266); __webpack_require__(267); __webpack_require__(271); __webpack_require__(273); __webpack_require__(274); __webpack_require__(276); __webpack_require__(277); __webpack_require__(278); __webpack_require__(279); __webpack_require__(280); __webpack_require__(281); __webpack_require__(286); __webpack_require__(287); __webpack_require__(288); __webpack_require__(289); __webpack_require__(290); __webpack_require__(291); __webpack_require__(293); __webpack_require__(294); __webpack_require__(295); __webpack_require__(296); __webpack_require__(297); __webpack_require__(298); __webpack_require__(299); __webpack_require__(300); __webpack_require__(301); __webpack_require__(302); __webpack_require__(303); __webpack_require__(306); __webpack_require__(308); __webpack_require__(310); __webpack_require__(312); __webpack_require__(313); __webpack_require__(314); __webpack_require__(315); __webpack_require__(316); __webpack_require__(317); __webpack_require__(319); __webpack_require__(320); __webpack_require__(322); __webpack_require__(323); __webpack_require__(324); __webpack_require__(325); __webpack_require__(326); __webpack_require__(327); __webpack_require__(329); __webpack_require__(330); __webpack_require__(331); __webpack_require__(332); __webpack_require__(333); __webpack_require__(334); __webpack_require__(335); __webpack_require__(338); __webpack_require__(339); __webpack_require__(340); __webpack_require__(341); __webpack_require__(342); __webpack_require__(343); __webpack_require__(347); __webpack_require__(348); __webpack_require__(349); __webpack_require__(353); __webpack_require__(354); __webpack_require__(355); __webpack_require__(357); __webpack_require__(358); __webpack_require__(359); __webpack_require__(360); __webpack_require__(361); __webpack_require__(362); __webpack_require__(363); __webpack_require__(364); __webpack_require__(365); __webpack_require__(366); __webpack_require__(369); __webpack_require__(370); __webpack_require__(377); __webpack_require__(380); __webpack_require__(381); __webpack_require__(382); __webpack_require__(383); __webpack_require__(384); __webpack_require__(386); __webpack_require__(387); __webpack_require__(389); __webpack_require__(390); __webpack_require__(392); __webpack_require__(393); __webpack_require__(395); __webpack_require__(396); __webpack_require__(397); __webpack_require__(398); __webpack_require__(399); __webpack_require__(400); __webpack_require__(401); __webpack_require__(403); __webpack_require__(404); __webpack_require__(406); __webpack_require__(407); __webpack_require__(409); __webpack_require__(411); __webpack_require__(413); __webpack_require__(417); __webpack_require__(418); __webpack_require__(420); __webpack_require__(421); __webpack_require__(423); __webpack_require__(424); __webpack_require__(425); __webpack_require__(426); __webpack_require__(427); __webpack_require__(428); __webpack_require__(429); __webpack_require__(432); __webpack_require__(433); __webpack_require__(434); __webpack_require__(435); __webpack_require__(438); __webpack_require__(439); __webpack_require__(440); __webpack_require__(441); __webpack_require__(444); __webpack_require__(445); __webpack_require__(446); __webpack_require__(447); __webpack_require__(450); __webpack_require__(451); __webpack_require__(452); __webpack_require__(457); __webpack_require__(458); __webpack_require__(459); __webpack_require__(461); __webpack_require__(462); module.exports = __webpack_require__(463); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable no-unused-vars -- required for functions `.length` */ var $ = __webpack_require__(2); var global = __webpack_require__(3); var apply = __webpack_require__(68); var wrapErrorConstructorWithCause = __webpack_require__(69); var WEB_ASSEMBLY = 'WebAssembly'; var WebAssembly = global[WEB_ASSEMBLY]; // eslint-disable-next-line es/no-error-cause -- feature detection var FORCED = new Error('e', { cause: 7 }).cause !== 7; var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) { var O = {}; O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED); $({ global: true, constructor: true, arity: 1, forced: FORCED }, O); }; var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) { if (WebAssembly && WebAssembly[ERROR_NAME]) { var O = {}; O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED); $({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O); } }; // https://tc39.es/ecma262/#sec-nativeerror exportGlobalErrorCauseWrapper('Error', function (init) { return function Error(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('EvalError', function (init) { return function EvalError(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('RangeError', function (init) { return function RangeError(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('ReferenceError', function (init) { return function ReferenceError(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('SyntaxError', function (init) { return function SyntaxError(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('TypeError', function (init) { return function TypeError(message) { return apply(init, this, arguments); }; }); exportGlobalErrorCauseWrapper('URIError', function (init) { return function URIError(message) { return apply(init, this, arguments); }; }); exportWebAssemblyErrorCauseWrapper('CompileError', function (init) { return function CompileError(message) { return apply(init, this, arguments); }; }); exportWebAssemblyErrorCauseWrapper('LinkError', function (init) { return function LinkError(message) { return apply(init, this, arguments); }; }); exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) { return function RuntimeError(message) { return apply(init, this, arguments); }; }); /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var getOwnPropertyDescriptor = __webpack_require__(4).f; var createNonEnumerableProperty = __webpack_require__(43); var defineBuiltIn = __webpack_require__(47); var defineGlobalProperty = __webpack_require__(37); var copyConstructorProperties = __webpack_require__(55); var isForced = __webpack_require__(67); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.dontCallGetSet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty == typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } defineBuiltIn(target, key, sourceProperty, options); } }; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var check = function (it) { return it && it.Math === Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || this || Function('return this')(); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var call = __webpack_require__(7); var propertyIsEnumerableModule = __webpack_require__(9); var createPropertyDescriptor = __webpack_require__(10); var toIndexedObject = __webpack_require__(11); var toPropertyKey = __webpack_require__(17); var hasOwn = __webpack_require__(38); var IE8_DOM_DEFINE = __webpack_require__(41); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); // Detect IE8's incomplete defineProperty implementation module.exports = !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; }); /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(8); var call = Function.prototype.call; module.exports = NATIVE_BIND ? call.bind(call) : function () { return call.apply(call, arguments); }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); module.exports = !fails(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // toObject with fallback for non-array-like ES3 strings var IndexedObject = __webpack_require__(12); var requireObjectCoercible = __webpack_require__(15); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var fails = __webpack_require__(6); var classof = __webpack_require__(14); var $Object = Object; var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) === 'String' ? split(it, '') : $Object(it); } : $Object; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(8); var FunctionPrototype = Function.prototype; var call = FunctionPrototype.call; var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) { return function () { return call.apply(fn, arguments); }; }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var toString = uncurryThis({}.toString); var stringSlice = uncurryThis(''.slice); module.exports = function (it) { return stringSlice(toString(it), 8, -1); }; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isNullOrUndefined = __webpack_require__(16); var $TypeError = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it); return it; }; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // we can't use just `it == null` since of `document.all` special case // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec module.exports = function (it) { return it === null || it === undefined; }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPrimitive = __webpack_require__(18); var isSymbol = __webpack_require__(22); // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey module.exports = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var isObject = __webpack_require__(19); var isSymbol = __webpack_require__(22); var getMethod = __webpack_require__(29); var ordinaryToPrimitive = __webpack_require__(32); var wellKnownSymbol = __webpack_require__(33); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw new $TypeError("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(20); var $documentAll = __webpack_require__(21); var documentAll = $documentAll.all; module.exports = $documentAll.IS_HTMLDDA ? function (it) { return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll; } : function (it) { return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $documentAll = __webpack_require__(21); var documentAll = $documentAll.all; // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable module.exports = $documentAll.IS_HTMLDDA ? function (argument) { return typeof argument == 'function' || argument === documentAll; } : function (argument) { return typeof argument == 'function'; }; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var documentAll = typeof document == 'object' && document.all; // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined; module.exports = { all: documentAll, IS_HTMLDDA: IS_HTMLDDA }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var isCallable = __webpack_require__(20); var isPrototypeOf = __webpack_require__(24); var USE_SYMBOL_AS_UID = __webpack_require__(25); var $Object = Object; module.exports = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); }; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var isCallable = __webpack_require__(20); var aFunction = function (argument) { return isCallable(argument) ? argument : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method]; }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL = __webpack_require__(26); module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = __webpack_require__(27); var fails = __webpack_require__(6); var global = __webpack_require__(3); var $String = global.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, // of course, fail. return !$String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var userAgent = __webpack_require__(28); var process = global.process; var Deno = global.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } module.exports = version; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || ''; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(30); var isNullOrUndefined = __webpack_require__(16); // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod module.exports = function (V, P) { var func = V[P]; return isNullOrUndefined(func) ? undefined : aCallable(func); }; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(20); var tryToString = __webpack_require__(31); var $TypeError = TypeError; // `Assert: IsCallable(argument) is true` module.exports = function (argument) { if (isCallable(argument)) return argument; throw new $TypeError(tryToString(argument) + ' is not a function'); }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $String = String; module.exports = function (argument) { try { return $String(argument); } catch (error) { return 'Object'; } }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var $TypeError = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive module.exports = function (input, pref) { var fn, val; if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; throw new $TypeError("Can't convert object to primitive value"); }; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var shared = __webpack_require__(34); var hasOwn = __webpack_require__(38); var uid = __webpack_require__(40); var NATIVE_SYMBOL = __webpack_require__(26); var USE_SYMBOL_AS_UID = __webpack_require__(25); var Symbol = global.Symbol; var WellKnownSymbolsStore = shared('wks'); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!hasOwn(WellKnownSymbolsStore, name)) { WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_PURE = __webpack_require__(35); var store = __webpack_require__(36); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.33.2', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', license: 'https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE', source: 'https://github.com/zloirock/core-js' }); /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = false; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var defineGlobalProperty = __webpack_require__(37); var SHARED = '__core-js_shared__'; var store = global[SHARED] || defineGlobalProperty(SHARED, {}); module.exports = store; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; module.exports = function (key, value) { try { defineProperty(global, key, { value: value, configurable: true, writable: true }); } catch (error) { global[key] = value; } return value; }; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var toObject = __webpack_require__(39); var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe module.exports = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var requireObjectCoercible = __webpack_require__(15); var $Object = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject module.exports = function (argument) { return $Object(requireObjectCoercible(argument)); }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var id = 0; var postfix = Math.random(); var toString = uncurryThis(1.0.toString); module.exports = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var fails = __webpack_require__(6); var createElement = __webpack_require__(42); // Thanks to IE8 for its funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a !== 7; }); /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var isObject = __webpack_require__(19); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var definePropertyModule = __webpack_require__(44); var createPropertyDescriptor = __webpack_require__(10); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var IE8_DOM_DEFINE = __webpack_require__(41); var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(45); var anObject = __webpack_require__(46); var toPropertyKey = __webpack_require__(17); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE = 'configurable'; var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var fails = __webpack_require__(6); // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 module.exports = DESCRIPTORS && fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype !== 42; }); /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(19); var $String = String; var $TypeError = TypeError; // `Assert: Type(argument) is Object` module.exports = function (argument) { if (isObject(argument)) return argument; throw new $TypeError($String(argument) + ' is not an object'); }; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(20); var definePropertyModule = __webpack_require__(44); var makeBuiltIn = __webpack_require__(48); var defineGlobalProperty = __webpack_require__(37); module.exports = function (O, key, value, options) { if (!options) options = {}; var simple = options.enumerable; var name = options.name !== undefined ? options.name : key; if (isCallable(value)) makeBuiltIn(value, name, options); if (options.global) { if (simple) O[key] = value; else defineGlobalProperty(key, value); } else { try { if (!options.unsafe) delete O[key]; else if (O[key]) simple = true; } catch (error) { /* empty */ } if (simple) O[key] = value; else definePropertyModule.f(O, key, { value: value, enumerable: false, configurable: !options.nonConfigurable, writable: !options.nonWritable }); } return O; }; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var fails = __webpack_require__(6); var isCallable = __webpack_require__(20); var hasOwn = __webpack_require__(38); var DESCRIPTORS = __webpack_require__(5); var CONFIGURABLE_FUNCTION_NAME = __webpack_require__(49).CONFIGURABLE; var inspectSource = __webpack_require__(50); var InternalStateModule = __webpack_require__(51); var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; var $String = String; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; var stringSlice = uncurryThis(''.slice); var replace = uncurryThis(''.replace); var join = uncurryThis([].join); var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; }); var TEMPLATE = String(String).split('String'); var makeBuiltIn = module.exports = function (value, name, options) { if (stringSlice($String(name), 0, 7) === 'Symbol(') { name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']'; } if (options && options.getter) name = 'get ' + name; if (options && options.setter) name = 'set ' + name; if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); else value.name = name; } if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { defineProperty(value, 'length', { value: options.arity }); } try { if (options && hasOwn(options, 'constructor') && options.constructor) { if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable } else if (value.prototype) value.prototype = undefined; } catch (error) { /* empty */ } var state = enforceInternalState(value); if (!hasOwn(state, 'source')) { state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); } return value; }; // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative // eslint-disable-next-line no-extend-native -- required Function.prototype.toString = makeBuiltIn(function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); }, 'toString'); /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var hasOwn = __webpack_require__(38); var FunctionPrototype = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); module.exports = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var isCallable = __webpack_require__(20); var store = __webpack_require__(36); var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable(store.inspectSource)) { store.inspectSource = function (it) { return functionToString(it); }; } module.exports = store.inspectSource; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_WEAK_MAP = __webpack_require__(52); var global = __webpack_require__(3); var isObject = __webpack_require__(19); var createNonEnumerableProperty = __webpack_require__(43); var hasOwn = __webpack_require__(38); var shared = __webpack_require__(36); var sharedKey = __webpack_require__(53); var hiddenKeys = __webpack_require__(54); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError = global.TypeError; var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw new TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ store.get = store.get; store.has = store.has; store.set = store.set; /* eslint-enable no-self-assign -- prototype methods protection */ set = function (it, metadata) { if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; store.set(it, metadata); return metadata; }; get = function (it) { return store.get(it) || {}; }; has = function (it) { return store.has(it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var isCallable = __webpack_require__(20); var WeakMap = global.WeakMap; module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap)); /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var shared = __webpack_require__(34); var uid = __webpack_require__(40); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hasOwn = __webpack_require__(38); var ownKeys = __webpack_require__(56); var getOwnPropertyDescriptorModule = __webpack_require__(4); var definePropertyModule = __webpack_require__(44); module.exports = function (target, source, exceptions) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var getOwnPropertyNamesModule = __webpack_require__(57); var getOwnPropertySymbolsModule = __webpack_require__(66); var anObject = __webpack_require__(46); var concat = uncurryThis([].concat); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var internalObjectKeys = __webpack_require__(58); var enumBugKeys = __webpack_require__(65); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var hasOwn = __webpack_require__(38); var toIndexedObject = __webpack_require__(11); var indexOf = __webpack_require__(59).indexOf; var hiddenKeys = __webpack_require__(54); var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn(O, key = names[i++])) { ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIndexedObject = __webpack_require__(11); var toAbsoluteIndex = __webpack_require__(60); var lengthOfArrayLike = __webpack_require__(63); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = lengthOfArrayLike(O); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el !== el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value !== value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(61); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toIntegerOrInfinity(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var trunc = __webpack_require__(62); // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity module.exports = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check return number !== number || number === 0 ? 0 : trunc(number); }; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ceil = Math.ceil; var floor = Math.floor; // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc // eslint-disable-next-line es/no-math-trunc -- safe module.exports = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toLength = __webpack_require__(64); // `LengthOfArrayLike` abstract operation // https://tc39.es/ecma262/#sec-lengthofarraylike module.exports = function (obj) { return toLength(obj.length); }; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(61); var min = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe exports.f = Object.getOwnPropertySymbols; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); var isCallable = __webpack_require__(20); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(8); var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var call = FunctionPrototype.call; // eslint-disable-next-line es/no-reflect -- safe module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { return call.apply(apply, arguments); }); /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var hasOwn = __webpack_require__(38); var createNonEnumerableProperty = __webpack_require__(43); var isPrototypeOf = __webpack_require__(24); var setPrototypeOf = __webpack_require__(70); var copyConstructorProperties = __webpack_require__(55); var proxyAccessor = __webpack_require__(73); var inheritIfRequired = __webpack_require__(74); var normalizeStringArgument = __webpack_require__(75); var installErrorCause = __webpack_require__(79); var installErrorStack = __webpack_require__(80); var DESCRIPTORS = __webpack_require__(5); var IS_PURE = __webpack_require__(35); module.exports = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) { var STACK_TRACE_LIMIT = 'stackTraceLimit'; var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1; var path = FULL_NAME.split('.'); var ERROR_NAME = path[path.length - 1]; var OriginalError = getBuiltIn.apply(null, path); if (!OriginalError) return; var OriginalErrorPrototype = OriginalError.prototype; // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006 if (!IS_PURE && hasOwn(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause; if (!FORCED) return OriginalError; var BaseError = getBuiltIn('Error'); var WrappedError = wrapper(function (a, b) { var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined); var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError(); if (message !== undefined) createNonEnumerableProperty(result, 'message', message); installErrorStack(result, WrappedError, result.stack, 2); if (this && isPrototypeOf(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError); if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]); return result; }); WrappedError.prototype = OriginalErrorPrototype; if (ERROR_NAME !== 'Error') { if (setPrototypeOf) setPrototypeOf(WrappedError, BaseError); else copyConstructorProperties(WrappedError, BaseError, { name: true }); } else if (DESCRIPTORS && STACK_TRACE_LIMIT in OriginalError) { proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT); proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace'); } copyConstructorProperties(WrappedError, OriginalError); if (!IS_PURE) try { // Safari 13- bug: WebAssembly errors does not have a proper `.name` if (OriginalErrorPrototype.name !== ERROR_NAME) { createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME); } OriginalErrorPrototype.constructor = WrappedError; } catch (error) { /* empty */ } return WrappedError; }; /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable no-proto -- safe */ var uncurryThisAccessor = __webpack_require__(71); var anObject = __webpack_require__(46); var aPossiblePrototype = __webpack_require__(72); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es/no-object-setprototypeof -- safe module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set'); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); module.exports = function (object, key, method) { try { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method])); } catch (error) { /* empty */ } }; /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(20); var $String = String; var $TypeError = TypeError; module.exports = function (argument) { if (typeof argument == 'object' || isCallable(argument)) return argument; throw new $TypeError("Can't set " + $String(argument) + ' as a prototype'); }; /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineProperty = __webpack_require__(44).f; module.exports = function (Target, Source, key) { key in Target || defineProperty(Target, key, { configurable: true, get: function () { return Source[key]; }, set: function (it) { Source[key] = it; } }); }; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var setPrototypeOf = __webpack_require__(70); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf($this, NewTargetPrototype); return $this; }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toString = __webpack_require__(76); module.exports = function (argument, $default) { return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument); }; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(77); var $String = String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); return $String(argument); }; /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var TO_STRING_TAG_SUPPORT = __webpack_require__(78); var isCallable = __webpack_require__(20); var classofRaw = __webpack_require__(14); var wellKnownSymbol = __webpack_require__(33); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Object = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(19); var createNonEnumerableProperty = __webpack_require__(43); // `InstallErrorCause` abstract operation // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause module.exports = function (O, options) { if (isObject(options) && 'cause' in options) { createNonEnumerableProperty(O, 'cause', options.cause); } }; /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var createNonEnumerableProperty = __webpack_require__(43); var clearErrorStack = __webpack_require__(81); var ERROR_STACK_INSTALLABLE = __webpack_require__(82); // non-standard V8 var captureStackTrace = Error.captureStackTrace; module.exports = function (error, C, stack, dropEntries) { if (ERROR_STACK_INSTALLABLE) { if (captureStackTrace) captureStackTrace(error, C); else createNonEnumerableProperty(error, 'stack', clearErrorStack(stack, dropEntries)); } }; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var $Error = Error; var replace = uncurryThis(''.replace); var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd'); // eslint-disable-next-line redos/no-vulnerable -- safe var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); module.exports = function (stack, dropEntries) { if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) { while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } return stack; }; /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); var createPropertyDescriptor = __webpack_require__(10); module.exports = !fails(function () { var error = new Error('a'); if (!('stack' in error)) return true; // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); return error.stack !== 7; }); /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(84); /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isPrototypeOf = __webpack_require__(24); var getPrototypeOf = __webpack_require__(85); var setPrototypeOf = __webpack_require__(70); var copyConstructorProperties = __webpack_require__(55); var create = __webpack_require__(87); var createNonEnumerableProperty = __webpack_require__(43); var createPropertyDescriptor = __webpack_require__(10); var installErrorCause = __webpack_require__(79); var installErrorStack = __webpack_require__(80); var iterate = __webpack_require__(91); var normalizeStringArgument = __webpack_require__(75); var wellKnownSymbol = __webpack_require__(33); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Error = Error; var push = [].push; var $AggregateError = function AggregateError(errors, message /* , options */) { var isInstance = isPrototypeOf(AggregateErrorPrototype, this); var that; if (setPrototypeOf) { that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype); } else { that = isInstance ? this : create(AggregateErrorPrototype); createNonEnumerableProperty(that, TO_STRING_TAG, 'Error'); } if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message)); installErrorStack(that, $AggregateError, that.stack, 1); if (arguments.length > 2) installErrorCause(that, arguments[2]); var errorsArray = []; iterate(errors, push, { that: errorsArray }); createNonEnumerableProperty(that, 'errors', errorsArray); return that; }; if (setPrototypeOf) setPrototypeOf($AggregateError, $Error); else copyConstructorProperties($AggregateError, $Error, { name: true }); var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, { constructor: createPropertyDescriptor(1, $AggregateError), message: createPropertyDescriptor(1, ''), name: createPropertyDescriptor(1, 'AggregateError') }); // `AggregateError` constructor // https://tc39.es/ecma262/#sec-aggregate-error-constructor $({ global: true, constructor: true, arity: 2 }, { AggregateError: $AggregateError }); /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hasOwn = __webpack_require__(38); var isCallable = __webpack_require__(20); var toObject = __webpack_require__(39); var sharedKey = __webpack_require__(53); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(86); var IE_PROTO = sharedKey('IE_PROTO'); var $Object = Object; var ObjectPrototype = $Object.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof // eslint-disable-next-line es/no-object-getprototypeof -- safe module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) { var object = toObject(O); if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable(constructor) && object instanceof constructor) { return constructor.prototype; } return object instanceof $Object ? ObjectPrototype : null; }; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; // eslint-disable-next-line es/no-object-getprototypeof -- required for testing return Object.getPrototypeOf(new F()) !== F.prototype; }); /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global ActiveXObject -- old IE, WSH */ var anObject = __webpack_require__(46); var definePropertiesModule = __webpack_require__(88); var enumBugKeys = __webpack_require__(65); var hiddenKeys = __webpack_require__(54); var html = __webpack_require__(90); var documentCreateElement = __webpack_require__(42); var sharedKey = __webpack_require__(53); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create // eslint-disable-next-line es/no-object-create -- safe module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : definePropertiesModule.f(result, Properties); }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(45); var definePropertyModule = __webpack_require__(44); var anObject = __webpack_require__(46); var toIndexedObject = __webpack_require__(11); var objectKeys = __webpack_require__(89); // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var props = toIndexedObject(Properties); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); return O; }; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var internalObjectKeys = __webpack_require__(58); var enumBugKeys = __webpack_require__(65); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); module.exports = getBuiltIn('document', 'documentElement'); /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var tryToString = __webpack_require__(31); var isArrayIteratorMethod = __webpack_require__(94); var lengthOfArrayLike = __webpack_require__(63); var isPrototypeOf = __webpack_require__(24); var getIterator = __webpack_require__(96); var getIteratorMethod = __webpack_require__(97); var iteratorClose = __webpack_require__(98); var $TypeError = TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; module.exports = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_RECORD) { iterator = iterable.iterator; } else if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { result = callFn(iterable[index]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator = getIterator(iterable, iterFn); } next = IS_RECORD ? iterable.next : iterator.next; while (!(step = call(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(93); var aCallable = __webpack_require__(30); var NATIVE_BIND = __webpack_require__(8); var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding module.exports = function (fn, that) { aCallable(fn); return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classofRaw = __webpack_require__(14); var uncurryThis = __webpack_require__(13); module.exports = function (fn) { // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 if (classofRaw(fn) === 'Function') return uncurryThis(fn); }; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); var Iterators = __webpack_require__(95); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var tryToString = __webpack_require__(31); var getIteratorMethod = __webpack_require__(97); var $TypeError = TypeError; module.exports = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); throw new $TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(77); var getMethod = __webpack_require__(29); var isNullOrUndefined = __webpack_require__(16); var Iterators = __webpack_require__(95); var wellKnownSymbol = __webpack_require__(33); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getMethod = __webpack_require__(29); module.exports = function (iterator, kind, value) { var innerResult, innerError; anObject(iterator); try { innerResult = getMethod(iterator, 'return'); if (!innerResult) { if (kind === 'throw') throw value; return value; } innerResult = call(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; } if (kind === 'throw') throw value; if (innerError) throw innerResult; anObject(innerResult); return value; }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var apply = __webpack_require__(68); var fails = __webpack_require__(6); var wrapErrorConstructorWithCause = __webpack_require__(69); var AGGREGATE_ERROR = 'AggregateError'; var $AggregateError = getBuiltIn(AGGREGATE_ERROR); var FORCED = !fails(function () { return $AggregateError([1]).errors[0] !== 1; }) && fails(function () { return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7; }); // https://tc39.es/ecma262/#sec-aggregate-error $({ global: true, constructor: true, arity: 2, forced: FORCED }, { AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) { // eslint-disable-next-line no-unused-vars -- required for functions `.length` return function AggregateError(errors, message) { return apply(init, this, arguments); }; }, FORCED, true) }); /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var toIntegerOrInfinity = __webpack_require__(61); var addToUnscopables = __webpack_require__(101); // `Array.prototype.at` method // https://tc39.es/ecma262/#sec-array.prototype.at $({ target: 'Array', proto: true }, { at: function at(index) { var O = toObject(this); var len = lengthOfArrayLike(O); var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; return (k < 0 || k >= len) ? undefined : O[k]; } }); addToUnscopables('at'); /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); var create = __webpack_require__(87); var defineProperty = __webpack_require__(44).f; var UNSCOPABLES = wellKnownSymbol('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] === undefined) { defineProperty(ArrayPrototype, UNSCOPABLES, { configurable: true, value: create(null) }); } // add a key to Array.prototype[@@unscopables] module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $findLast = __webpack_require__(103).findLast; var addToUnscopables = __webpack_require__(101); // `Array.prototype.findLast` method // https://tc39.es/ecma262/#sec-array.prototype.findlast $({ target: 'Array', proto: true }, { findLast: function findLast(callbackfn /* , that = undefined */) { return $findLast(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); addToUnscopables('findLast'); /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var IndexedObject = __webpack_require__(12); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); // `Array.prototype.{ findLast, findLastIndex }` methods implementation var createMethod = function (TYPE) { var IS_FIND_LAST_INDEX = TYPE === 1; return function ($this, callbackfn, that) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var index = lengthOfArrayLike(self); var value, result; while (index-- > 0) { value = self[index]; result = boundFunction(value, index, O); if (result) switch (TYPE) { case 0: return value; // findLast case 1: return index; // findLastIndex } } return IS_FIND_LAST_INDEX ? -1 : undefined; }; }; module.exports = { // `Array.prototype.findLast` method // https://github.com/tc39/proposal-array-find-from-last findLast: createMethod(0), // `Array.prototype.findLastIndex` method // https://github.com/tc39/proposal-array-find-from-last findLastIndex: createMethod(1) }; /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $findLastIndex = __webpack_require__(103).findLastIndex; var addToUnscopables = __webpack_require__(101); // `Array.prototype.findLastIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findlastindex $({ target: 'Array', proto: true }, { findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) { return $findLastIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); addToUnscopables('findLastIndex'); /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var setArrayLength = __webpack_require__(106); var doesNotExceedSafeInteger = __webpack_require__(108); var fails = __webpack_require__(6); var INCORRECT_TO_LENGTH = fails(function () { return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; }); // V8 and Safari <= 15.4, FF < 23 throws InternalError // https://bugs.chromium.org/p/v8/issues/detail?id=12681 var properErrorOnNonWritableLength = function () { try { // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty([], 'length', { writable: false }).push(); } catch (error) { return error instanceof TypeError; } }; var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength(); // `Array.prototype.push` method // https://tc39.es/ecma262/#sec-array.prototype.push $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, { // eslint-disable-next-line no-unused-vars -- required for `.length` push: function push(item) { var O = toObject(this); var len = lengthOfArrayLike(O); var argCount = arguments.length; doesNotExceedSafeInteger(len + argCount); for (var i = 0; i < argCount; i++) { O[len] = arguments[i]; len++; } setArrayLength(O, len); return len; } }); /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var isArray = __webpack_require__(107); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Safari < 13 does not throw an error in this case var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () { // makes no sense without proper strict mode support if (this !== undefined) return true; try { // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty([], 'length', { writable: false }).length = 1; } catch (error) { return error instanceof TypeError; } }(); module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) { if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) { throw new $TypeError('Cannot set read only .length'); } return O.length = length; } : function (O, length) { return O.length = length; }; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(14); // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe module.exports = Array.isArray || function isArray(argument) { return classof(argument) === 'Array'; }; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $TypeError = TypeError; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 module.exports = function (it) { if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded'); return it; }; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var arrayToReversed = __webpack_require__(110); var toIndexedObject = __webpack_require__(11); var addToUnscopables = __webpack_require__(101); var $Array = Array; // `Array.prototype.toReversed` method // https://tc39.es/ecma262/#sec-array.prototype.toreversed $({ target: 'Array', proto: true }, { toReversed: function toReversed() { return arrayToReversed(toIndexedObject(this), $Array); } }); addToUnscopables('toReversed'); /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var lengthOfArrayLike = __webpack_require__(63); // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed module.exports = function (O, C) { var len = lengthOfArrayLike(O); var A = new C(len); var k = 0; for (; k < len; k++) A[k] = O[len - k - 1]; return A; }; /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); var toIndexedObject = __webpack_require__(11); var arrayFromConstructorAndList = __webpack_require__(112); var getBuiltInPrototypeMethod = __webpack_require__(113); var addToUnscopables = __webpack_require__(101); var $Array = Array; var sort = uncurryThis(getBuiltInPrototypeMethod('Array', 'sort')); // `Array.prototype.toSorted` method // https://tc39.es/ecma262/#sec-array.prototype.tosorted $({ target: 'Array', proto: true }, { toSorted: function toSorted(compareFn) { if (compareFn !== undefined) aCallable(compareFn); var O = toIndexedObject(this); var A = arrayFromConstructorAndList($Array, O); return sort(A, compareFn); } }); addToUnscopables('toSorted'); /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var lengthOfArrayLike = __webpack_require__(63); module.exports = function (Constructor, list) { var index = 0; var length = lengthOfArrayLike(list); var result = new Constructor(length); while (length > index) result[index] = list[index++]; return result; }; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); module.exports = function (CONSTRUCTOR, METHOD) { var Constructor = global[CONSTRUCTOR]; var Prototype = Constructor && Constructor.prototype; return Prototype && Prototype[METHOD]; }; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var addToUnscopables = __webpack_require__(101); var doesNotExceedSafeInteger = __webpack_require__(108); var lengthOfArrayLike = __webpack_require__(63); var toAbsoluteIndex = __webpack_require__(60); var toIndexedObject = __webpack_require__(11); var toIntegerOrInfinity = __webpack_require__(61); var $Array = Array; var max = Math.max; var min = Math.min; // `Array.prototype.toSpliced` method // https://tc39.es/ecma262/#sec-array.prototype.tospliced $({ target: 'Array', proto: true }, { toSpliced: function toSpliced(start, deleteCount /* , ...items */) { var O = toIndexedObject(this); var len = lengthOfArrayLike(O); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; var k = 0; var insertCount, actualDeleteCount, newLen, A; if (argumentsLength === 0) { insertCount = actualDeleteCount = 0; } else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); } newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount); A = $Array(newLen); for (; k < actualStart; k++) A[k] = O[k]; for (; k < actualStart + insertCount; k++) A[k] = arguments[k - actualStart + 2]; for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount]; return A; } }); addToUnscopables('toSpliced'); /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var arrayWith = __webpack_require__(116); var toIndexedObject = __webpack_require__(11); var $Array = Array; // `Array.prototype.with` method // https://tc39.es/ecma262/#sec-array.prototype.with $({ target: 'Array', proto: true }, { 'with': function (index, value) { return arrayWith(toIndexedObject(this), $Array, index, value); } }); /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var lengthOfArrayLike = __webpack_require__(63); var toIntegerOrInfinity = __webpack_require__(61); var $RangeError = RangeError; // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with module.exports = function (O, C, index, value) { var len = lengthOfArrayLike(O); var relativeIndex = toIntegerOrInfinity(index); var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex; if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index'); var A = new C(len); var k = 0; for (; k < len; k++) A[k] = k === actualIndex ? value : O[k]; return A; }; /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var hasOwn = __webpack_require__(38); // `Object.hasOwn` method // https://tc39.es/ecma262/#sec-object.hasown $({ target: 'Object', stat: true }, { hasOwn: hasOwn }); /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var defineBuiltInAccessor = __webpack_require__(119); var isObject = __webpack_require__(19); var toObject = __webpack_require__(39); var requireObjectCoercible = __webpack_require__(15); // eslint-disable-next-line es/no-object-getprototypeof -- safe var getPrototypeOf = Object.getPrototypeOf; // eslint-disable-next-line es/no-object-setprototypeof -- safe var setPrototypeOf = Object.setPrototypeOf; var ObjectPrototype = Object.prototype; var PROTO = '__proto__'; // `Object.prototype.__proto__` accessor // https://tc39.es/ecma262/#sec-object.prototype.__proto__ if (DESCRIPTORS && getPrototypeOf && setPrototypeOf && !(PROTO in ObjectPrototype)) try { defineBuiltInAccessor(ObjectPrototype, PROTO, { configurable: true, get: function __proto__() { return getPrototypeOf(toObject(this)); }, set: function __proto__(proto) { var O = requireObjectCoercible(this); if (!isObject(proto) && proto !== null || !isObject(O)) return; setPrototypeOf(O, proto); } }); } catch (error) { /* empty */ } /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var makeBuiltIn = __webpack_require__(48); var defineProperty = __webpack_require__(44); module.exports = function (target, name, descriptor) { if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true }); if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true }); return defineProperty.f(target, name, descriptor); }; /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(121); __webpack_require__(144); __webpack_require__(147); __webpack_require__(148); __webpack_require__(149); __webpack_require__(150); /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var IS_PURE = __webpack_require__(35); var IS_NODE = __webpack_require__(122); var global = __webpack_require__(3); var call = __webpack_require__(7); var defineBuiltIn = __webpack_require__(47); var setPrototypeOf = __webpack_require__(70); var setToStringTag = __webpack_require__(123); var setSpecies = __webpack_require__(124); var aCallable = __webpack_require__(30); var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var anInstance = __webpack_require__(125); var speciesConstructor = __webpack_require__(126); var task = __webpack_require__(129).set; var microtask = __webpack_require__(133); var hostReportErrors = __webpack_require__(137); var perform = __webpack_require__(138); var Queue = __webpack_require__(134); var InternalStateModule = __webpack_require__(51); var NativePromiseConstructor = __webpack_require__(139); var PromiseConstructorDetection = __webpack_require__(140); var newPromiseCapabilityModule = __webpack_require__(143); var PROMISE = 'Promise'; var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR; var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT; var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING; var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); var setInternalState = InternalStateModule.set; var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var PromiseConstructor = NativePromiseConstructor; var PromisePrototype = NativePromisePrototype; var TypeError = global.TypeError; var document = global.document; var process = global.process; var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; var FULFILLED = 1; var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; // helpers var isThenable = function (it) { var then; return isObject(it) && isCallable(then = it.then) ? then : false; }; var callReaction = function (reaction, state) { var value = state.value; var ok = state.state === FULFILLED; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // can throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(new TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { call(then, result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { if (domain && !exited) domain.exit(); reject(error); } }; var notify = function (state, isReject) { if (state.notified) return; state.notified = true; microtask(function () { var reactions = state.reactions; var reaction; while (reaction = reactions.get()) { callReaction(reaction, state); } state.notified = false; if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { event = document.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global.dispatchEvent(event); } else event = { promise: promise, reason: reason }; if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { call(task, global, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { if (IS_NODE) { process.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); }; var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; var onHandleUnhandled = function (state) { call(task, global, function () { var promise = state.facade; if (IS_NODE) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; var bind = function (fn, state, unwrap) { return function (value) { fn(state, value, unwrap); }; }; var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; notify(state, true); }; var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { if (state.facade === value) throw new TypeError("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state) ); } catch (error) { internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; notify(state, false); } } catch (error) { internalReject({ done: false }, error, state); } }; // constructor polyfill if (FORCED_PROMISE_CONSTRUCTOR) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromisePrototype); aCallable(executor); call(Internal, this); var state = getInternalPromiseState(this); try { executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { internalReject(state, error); } }; PromisePrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { setInternalState(this, { type: PROMISE, done: false, notified: false, parent: false, reactions: new Queue(), rejection: false, state: PENDING, value: undefined }); }; // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); state.parent = true; reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; reaction.fail = isCallable(onRejected) && onRejected; reaction.domain = IS_NODE ? process.domain : undefined; if (state.state === PENDING) state.reactions.add(reaction); else microtask(function () { callReaction(reaction, state); }); return reaction.promise; }); OwnPromiseCapability = function () { var promise = new Internal(); var state = getInternalPromiseState(promise); this.promise = promise; this.resolve = bind(internalResolve, state); this.reject = bind(internalReject, state); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) { nativeThen = NativePromisePrototype.then; if (!NATIVE_PROMISE_SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { call(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { delete NativePromisePrototype.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (setPrototypeOf) { setPrototypeOf(NativePromisePrototype, PromisePrototype); } } } $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false, true); setSpecies(PROMISE); /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var classof = __webpack_require__(14); module.exports = classof(global.process) === 'process'; /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineProperty = __webpack_require__(44).f; var hasOwn = __webpack_require__(38); var wellKnownSymbol = __webpack_require__(33); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (target, TAG, STATIC) { if (target && !STATIC) target = target.prototype; if (target && !hasOwn(target, TO_STRING_TAG)) { defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG }); } }; /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var defineBuiltInAccessor = __webpack_require__(119); var wellKnownSymbol = __webpack_require__(33); var DESCRIPTORS = __webpack_require__(5); var SPECIES = wellKnownSymbol('species'); module.exports = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn(CONSTRUCTOR_NAME); if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { defineBuiltInAccessor(Constructor, SPECIES, { configurable: true, get: function () { return this; } }); } }; /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isPrototypeOf = __webpack_require__(24); var $TypeError = TypeError; module.exports = function (it, Prototype) { if (isPrototypeOf(Prototype, it)) return it; throw new $TypeError('Incorrect invocation'); }; /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(46); var aConstructor = __webpack_require__(127); var isNullOrUndefined = __webpack_require__(16); var wellKnownSymbol = __webpack_require__(33); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S); }; /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isConstructor = __webpack_require__(128); var tryToString = __webpack_require__(31); var $TypeError = TypeError; // `Assert: IsConstructor(argument) is true` module.exports = function (argument) { if (isConstructor(argument)) return argument; throw new $TypeError(tryToString(argument) + ' is not a constructor'); }; /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var fails = __webpack_require__(6); var isCallable = __webpack_require__(20); var classof = __webpack_require__(77); var getBuiltIn = __webpack_require__(23); var inspectSource = __webpack_require__(50); var noop = function () { /* empty */ }; var empty = []; var construct = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.test(noop); var isConstructorModern = function isConstructor(argument) { if (!isCallable(argument)) return false; try { construct(noop, empty, argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor(argument) { if (!isCallable(argument)) return false; switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; } try { // we can't check .prototype since constructors produced by .bind haven't it // `Function#toString` throws on some built-it function in some legacy engines // (for example, `DOMQuad` and similar in FF41-) return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor module.exports = !construct || fails(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var apply = __webpack_require__(68); var bind = __webpack_require__(92); var isCallable = __webpack_require__(20); var hasOwn = __webpack_require__(38); var fails = __webpack_require__(6); var html = __webpack_require__(90); var arraySlice = __webpack_require__(130); var createElement = __webpack_require__(42); var validateArgumentsLength = __webpack_require__(131); var IS_IOS = __webpack_require__(132); var IS_NODE = __webpack_require__(122); var set = global.setImmediate; var clear = global.clearImmediate; var process = global.process; var Dispatch = global.Dispatch; var Function = global.Function; var MessageChannel = global.MessageChannel; var String = global.String; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var $location, defer, channel, port; fails(function () { // Deno throws a ReferenceError on `location` access without `--location` flag $location = global.location; }); var run = function (id) { if (hasOwn(queue, id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var eventListener = function (event) { run(event.data); }; var globalPostMessageDefer = function (id) { // old engines have not location.origin global.postMessage(String(id), $location.protocol + '//' + $location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(handler) { validateArgumentsLength(arguments.length, 1); var fn = isCallable(handler) ? handler : Function(handler); var args = arraySlice(arguments, 1); queue[++counter] = function () { apply(fn, undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (IS_NODE) { defer = function (id) { process.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel && !IS_IOS) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = eventListener; defer = bind(port.postMessage, port); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( global.addEventListener && isCallable(global.postMessage) && !global.importScripts && $location && $location.protocol !== 'file:' && !fails(globalPostMessageDefer) ) { defer = globalPostMessageDefer; global.addEventListener('message', eventListener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(runner(id), 0); }; } } module.exports = { set: set, clear: clear }; /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); module.exports = uncurryThis([].slice); /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $TypeError = TypeError; module.exports = function (passed, required) { if (passed < required) throw new $TypeError('Not enough arguments'); return passed; }; /***/ }), /* 132 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var userAgent = __webpack_require__(28); // eslint-disable-next-line redos/no-vulnerable -- safe module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent); /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var bind = __webpack_require__(92); var getOwnPropertyDescriptor = __webpack_require__(4).f; var macrotask = __webpack_require__(129).set; var Queue = __webpack_require__(134); var IS_IOS = __webpack_require__(132); var IS_IOS_PEBBLE = __webpack_require__(135); var IS_WEBOS_WEBKIT = __webpack_require__(136); var IS_NODE = __webpack_require__(122); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var document = global.document; var process = global.process; var Promise = global.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); var microtask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var notify, toggle, node, promise, then; // modern engines have queueMicrotask method if (!microtask) { var queue = new Queue(); var flush = function () { var parent, fn; if (IS_NODE && (parent = process.domain)) parent.exit(); while (fn = queue.get()) try { fn(); } catch (error) { if (queue.head) notify(); throw error; } if (parent) parent.enter(); }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) { toggle = true; node = document.createTextNode(''); new MutationObserver(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 promise = Promise.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug promise.constructor = Promise; then = bind(promise.then, promise); notify = function () { then(flush); }; // Node.js without promises } else if (IS_NODE) { notify = function () { process.nextTick(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessage // - onreadystatechange // - setTimeout } else { // `webpack` dev server bug on IE global methods - use bind(fn, global) macrotask = bind(macrotask, global); notify = function () { macrotask(flush); }; } microtask = function (fn) { if (!queue.head) notify(); queue.add(fn); }; } module.exports = microtask; /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var Queue = function () { this.head = null; this.tail = null; }; Queue.prototype = { add: function (item) { var entry = { item: item, next: null }; var tail = this.tail; if (tail) tail.next = entry; else this.head = entry; this.tail = entry; }, get: function () { var entry = this.head; if (entry) { var next = this.head = entry.next; if (next === null) this.tail = null; return entry.item; } } }; module.exports = Queue; /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var userAgent = __webpack_require__(28); module.exports = /ipad|iphone|ipod/i.test(userAgent) && typeof Pebble != 'undefined'; /***/ }), /* 136 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var userAgent = __webpack_require__(28); module.exports = /web0s(?!.*chrome)/i.test(userAgent); /***/ }), /* 137 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (a, b) { try { // eslint-disable-next-line no-console -- safe arguments.length === 1 ? console.error(a) : console.error(a, b); } catch (error) { /* empty */ } }; /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; /***/ }), /* 139 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); module.exports = global.Promise; /***/ }), /* 140 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var NativePromiseConstructor = __webpack_require__(139); var isCallable = __webpack_require__(20); var isForced = __webpack_require__(67); var inspectSource = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(33); var IS_BROWSER = __webpack_require__(141); var IS_DENO = __webpack_require__(142); var IS_PURE = __webpack_require__(35); var V8_VERSION = __webpack_require__(27); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var SPECIES = wellKnownSymbol('species'); var SUBCLASSING = false; var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor); var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { // Detect correctness of subclassing with @@species support var promise = new NativePromiseConstructor(function (resolve) { resolve(1); }); var FakePromise = function (exec) { exec(function () { /* empty */ }, function () { /* empty */ }); }; var constructor = promise.constructor = {}; constructor[SPECIES] = FakePromise; SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; if (!SUBCLASSING) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT; }); module.exports = { CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR, REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT, SUBCLASSING: SUBCLASSING }; /***/ }), /* 141 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_DENO = __webpack_require__(142); var IS_NODE = __webpack_require__(122); module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object'; /***/ }), /* 142 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global Deno -- Deno case */ module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; /***/ }), /* 143 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(30); var $TypeError = TypeError; var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aCallable(resolve); this.reject = aCallable(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var newPromiseCapabilityModule = __webpack_require__(143); var perform = __webpack_require__(138); var iterate = __webpack_require__(91); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(145); // `Promise.all` method // https://tc39.es/ecma262/#sec-promise.all $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { all: function all(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 145 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NativePromiseConstructor = __webpack_require__(139); var checkCorrectnessOfIteration = __webpack_require__(146); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(140).CONSTRUCTOR; module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) { NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ }); }); /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); var ITERATOR = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR] = function () { return this; }; // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } module.exports = function (exec, SKIP_CLOSING) { try { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; } catch (error) { return false; } // workaround of old WebKit + `eval` bug var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var IS_PURE = __webpack_require__(35); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(140).CONSTRUCTOR; var NativePromiseConstructor = __webpack_require__(139); var getBuiltIn = __webpack_require__(23); var isCallable = __webpack_require__(20); var defineBuiltIn = __webpack_require__(47); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; // `Promise.prototype.catch` method // https://tc39.es/ecma262/#sec-promise.prototype.catch $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, { 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` if (!IS_PURE && isCallable(NativePromiseConstructor)) { var method = getBuiltIn('Promise').prototype['catch']; if (NativePromisePrototype['catch'] !== method) { defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true }); } } /***/ }), /* 148 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var newPromiseCapabilityModule = __webpack_require__(143); var perform = __webpack_require__(138); var iterate = __webpack_require__(91); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(145); // `Promise.race` method // https://tc39.es/ecma262/#sec-promise.race $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { race: function race(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); iterate(iterable, function (promise) { call($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var newPromiseCapabilityModule = __webpack_require__(143); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(140).CONSTRUCTOR; // `Promise.reject` method // https://tc39.es/ecma262/#sec-promise.reject $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { reject: function reject(r) { var capability = newPromiseCapabilityModule.f(this); call(capability.reject, undefined, r); return capability.promise; } }); /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var IS_PURE = __webpack_require__(35); var NativePromiseConstructor = __webpack_require__(139); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(140).CONSTRUCTOR; var promiseResolve = __webpack_require__(151); var PromiseConstructorWrapper = getBuiltIn('Promise'); var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR; // `Promise.resolve` method // https://tc39.es/ecma262/#sec-promise.resolve $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, { resolve: function resolve(x) { return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x); } }); /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var newPromiseCapability = __webpack_require__(143); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var newPromiseCapabilityModule = __webpack_require__(143); var perform = __webpack_require__(138); var iterate = __webpack_require__(91); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(145); // `Promise.allSettled` method // https://tc39.es/ecma262/#sec-promise.allsettled $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { allSettled: function allSettled(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call(promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; --remaining || resolve(values); }, function (error) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'rejected', reason: error }; --remaining || resolve(values); }); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var getBuiltIn = __webpack_require__(23); var newPromiseCapabilityModule = __webpack_require__(143); var perform = __webpack_require__(138); var iterate = __webpack_require__(91); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(145); var PROMISE_ANY_ERROR = 'No one promise resolved'; // `Promise.any` method // https://tc39.es/ecma262/#sec-promise.any $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { any: function any(iterable) { var C = this; var AggregateError = getBuiltIn('AggregateError'); var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aCallable(C.resolve); var errors = []; var counter = 0; var remaining = 1; var alreadyResolved = false; iterate(iterable, function (promise) { var index = counter++; var alreadyRejected = false; remaining++; call(promiseResolve, C, promise).then(function (value) { if (alreadyRejected || alreadyResolved) return; alreadyResolved = true; resolve(value); }, function (error) { if (alreadyRejected || alreadyResolved) return; alreadyRejected = true; errors[index] = error; --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); }); --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var IS_PURE = __webpack_require__(35); var NativePromiseConstructor = __webpack_require__(139); var fails = __webpack_require__(6); var getBuiltIn = __webpack_require__(23); var isCallable = __webpack_require__(20); var speciesConstructor = __webpack_require__(126); var promiseResolve = __webpack_require__(151); var defineBuiltIn = __webpack_require__(47); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromiseConstructor && fails(function () { // eslint-disable-next-line unicorn/no-thenable -- required for testing NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method // https://tc39.es/ecma262/#sec-promise.prototype.finally $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); var isFunction = isCallable(onFinally); return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` if (!IS_PURE && isCallable(NativePromiseConstructor)) { var method = getBuiltIn('Promise').prototype['finally']; if (NativePromisePrototype['finally'] !== method) { defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true }); } } /***/ }), /* 155 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var setToStringTag = __webpack_require__(123); $({ global: true }, { Reflect: {} }); // Reflect[@@toStringTag] property // https://tc39.es/ecma262/#sec-reflect-@@tostringtag setToStringTag(global.Reflect, 'Reflect', true); /***/ }), /* 156 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var DESCRIPTORS = __webpack_require__(5); var defineBuiltInAccessor = __webpack_require__(119); var regExpFlags = __webpack_require__(157); var fails = __webpack_require__(6); // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError var RegExp = global.RegExp; var RegExpPrototype = RegExp.prototype; var FORCED = DESCRIPTORS && fails(function () { var INDICES_SUPPORT = true; try { RegExp('.', 'd'); } catch (error) { INDICES_SUPPORT = false; } var O = {}; // modern V8 bug var calls = ''; var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; var addGetter = function (key, chr) { // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty(O, key, { get: function () { calls += chr; return true; } }); }; var pairs = { dotAll: 's', global: 'g', ignoreCase: 'i', multiline: 'm', sticky: 'y' }; if (INDICES_SUPPORT) pairs.hasIndices = 'd'; for (var key in pairs) addGetter(key, pairs[key]); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var result = Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call(O); return result !== expected || calls !== expected; }); // `RegExp.prototype.flags` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags if (FORCED) defineBuiltInAccessor(RegExpPrototype, 'flags', { configurable: true, get: regExpFlags }); /***/ }), /* 157 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(46); // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags module.exports = function () { var that = anObject(this); var result = ''; if (that.hasIndices) result += 'd'; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.unicodeSets) result += 'v'; if (that.sticky) result += 'y'; return result; }; /***/ }), /* 158 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var requireObjectCoercible = __webpack_require__(15); var toIntegerOrInfinity = __webpack_require__(61); var toString = __webpack_require__(76); var fails = __webpack_require__(6); var charAt = uncurryThis(''.charAt); var FORCED = fails(function () { // eslint-disable-next-line es/no-array-string-prototype-at -- safe return '𠮷'.at(-2) !== '\uD842'; }); // `String.prototype.at` method // https://tc39.es/ecma262/#sec-string.prototype.at $({ target: 'String', proto: true, forced: FORCED }, { at: function at(index) { var S = toString(requireObjectCoercible(this)); var len = S.length; var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; return (k < 0 || k >= len) ? undefined : charAt(S, k); } }); /***/ }), /* 159 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var requireObjectCoercible = __webpack_require__(15); var toString = __webpack_require__(76); var charCodeAt = uncurryThis(''.charCodeAt); // `String.prototype.isWellFormed` method // https://github.com/tc39/proposal-is-usv-string $({ target: 'String', proto: true }, { isWellFormed: function isWellFormed() { var S = toString(requireObjectCoercible(this)); var length = S.length; for (var i = 0; i < length; i++) { var charCode = charCodeAt(S, i); // single UTF-16 code unit if ((charCode & 0xF800) !== 0xD800) continue; // unpaired surrogate if (charCode >= 0xDC00 || ++i >= length || (charCodeAt(S, i) & 0xFC00) !== 0xDC00) return false; } return true; } }); /***/ }), /* 160 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var uncurryThis = __webpack_require__(13); var requireObjectCoercible = __webpack_require__(15); var isCallable = __webpack_require__(20); var isNullOrUndefined = __webpack_require__(16); var isRegExp = __webpack_require__(161); var toString = __webpack_require__(76); var getMethod = __webpack_require__(29); var getRegExpFlags = __webpack_require__(162); var getSubstitution = __webpack_require__(163); var wellKnownSymbol = __webpack_require__(33); var IS_PURE = __webpack_require__(35); var REPLACE = wellKnownSymbol('replace'); var $TypeError = TypeError; var indexOf = uncurryThis(''.indexOf); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); var max = Math.max; var stringIndexOf = function (string, searchValue, fromIndex) { if (fromIndex > string.length) return -1; if (searchValue === '') return fromIndex; return indexOf(string, searchValue, fromIndex); }; // `String.prototype.replaceAll` method // https://tc39.es/ecma262/#sec-string.prototype.replaceall $({ target: 'String', proto: true }, { replaceAll: function replaceAll(searchValue, replaceValue) { var O = requireObjectCoercible(this); var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement; var position = 0; var endOfLastMatch = 0; var result = ''; if (!isNullOrUndefined(searchValue)) { IS_REG_EXP = isRegExp(searchValue); if (IS_REG_EXP) { flags = toString(requireObjectCoercible(getRegExpFlags(searchValue))); if (!~indexOf(flags, 'g')) throw new $TypeError('`.replaceAll` does not allow non-global regexes'); } replacer = getMethod(searchValue, REPLACE); if (replacer) { return call(replacer, searchValue, O, replaceValue); } else if (IS_PURE && IS_REG_EXP) { return replace(toString(O), searchValue, replaceValue); } } string = toString(O); searchString = toString(searchValue); functionalReplace = isCallable(replaceValue); if (!functionalReplace) replaceValue = toString(replaceValue); searchLength = searchString.length; advanceBy = max(1, searchLength); position = stringIndexOf(string, searchString, 0); while (position !== -1) { replacement = functionalReplace ? toString(replaceValue(searchString, position, string)) : getSubstitution(searchString, string, position, [], undefined, replaceValue); result += stringSlice(string, endOfLastMatch, position) + replacement; endOfLastMatch = position + searchLength; position = stringIndexOf(string, searchString, position + advanceBy); } if (endOfLastMatch < string.length) { result += stringSlice(string, endOfLastMatch); } return result; } }); /***/ }), /* 161 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(19); var classof = __webpack_require__(14); var wellKnownSymbol = __webpack_require__(33); var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation // https://tc39.es/ecma262/#sec-isregexp module.exports = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === 'RegExp'); }; /***/ }), /* 162 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var hasOwn = __webpack_require__(38); var isPrototypeOf = __webpack_require__(24); var regExpFlags = __webpack_require__(157); var RegExpPrototype = RegExp.prototype; module.exports = function (R) { var flags = R.flags; return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags; }; /***/ }), /* 163 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var toObject = __webpack_require__(39); var floor = Math.floor; var charAt = uncurryThis(''.charAt); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); // eslint-disable-next-line redos/no-vulnerable -- safe var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // https://tc39.es/ecma262/#sec-getsubstitution module.exports = function (matched, str, position, captures, namedCaptures, replacement) { var tailPos = position + matched.length; var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace(replacement, symbols, function (match, ch) { var capture; switch (charAt(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice(str, 0, position); case "'": return stringSlice(str, tailPos); case '<': capture = namedCaptures[stringSlice(ch, 1, -1)]; break; default: // \d\d? var n = +ch; if (n === 0) return match; if (n > m) { var f = floor(n / 10); if (f === 0) return match; if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); return match; } capture = captures[n - 1]; } return capture === undefined ? '' : capture; }); }; /***/ }), /* 164 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var uncurryThis = __webpack_require__(13); var requireObjectCoercible = __webpack_require__(15); var toString = __webpack_require__(76); var fails = __webpack_require__(6); var $Array = Array; var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var join = uncurryThis([].join); // eslint-disable-next-line es/no-string-prototype-iswellformed-towellformed -- safe var $toWellFormed = ''.toWellFormed; var REPLACEMENT_CHARACTER = '\uFFFD'; // Safari bug var TO_STRING_CONVERSION_BUG = $toWellFormed && fails(function () { return call($toWellFormed, 1) !== '1'; }); // `String.prototype.toWellFormed` method // https://github.com/tc39/proposal-is-usv-string $({ target: 'String', proto: true, forced: TO_STRING_CONVERSION_BUG }, { toWellFormed: function toWellFormed() { var S = toString(requireObjectCoercible(this)); if (TO_STRING_CONVERSION_BUG) return call($toWellFormed, S); var length = S.length; var result = $Array(length); for (var i = 0; i < length; i++) { var charCode = charCodeAt(S, i); // single UTF-16 code unit if ((charCode & 0xF800) !== 0xD800) result[i] = charAt(S, i); // unpaired surrogate else if (charCode >= 0xDC00 || i + 1 >= length || (charCodeAt(S, i + 1) & 0xFC00) !== 0xDC00) result[i] = REPLACEMENT_CHARACTER; // surrogate pair else { result[i] = charAt(S, i); result[++i] = charAt(S, i); } } return join(result, ''); } }); /***/ }), /* 165 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var lengthOfArrayLike = __webpack_require__(63); var toIntegerOrInfinity = __webpack_require__(61); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.at` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.at exportTypedArrayMethod('at', function at(index) { var O = aTypedArray(this); var len = lengthOfArrayLike(O); var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; return (k < 0 || k >= len) ? undefined : O[k]; }); /***/ }), /* 166 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_ARRAY_BUFFER = __webpack_require__(167); var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var hasOwn = __webpack_require__(38); var classof = __webpack_require__(77); var tryToString = __webpack_require__(31); var createNonEnumerableProperty = __webpack_require__(43); var defineBuiltIn = __webpack_require__(47); var defineBuiltInAccessor = __webpack_require__(119); var isPrototypeOf = __webpack_require__(24); var getPrototypeOf = __webpack_require__(85); var setPrototypeOf = __webpack_require__(70); var wellKnownSymbol = __webpack_require__(33); var uid = __webpack_require__(40); var InternalStateModule = __webpack_require__(51); var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var Uint8ClampedArray = global.Uint8ClampedArray; var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; var TypedArray = Int8Array && getPrototypeOf(Int8Array); var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); var ObjectPrototype = Object.prototype; var TypeError = global.TypeError; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor'; // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; var TYPED_ARRAY_TAG_REQUIRED = false; var NAME, Constructor, Prototype; var TypedArrayConstructorsList = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var BigIntArrayConstructorsList = { BigInt64Array: 8, BigUint64Array: 8 }; var isView = function isView(it) { if (!isObject(it)) return false; var klass = classof(it); return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass); }; var getTypedArrayConstructor = function (it) { var proto = getPrototypeOf(it); if (!isObject(proto)) return; var state = getInternalState(proto); return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto); }; var isTypedArray = function (it) { if (!isObject(it)) return false; var klass = classof(it); return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass); }; var aTypedArray = function (it) { if (isTypedArray(it)) return it; throw new TypeError('Target is not a typed array'); }; var aTypedArrayConstructor = function (C) { if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C; throw new TypeError(tryToString(C) + ' is not a typed array constructor'); }; var exportTypedArrayMethod = function (KEY, property, forced, options) { if (!DESCRIPTORS) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try { delete TypedArrayConstructor.prototype[KEY]; } catch (error) { // old WebKit bug - some methods are non-configurable try { TypedArrayConstructor.prototype[KEY] = property; } catch (error2) { /* empty */ } } } if (!TypedArrayPrototype[KEY] || forced) { defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options); } }; var exportTypedArrayStaticMethod = function (KEY, property, forced) { var ARRAY, TypedArrayConstructor; if (!DESCRIPTORS) return; if (setPrototypeOf) { if (forced) for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try { delete TypedArrayConstructor[KEY]; } catch (error) { /* empty */ } } if (!TypedArray[KEY] || forced) { // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable try { return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property); } catch (error) { /* empty */ } } else return; } for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { defineBuiltIn(TypedArrayConstructor, KEY, property); } } }; for (NAME in TypedArrayConstructorsList) { Constructor = global[NAME]; Prototype = Constructor && Constructor.prototype; if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; else NATIVE_ARRAY_BUFFER_VIEWS = false; } for (NAME in BigIntArrayConstructorsList) { Constructor = global[NAME]; Prototype = Constructor && Constructor.prototype; if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; } // WebKit bug - typed arrays constructors prototype is Object.prototype if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow -- safe TypedArray = function TypedArray() { throw new TypeError('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME], TypedArray); } } if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { TypedArrayPrototype = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); } } // WebKit bug - one more object in Uint8ClampedArray prototype chain if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); } if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) { TYPED_ARRAY_TAG_REQUIRED = true; defineBuiltInAccessor(TypedArrayPrototype, TO_STRING_TAG, { configurable: true, get: function () { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); for (NAME in TypedArrayConstructorsList) if (global[NAME]) { createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME); } } module.exports = { NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG, aTypedArray: aTypedArray, aTypedArrayConstructor: aTypedArrayConstructor, exportTypedArrayMethod: exportTypedArrayMethod, exportTypedArrayStaticMethod: exportTypedArrayStaticMethod, getTypedArrayConstructor: getTypedArrayConstructor, isView: isView, isTypedArray: isTypedArray, TypedArray: TypedArray, TypedArrayPrototype: TypedArrayPrototype }; /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // eslint-disable-next-line es/no-typed-arrays -- safe module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; /***/ }), /* 168 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var $findLast = __webpack_require__(103).findLast; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findLast` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlast exportTypedArrayMethod('findLast', function findLast(predicate /* , thisArg */) { return $findLast(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); /***/ }), /* 169 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var $findLastIndex = __webpack_require__(103).findLastIndex; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findLastIndex` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlastindex exportTypedArrayMethod('findLastIndex', function findLastIndex(predicate /* , thisArg */) { return $findLastIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); /***/ }), /* 170 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var call = __webpack_require__(7); var ArrayBufferViewCore = __webpack_require__(166); var lengthOfArrayLike = __webpack_require__(63); var toOffset = __webpack_require__(171); var toIndexedObject = __webpack_require__(39); var fails = __webpack_require__(6); var RangeError = global.RangeError; var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var $set = Int8ArrayPrototype && Int8ArrayPrototype.set; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS = !fails(function () { // eslint-disable-next-line es/no-typed-arrays -- required for testing var array = new Uint8ClampedArray(2); call($set, array, { length: 1, 0: 3 }, 1); return array[1] !== 3; }); // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () { var array = new Int8Array(2); array.set(1); array.set('2', 1); return array[0] !== 0 || array[1] !== 2; }); // `%TypedArray%.prototype.set` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set exportTypedArrayMethod('set', function set(arrayLike /* , offset */) { aTypedArray(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); var src = toIndexedObject(arrayLike); if (WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS) return call($set, this, src, offset); var length = this.length; var len = lengthOfArrayLike(src); var index = 0; if (len + offset > length) throw new RangeError('Wrong length'); while (index < len) this[offset + index] = src[index++]; }, !WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG); /***/ }), /* 171 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPositiveInteger = __webpack_require__(172); var $RangeError = RangeError; module.exports = function (it, BYTES) { var offset = toPositiveInteger(it); if (offset % BYTES) throw new $RangeError('Wrong offset'); return offset; }; /***/ }), /* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(61); var $RangeError = RangeError; module.exports = function (it) { var result = toIntegerOrInfinity(it); if (result < 0) throw new $RangeError("The argument can't be less than 0"); return result; }; /***/ }), /* 173 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var arrayToReversed = __webpack_require__(110); var ArrayBufferViewCore = __webpack_require__(166); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; // `%TypedArray%.prototype.toReversed` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.toreversed exportTypedArrayMethod('toReversed', function toReversed() { return arrayToReversed(aTypedArray(this), getTypedArrayConstructor(this)); }); /***/ }), /* 174 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); var arrayFromConstructorAndList = __webpack_require__(112); var aTypedArray = ArrayBufferViewCore.aTypedArray; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort); // `%TypedArray%.prototype.toSorted` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tosorted exportTypedArrayMethod('toSorted', function toSorted(compareFn) { if (compareFn !== undefined) aCallable(compareFn); var O = aTypedArray(this); var A = arrayFromConstructorAndList(getTypedArrayConstructor(O), O); return sort(A, compareFn); }); /***/ }), /* 175 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var arrayWith = __webpack_require__(116); var ArrayBufferViewCore = __webpack_require__(166); var isBigIntArray = __webpack_require__(176); var toIntegerOrInfinity = __webpack_require__(61); var toBigInt = __webpack_require__(177); var aTypedArray = ArrayBufferViewCore.aTypedArray; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var PROPER_ORDER = !!function () { try { // eslint-disable-next-line no-throw-literal, es/no-typed-arrays, es/no-array-prototype-with -- required for testing new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); } catch (error) { // some early implementations, like WebKit, does not follow the final semantic // https://github.com/tc39/proposal-change-array-by-copy/pull/86 return error === 8; } }(); // `%TypedArray%.prototype.with` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.with exportTypedArrayMethod('with', { 'with': function (index, value) { var O = aTypedArray(this); var relativeIndex = toIntegerOrInfinity(index); var actualValue = isBigIntArray(O) ? toBigInt(value) : +value; return arrayWith(O, getTypedArrayConstructor(O), relativeIndex, actualValue); } }['with'], !PROPER_ORDER); /***/ }), /* 176 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(77); module.exports = function (it) { var klass = classof(it); return klass === 'BigInt64Array' || klass === 'BigUint64Array'; }; /***/ }), /* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPrimitive = __webpack_require__(18); var $TypeError = TypeError; // `ToBigInt` abstract operation // https://tc39.es/ecma262/#sec-tobigint module.exports = function (argument) { var prim = toPrimitive(argument, 'number'); if (typeof prim == 'number') throw new $TypeError("Can't convert number to bigint"); // eslint-disable-next-line es/no-bigint -- safe return BigInt(prim); }; /***/ }), /* 178 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isPrototypeOf = __webpack_require__(24); var getPrototypeOf = __webpack_require__(85); var setPrototypeOf = __webpack_require__(70); var copyConstructorProperties = __webpack_require__(55); var create = __webpack_require__(87); var createNonEnumerableProperty = __webpack_require__(43); var createPropertyDescriptor = __webpack_require__(10); var installErrorStack = __webpack_require__(80); var normalizeStringArgument = __webpack_require__(75); var wellKnownSymbol = __webpack_require__(33); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Error = Error; var $SuppressedError = function SuppressedError(error, suppressed, message) { var isInstance = isPrototypeOf(SuppressedErrorPrototype, this); var that; if (setPrototypeOf) { that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : SuppressedErrorPrototype); } else { that = isInstance ? this : create(SuppressedErrorPrototype); createNonEnumerableProperty(that, TO_STRING_TAG, 'Error'); } if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message)); installErrorStack(that, $SuppressedError, that.stack, 1); createNonEnumerableProperty(that, 'error', error); createNonEnumerableProperty(that, 'suppressed', suppressed); return that; }; if (setPrototypeOf) setPrototypeOf($SuppressedError, $Error); else copyConstructorProperties($SuppressedError, $Error, { name: true }); var SuppressedErrorPrototype = $SuppressedError.prototype = create($Error.prototype, { constructor: createPropertyDescriptor(1, $SuppressedError), message: createPropertyDescriptor(1, ''), name: createPropertyDescriptor(1, 'SuppressedError') }); // `SuppressedError` constructor // https://github.com/tc39/proposal-explicit-resource-management $({ global: true, constructor: true, arity: 3 }, { SuppressedError: $SuppressedError }); /***/ }), /* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var fromAsync = __webpack_require__(180); // `Array.fromAsync` method // https://github.com/tc39/proposal-array-from-async $({ target: 'Array', stat: true }, { fromAsync: fromAsync }); /***/ }), /* 180 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var uncurryThis = __webpack_require__(13); var toObject = __webpack_require__(39); var isConstructor = __webpack_require__(128); var getAsyncIterator = __webpack_require__(181); var getIterator = __webpack_require__(96); var getIteratorDirect = __webpack_require__(186); var getIteratorMethod = __webpack_require__(97); var getMethod = __webpack_require__(29); var getBuiltIn = __webpack_require__(23); var getBuiltInPrototypeMethod = __webpack_require__(113); var wellKnownSymbol = __webpack_require__(33); var AsyncFromSyncIterator = __webpack_require__(182); var toArray = __webpack_require__(187).toArray; var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); var arrayIterator = uncurryThis(getBuiltInPrototypeMethod('Array', 'values')); var arrayIteratorNext = uncurryThis(arrayIterator([]).next); var safeArrayIterator = function () { return new SafeArrayIterator(this); }; var SafeArrayIterator = function (O) { this.iterator = arrayIterator(O); }; SafeArrayIterator.prototype.next = function () { return arrayIteratorNext(this.iterator); }; // `Array.fromAsync` method implementation // https://github.com/tc39/proposal-array-from-async module.exports = function fromAsync(asyncItems /* , mapfn = undefined, thisArg = undefined */) { var C = this; var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var thisArg = argumentsLength > 2 ? arguments[2] : undefined; return new (getBuiltIn('Promise'))(function (resolve) { var O = toObject(asyncItems); if (mapfn !== undefined) mapfn = bind(mapfn, thisArg); var usingAsyncIterator = getMethod(O, ASYNC_ITERATOR); var usingSyncIterator = usingAsyncIterator ? undefined : getIteratorMethod(O) || safeArrayIterator; var A = isConstructor(C) ? new C() : []; var iterator = usingAsyncIterator ? getAsyncIterator(O, usingAsyncIterator) : new AsyncFromSyncIterator(getIteratorDirect(getIterator(O, usingSyncIterator))); resolve(toArray(iterator, mapfn, A)); }); }; /***/ }), /* 181 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var AsyncFromSyncIterator = __webpack_require__(182); var anObject = __webpack_require__(46); var getIterator = __webpack_require__(96); var getIteratorDirect = __webpack_require__(186); var getMethod = __webpack_require__(29); var wellKnownSymbol = __webpack_require__(33); var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); module.exports = function (it, usingIterator) { var method = arguments.length < 2 ? getMethod(it, ASYNC_ITERATOR) : usingIterator; return method ? anObject(call(method, it)) : new AsyncFromSyncIterator(getIteratorDirect(getIterator(it))); }; /***/ }), /* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var anObject = __webpack_require__(46); var create = __webpack_require__(87); var getMethod = __webpack_require__(29); var defineBuiltIns = __webpack_require__(183); var InternalStateModule = __webpack_require__(51); var getBuiltIn = __webpack_require__(23); var AsyncIteratorPrototype = __webpack_require__(184); var createIterResultObject = __webpack_require__(185); var Promise = getBuiltIn('Promise'); var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ASYNC_FROM_SYNC_ITERATOR); var asyncFromSyncIteratorContinuation = function (result, resolve, reject) { var done = result.done; Promise.resolve(result.value).then(function (value) { resolve(createIterResultObject(value, done)); }, reject); }; var AsyncFromSyncIterator = function AsyncIterator(iteratorRecord) { iteratorRecord.type = ASYNC_FROM_SYNC_ITERATOR; setInternalState(this, iteratorRecord); }; AsyncFromSyncIterator.prototype = defineBuiltIns(create(AsyncIteratorPrototype), { next: function next() { var state = getInternalState(this); return new Promise(function (resolve, reject) { var result = anObject(call(state.next, state.iterator)); asyncFromSyncIteratorContinuation(result, resolve, reject); }); }, 'return': function () { var iterator = getInternalState(this).iterator; return new Promise(function (resolve, reject) { var $return = getMethod(iterator, 'return'); if ($return === undefined) return resolve(createIterResultObject(undefined, true)); var result = anObject(call($return, iterator)); asyncFromSyncIteratorContinuation(result, resolve, reject); }); } }); module.exports = AsyncFromSyncIterator; /***/ }), /* 183 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineBuiltIn = __webpack_require__(47); module.exports = function (target, src, options) { for (var key in src) defineBuiltIn(target, key, src[key], options); return target; }; /***/ }), /* 184 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var shared = __webpack_require__(36); var isCallable = __webpack_require__(20); var create = __webpack_require__(87); var getPrototypeOf = __webpack_require__(85); var defineBuiltIn = __webpack_require__(47); var wellKnownSymbol = __webpack_require__(33); var IS_PURE = __webpack_require__(35); var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR'; var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); var AsyncIterator = global.AsyncIterator; var PassedAsyncIteratorPrototype = shared.AsyncIteratorPrototype; var AsyncIteratorPrototype, prototype; if (PassedAsyncIteratorPrototype) { AsyncIteratorPrototype = PassedAsyncIteratorPrototype; } else if (isCallable(AsyncIterator)) { AsyncIteratorPrototype = AsyncIterator.prototype; } else if (shared[USE_FUNCTION_CONSTRUCTOR] || global[USE_FUNCTION_CONSTRUCTOR]) { try { // eslint-disable-next-line no-new-func -- we have no alternatives without usage of modern syntax prototype = getPrototypeOf(getPrototypeOf(getPrototypeOf(Function('return async function*(){}()')()))); if (getPrototypeOf(prototype) === Object.prototype) AsyncIteratorPrototype = prototype; } catch (error) { /* empty */ } } if (!AsyncIteratorPrototype) AsyncIteratorPrototype = {}; else if (IS_PURE) AsyncIteratorPrototype = create(AsyncIteratorPrototype); if (!isCallable(AsyncIteratorPrototype[ASYNC_ITERATOR])) { defineBuiltIn(AsyncIteratorPrototype, ASYNC_ITERATOR, function () { return this; }); } module.exports = AsyncIteratorPrototype; /***/ }), /* 185 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `CreateIterResultObject` abstract operation // https://tc39.es/ecma262/#sec-createiterresultobject module.exports = function (value, done) { return { value: value, done: done }; }; /***/ }), /* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `GetIteratorDirect(obj)` abstract operation // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect module.exports = function (obj) { return { iterator: obj, next: obj.next, done: false }; }; /***/ }), /* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-iterator-helpers // https://github.com/tc39/proposal-array-from-async var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var doesNotExceedSafeInteger = __webpack_require__(108); var getBuiltIn = __webpack_require__(23); var getIteratorDirect = __webpack_require__(186); var closeAsyncIteration = __webpack_require__(188); var createMethod = function (TYPE) { var IS_TO_ARRAY = TYPE === 0; var IS_FOR_EACH = TYPE === 1; var IS_EVERY = TYPE === 2; var IS_SOME = TYPE === 3; return function (object, fn, target) { anObject(object); var MAPPING = fn !== undefined; if (MAPPING || !IS_TO_ARRAY) aCallable(fn); var record = getIteratorDirect(object); var Promise = getBuiltIn('Promise'); var iterator = record.iterator; var next = record.next; var counter = 0; return new Promise(function (resolve, reject) { var ifAbruptCloseAsyncIterator = function (error) { closeAsyncIteration(iterator, reject, error, reject); }; var loop = function () { try { if (MAPPING) try { doesNotExceedSafeInteger(counter); } catch (error5) { ifAbruptCloseAsyncIterator(error5); } Promise.resolve(anObject(call(next, iterator))).then(function (step) { try { if (anObject(step).done) { if (IS_TO_ARRAY) { target.length = counter; resolve(target); } else resolve(IS_SOME ? false : IS_EVERY || undefined); } else { var value = step.value; try { if (MAPPING) { var result = fn(value, counter); var handler = function ($result) { if (IS_FOR_EACH) { loop(); } else if (IS_EVERY) { $result ? loop() : closeAsyncIteration(iterator, resolve, false, reject); } else if (IS_TO_ARRAY) { try { target[counter++] = $result; loop(); } catch (error4) { ifAbruptCloseAsyncIterator(error4); } } else { $result ? closeAsyncIteration(iterator, resolve, IS_SOME || value, reject) : loop(); } }; if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator); else handler(result); } else { target[counter++] = value; loop(); } } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } } catch (error2) { reject(error2); } }, reject); } catch (error) { reject(error); } }; loop(); }); }; }; module.exports = { toArray: createMethod(0), forEach: createMethod(1), every: createMethod(2), some: createMethod(3), find: createMethod(4) }; /***/ }), /* 188 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var getBuiltIn = __webpack_require__(23); var getMethod = __webpack_require__(29); module.exports = function (iterator, method, argument, reject) { try { var returnMethod = getMethod(iterator, 'return'); if (returnMethod) { return getBuiltIn('Promise').resolve(call(returnMethod, iterator)).then(function () { method(argument); }, function (error) { reject(error); }); } } catch (error2) { return reject(error2); } method(argument); }; /***/ }), /* 189 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $filterReject = __webpack_require__(190).filterReject; var addToUnscopables = __webpack_require__(101); // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering $({ target: 'Array', proto: true, forced: true }, { filterReject: function filterReject(callbackfn /* , thisArg */) { return $filterReject(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); addToUnscopables('filterReject'); /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var uncurryThis = __webpack_require__(13); var IndexedObject = __webpack_require__(12); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var arraySpeciesCreate = __webpack_require__(191); var push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE === 1; var IS_FILTER = TYPE === 2; var IS_SOME = TYPE === 3; var IS_EVERY = TYPE === 4; var IS_FIND_INDEX = TYPE === 6; var IS_FILTER_REJECT = TYPE === 7; var NO_HOLES = TYPE === 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var length = lengthOfArrayLike(self); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push(target, value); // filter } else switch (TYPE) { case 4: return false; // every case 7: push(target, value); // filterReject } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; module.exports = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex findIndex: createMethod(6), // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering filterReject: createMethod(7) }; /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var arraySpeciesConstructor = __webpack_require__(192); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; /***/ }), /* 192 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isArray = __webpack_require__(107); var isConstructor = __webpack_require__(128); var isObject = __webpack_require__(19); var wellKnownSymbol = __webpack_require__(33); var SPECIES = wellKnownSymbol('species'); var $Array = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? $Array : C; }; /***/ }), /* 193 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $group = __webpack_require__(194); var addToUnscopables = __webpack_require__(101); // `Array.prototype.group` method // https://github.com/tc39/proposal-array-grouping $({ target: 'Array', proto: true }, { group: function group(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; return $group(this, callbackfn, thisArg); } }); addToUnscopables('group'); /***/ }), /* 194 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var uncurryThis = __webpack_require__(13); var IndexedObject = __webpack_require__(12); var toObject = __webpack_require__(39); var toPropertyKey = __webpack_require__(17); var lengthOfArrayLike = __webpack_require__(63); var objectCreate = __webpack_require__(87); var arrayFromConstructorAndList = __webpack_require__(112); var $Array = Array; var push = uncurryThis([].push); module.exports = function ($this, callbackfn, that, specificConstructor) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var target = objectCreate(null); var length = lengthOfArrayLike(self); var index = 0; var Constructor, key, value; for (;length > index; index++) { value = self[index]; key = toPropertyKey(boundFunction(value, index, O)); // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` if (key in target) push(target[key], value); else target[key] = [value]; } // TODO: Remove this block from `core-js@4` if (specificConstructor) { Constructor = specificConstructor(O); if (Constructor !== $Array) { for (key in target) target[key] = arrayFromConstructorAndList(Constructor, target[key]); } } return target; }; /***/ }), /* 195 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var $group = __webpack_require__(194); var arrayMethodIsStrict = __webpack_require__(196); var addToUnscopables = __webpack_require__(101); // `Array.prototype.groupBy` method // https://github.com/tc39/proposal-array-grouping // https://bugs.webkit.org/show_bug.cgi?id=236541 $({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupBy') }, { groupBy: function groupBy(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; return $group(this, callbackfn, thisArg); } }); addToUnscopables('groupBy'); /***/ }), /* 196 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); module.exports = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails(function () { // eslint-disable-next-line no-useless-call -- required for testing method.call(null, argument || function () { return 1; }, 1); }); }; /***/ }), /* 197 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var arrayMethodIsStrict = __webpack_require__(196); var addToUnscopables = __webpack_require__(101); var $groupToMap = __webpack_require__(198); var IS_PURE = __webpack_require__(35); // `Array.prototype.groupByToMap` method // https://github.com/tc39/proposal-array-grouping // https://bugs.webkit.org/show_bug.cgi?id=236541 $({ target: 'Array', proto: true, name: 'groupToMap', forced: IS_PURE || !arrayMethodIsStrict('groupByToMap') }, { groupByToMap: $groupToMap }); addToUnscopables('groupByToMap'); /***/ }), /* 198 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(92); var uncurryThis = __webpack_require__(13); var IndexedObject = __webpack_require__(12); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var MapHelpers = __webpack_require__(199); var Map = MapHelpers.Map; var mapGet = MapHelpers.get; var mapHas = MapHelpers.has; var mapSet = MapHelpers.set; var push = uncurryThis([].push); // `Array.prototype.groupToMap` method // https://github.com/tc39/proposal-array-grouping module.exports = function groupToMap(callbackfn /* , thisArg */) { var O = toObject(this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var map = new Map(); var length = lengthOfArrayLike(self); var index = 0; var key, value; for (;length > index; index++) { value = self[index]; key = boundFunction(value, index, O); if (mapHas(map, key)) push(mapGet(map, key), value); else mapSet(map, key, [value]); } return map; }; /***/ }), /* 199 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); // eslint-disable-next-line es/no-map -- safe var MapPrototype = Map.prototype; module.exports = { // eslint-disable-next-line es/no-map -- safe Map: Map, set: uncurryThis(MapPrototype.set), get: uncurryThis(MapPrototype.get), has: uncurryThis(MapPrototype.has), remove: uncurryThis(MapPrototype['delete']), proto: MapPrototype }; /***/ }), /* 200 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var addToUnscopables = __webpack_require__(101); var $groupToMap = __webpack_require__(198); var IS_PURE = __webpack_require__(35); // `Array.prototype.groupToMap` method // https://github.com/tc39/proposal-array-grouping $({ target: 'Array', proto: true, forced: IS_PURE }, { groupToMap: $groupToMap }); addToUnscopables('groupToMap'); /***/ }), /* 201 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isArray = __webpack_require__(107); // eslint-disable-next-line es/no-object-isfrozen -- safe var isFrozen = Object.isFrozen; var isFrozenStringArray = function (array, allowUndefined) { if (!isFrozen || !isArray(array) || !isFrozen(array)) return false; var index = 0; var length = array.length; var element; while (index < length) { element = array[index++]; if (!(typeof element == 'string' || (allowUndefined && element === undefined))) { return false; } } return length !== 0; }; // `Array.isTemplateObject` method // https://github.com/tc39/proposal-array-is-template-object $({ target: 'Array', stat: true, sham: true, forced: true }, { isTemplateObject: function isTemplateObject(value) { if (!isFrozenStringArray(value, true)) return false; var raw = value.raw; return raw.length === value.length && isFrozenStringArray(raw, false); } }); /***/ }), /* 202 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var DESCRIPTORS = __webpack_require__(5); var addToUnscopables = __webpack_require__(101); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var defineBuiltInAccessor = __webpack_require__(119); // `Array.prototype.lastIndex` getter // https://github.com/keithamus/proposal-array-last if (DESCRIPTORS) { defineBuiltInAccessor(Array.prototype, 'lastIndex', { configurable: true, get: function lastIndex() { var O = toObject(this); var len = lengthOfArrayLike(O); return len === 0 ? 0 : len - 1; } }); addToUnscopables('lastIndex'); } /***/ }), /* 203 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var DESCRIPTORS = __webpack_require__(5); var addToUnscopables = __webpack_require__(101); var toObject = __webpack_require__(39); var lengthOfArrayLike = __webpack_require__(63); var defineBuiltInAccessor = __webpack_require__(119); // `Array.prototype.lastIndex` accessor // https://github.com/keithamus/proposal-array-last if (DESCRIPTORS) { defineBuiltInAccessor(Array.prototype, 'lastItem', { configurable: true, get: function lastItem() { var O = toObject(this); var len = lengthOfArrayLike(O); return len === 0 ? undefined : O[len - 1]; }, set: function lastItem(value) { var O = toObject(this); var len = lengthOfArrayLike(O); return O[len === 0 ? 0 : len - 1] = value; } }); addToUnscopables('lastItem'); } /***/ }), /* 204 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var addToUnscopables = __webpack_require__(101); var uniqueBy = __webpack_require__(205); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique $({ target: 'Array', proto: true, forced: true }, { uniqueBy: uniqueBy }); addToUnscopables('uniqueBy'); /***/ }), /* 205 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); var isNullOrUndefined = __webpack_require__(16); var lengthOfArrayLike = __webpack_require__(63); var toObject = __webpack_require__(39); var MapHelpers = __webpack_require__(199); var iterate = __webpack_require__(206); var Map = MapHelpers.Map; var mapHas = MapHelpers.has; var mapSet = MapHelpers.set; var push = uncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique module.exports = function uniqueBy(resolver) { var that = toObject(this); var length = lengthOfArrayLike(that); var result = []; var map = new Map(); var resolverFunction = !isNullOrUndefined(resolver) ? aCallable(resolver) : function (value) { return value; }; var index, item, key; for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); if (!mapHas(map, key)) mapSet(map, key, item); } iterate(map, function (value) { push(result, value); }); return result; }; /***/ }), /* 206 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var iterateSimple = __webpack_require__(207); var MapHelpers = __webpack_require__(199); var Map = MapHelpers.Map; var MapPrototype = MapHelpers.proto; var forEach = uncurryThis(MapPrototype.forEach); var entries = uncurryThis(MapPrototype.entries); var next = entries(new Map()).next; module.exports = function (map, fn, interruptible) { return interruptible ? iterateSimple({ iterator: entries(map), next: next }, function (entry) { return fn(entry[1], entry[0]); }) : forEach(map, fn); }; /***/ }), /* 207 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) { var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; var next = record.next; var step, result; while (!(step = call(next, iterator)).done) { result = fn(step.value); if (result !== undefined) return result; } }; /***/ }), /* 208 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var defineBuiltInAccessor = __webpack_require__(119); var isDetached = __webpack_require__(209); var ArrayBufferPrototype = ArrayBuffer.prototype; if (DESCRIPTORS && !('detached' in ArrayBufferPrototype)) { defineBuiltInAccessor(ArrayBufferPrototype, 'detached', { configurable: true, get: function detached() { return isDetached(this); } }); } /***/ }), /* 209 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var arrayBufferByteLength = __webpack_require__(210); var slice = uncurryThis(ArrayBuffer.prototype.slice); module.exports = function (O) { if (arrayBufferByteLength(O) !== 0) return false; try { slice(O, 0, 0); return false; } catch (error) { return true; } }; /***/ }), /* 210 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThisAccessor = __webpack_require__(71); var classof = __webpack_require__(14); var $TypeError = TypeError; // Includes // - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). // - If IsSharedArrayBuffer(O) is true, throw a TypeError exception. module.exports = uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) { if (classof(O) !== 'ArrayBuffer') throw new $TypeError('ArrayBuffer expected'); return O.byteLength; }; /***/ }), /* 211 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $transfer = __webpack_require__(212); // `ArrayBuffer.prototype.transfer` method // https://tc39.es/proposal-arraybuffer-transfer/#sec-arraybuffer.prototype.transfer if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { transfer: function transfer() { return $transfer(this, arguments.length ? arguments[0] : undefined, true); } }); /***/ }), /* 212 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var uncurryThis = __webpack_require__(13); var uncurryThisAccessor = __webpack_require__(71); var toIndex = __webpack_require__(213); var isDetached = __webpack_require__(209); var arrayBufferByteLength = __webpack_require__(210); var detachTransferable = __webpack_require__(214); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(216); var structuredClone = global.structuredClone; var ArrayBuffer = global.ArrayBuffer; var DataView = global.DataView; var TypeError = global.TypeError; var min = Math.min; var ArrayBufferPrototype = ArrayBuffer.prototype; var DataViewPrototype = DataView.prototype; var slice = uncurryThis(ArrayBufferPrototype.slice); var isResizable = uncurryThisAccessor(ArrayBufferPrototype, 'resizable', 'get'); var maxByteLength = uncurryThisAccessor(ArrayBufferPrototype, 'maxByteLength', 'get'); var getInt8 = uncurryThis(DataViewPrototype.getInt8); var setInt8 = uncurryThis(DataViewPrototype.setInt8); module.exports = (PROPER_STRUCTURED_CLONE_TRANSFER || detachTransferable) && function (arrayBuffer, newLength, preserveResizability) { var byteLength = arrayBufferByteLength(arrayBuffer); var newByteLength = newLength === undefined ? byteLength : toIndex(newLength); var fixedLength = !isResizable || !isResizable(arrayBuffer); var newBuffer; if (isDetached(arrayBuffer)) throw new TypeError('ArrayBuffer is detached'); if (PROPER_STRUCTURED_CLONE_TRANSFER) { arrayBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] }); if (byteLength === newByteLength && (preserveResizability || fixedLength)) return arrayBuffer; } if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) { newBuffer = slice(arrayBuffer, 0, newByteLength); } else { var options = preserveResizability && !fixedLength && maxByteLength ? { maxByteLength: maxByteLength(arrayBuffer) } : undefined; newBuffer = new ArrayBuffer(newByteLength, options); var a = new DataView(arrayBuffer); var b = new DataView(newBuffer); var copyLength = min(newByteLength, byteLength); for (var i = 0; i < copyLength; i++) setInt8(b, i, getInt8(a, i)); } if (!PROPER_STRUCTURED_CLONE_TRANSFER) detachTransferable(arrayBuffer); return newBuffer; }; /***/ }), /* 213 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(61); var toLength = __webpack_require__(64); var $RangeError = RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex module.exports = function (it) { if (it === undefined) return 0; var number = toIntegerOrInfinity(it); var length = toLength(number); if (number !== length) throw new $RangeError('Wrong length or index'); return length; }; /***/ }), /* 214 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var tryNodeRequire = __webpack_require__(215); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(216); var structuredClone = global.structuredClone; var $ArrayBuffer = global.ArrayBuffer; var $MessageChannel = global.MessageChannel; var detach = false; var WorkerThreads, channel, buffer, $detach; if (PROPER_STRUCTURED_CLONE_TRANSFER) { detach = function (transferable) { structuredClone(transferable, { transfer: [transferable] }); }; } else if ($ArrayBuffer) try { if (!$MessageChannel) { WorkerThreads = tryNodeRequire('worker_threads'); if (WorkerThreads) $MessageChannel = WorkerThreads.MessageChannel; } if ($MessageChannel) { channel = new $MessageChannel(); buffer = new $ArrayBuffer(2); $detach = function (transferable) { channel.port1.postMessage(null, [transferable]); }; if (buffer.byteLength === 2) { $detach(buffer); if (buffer.byteLength === 0) detach = $detach; } } } catch (error) { /* empty */ } module.exports = detach; /***/ }), /* 215 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_NODE = __webpack_require__(122); module.exports = function (name) { try { // eslint-disable-next-line no-new-func -- safe if (IS_NODE) return Function('return require("' + name + '")')(); } catch (error) { /* empty */ } }; /***/ }), /* 216 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var fails = __webpack_require__(6); var V8 = __webpack_require__(27); var IS_BROWSER = __webpack_require__(141); var IS_DENO = __webpack_require__(142); var IS_NODE = __webpack_require__(122); var structuredClone = global.structuredClone; module.exports = !!structuredClone && !fails(function () { // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation // https://github.com/zloirock/core-js/issues/679 if ((IS_DENO && V8 > 92) || (IS_NODE && V8 > 94) || (IS_BROWSER && V8 > 97)) return false; var buffer = new ArrayBuffer(8); var clone = structuredClone(buffer, { transfer: [buffer] }); return buffer.byteLength !== 0 || clone.byteLength !== 8; }); /***/ }), /* 217 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $transfer = __webpack_require__(212); // `ArrayBuffer.prototype.transferToFixedLength` method // https://tc39.es/proposal-arraybuffer-transfer/#sec-arraybuffer.prototype.transfertofixedlength if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { transferToFixedLength: function transferToFixedLength() { return $transfer(this, arguments.length ? arguments[0] : undefined, false); } }); /***/ }), /* 218 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-async-explicit-resource-management var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); var getBuiltIn = __webpack_require__(23); var aCallable = __webpack_require__(30); var anInstance = __webpack_require__(125); var defineBuiltIn = __webpack_require__(47); var defineBuiltIns = __webpack_require__(183); var defineBuiltInAccessor = __webpack_require__(119); var wellKnownSymbol = __webpack_require__(33); var InternalStateModule = __webpack_require__(51); var addDisposableResource = __webpack_require__(219); var Promise = getBuiltIn('Promise'); var SuppressedError = getBuiltIn('SuppressedError'); var $ReferenceError = ReferenceError; var ASYNC_DISPOSE = wellKnownSymbol('asyncDispose'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ASYNC_DISPOSABLE_STACK = 'AsyncDisposableStack'; var setInternalState = InternalStateModule.set; var getAsyncDisposableStackInternalState = InternalStateModule.getterFor(ASYNC_DISPOSABLE_STACK); var HINT = 'async-dispose'; var DISPOSED = 'disposed'; var PENDING = 'pending'; var getPendingAsyncDisposableStackInternalState = function (stack) { var internalState = getAsyncDisposableStackInternalState(stack); if (internalState.state === DISPOSED) throw new $ReferenceError(ASYNC_DISPOSABLE_STACK + ' already disposed'); return internalState; }; var $AsyncDisposableStack = function AsyncDisposableStack() { setInternalState(anInstance(this, AsyncDisposableStackPrototype), { type: ASYNC_DISPOSABLE_STACK, state: PENDING, stack: [] }); if (!DESCRIPTORS) this.disposed = false; }; var AsyncDisposableStackPrototype = $AsyncDisposableStack.prototype; defineBuiltIns(AsyncDisposableStackPrototype, { disposeAsync: function disposeAsync() { var asyncDisposableStack = this; return new Promise(function (resolve, reject) { var internalState = getAsyncDisposableStackInternalState(asyncDisposableStack); if (internalState.state === DISPOSED) return resolve(undefined); internalState.state = DISPOSED; if (!DESCRIPTORS) asyncDisposableStack.disposed = true; var stack = internalState.stack; var i = stack.length; var thrown = false; var suppressed; var handleError = function (result) { if (thrown) { suppressed = new SuppressedError(result, suppressed); } else { thrown = true; suppressed = result; } loop(); }; var loop = function () { if (i) { var disposeMethod = stack[--i]; stack[i] = null; try { Promise.resolve(disposeMethod()).then(loop, handleError); } catch (error) { handleError(error); } } else { internalState.stack = null; thrown ? reject(suppressed) : resolve(undefined); } }; loop(); }); }, use: function use(value) { addDisposableResource(getPendingAsyncDisposableStackInternalState(this), value, HINT); return value; }, adopt: function adopt(value, onDispose) { var internalState = getPendingAsyncDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, function () { return onDispose(value); }); return value; }, defer: function defer(onDispose) { var internalState = getPendingAsyncDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, onDispose); }, move: function move() { var internalState = getPendingAsyncDisposableStackInternalState(this); var newAsyncDisposableStack = new $AsyncDisposableStack(); getAsyncDisposableStackInternalState(newAsyncDisposableStack).stack = internalState.stack; internalState.stack = []; internalState.state = DISPOSED; if (!DESCRIPTORS) this.disposed = true; return newAsyncDisposableStack; } }); if (DESCRIPTORS) defineBuiltInAccessor(AsyncDisposableStackPrototype, 'disposed', { configurable: true, get: function disposed() { return getAsyncDisposableStackInternalState(this).state === DISPOSED; } }); defineBuiltIn(AsyncDisposableStackPrototype, ASYNC_DISPOSE, AsyncDisposableStackPrototype.disposeAsync, { name: 'disposeAsync' }); defineBuiltIn(AsyncDisposableStackPrototype, TO_STRING_TAG, ASYNC_DISPOSABLE_STACK, { nonWritable: true }); $({ global: true, constructor: true }, { AsyncDisposableStack: $AsyncDisposableStack }); /***/ }), /* 219 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var uncurryThis = __webpack_require__(13); var bind = __webpack_require__(92); var anObject = __webpack_require__(46); var aCallable = __webpack_require__(30); var isNullOrUndefined = __webpack_require__(16); var getMethod = __webpack_require__(29); var wellKnownSymbol = __webpack_require__(33); var ASYNC_DISPOSE = wellKnownSymbol('asyncDispose'); var DISPOSE = wellKnownSymbol('dispose'); var push = uncurryThis([].push); // `GetDisposeMethod` abstract operation // https://tc39.es/proposal-explicit-resource-management/#sec-getdisposemethod var getDisposeMethod = function (V, hint) { if (hint === 'async-dispose') { var method = getMethod(V, ASYNC_DISPOSE); if (method !== undefined) return method; method = getMethod(V, DISPOSE); return function () { call(method, this); }; } return getMethod(V, DISPOSE); }; // `CreateDisposableResource` abstract operation // https://tc39.es/proposal-explicit-resource-management/#sec-createdisposableresource var createDisposableResource = function (V, hint, method) { if (arguments.length < 3 && !isNullOrUndefined(V)) { method = aCallable(getDisposeMethod(anObject(V), hint)); } return method === undefined ? function () { return undefined; } : bind(method, V); }; // `AddDisposableResource` abstract operation // https://tc39.es/proposal-explicit-resource-management/#sec-adddisposableresource module.exports = function (disposable, V, hint, method) { var resource; if (arguments.length < 4) { // When `V`` is either `null` or `undefined` and hint is `async-dispose`, // we record that the resource was evaluated to ensure we will still perform an `Await` when resources are later disposed. if (isNullOrUndefined(V) && hint === 'sync-dispose') return; resource = createDisposableResource(V, hint); } else { resource = createDisposableResource(undefined, hint, method); } push(disposable.stack, resource); }; /***/ }), /* 220 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var anInstance = __webpack_require__(125); var getPrototypeOf = __webpack_require__(85); var createNonEnumerableProperty = __webpack_require__(43); var hasOwn = __webpack_require__(38); var wellKnownSymbol = __webpack_require__(33); var AsyncIteratorPrototype = __webpack_require__(184); var IS_PURE = __webpack_require__(35); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $TypeError = TypeError; var AsyncIteratorConstructor = function AsyncIterator() { anInstance(this, AsyncIteratorPrototype); if (getPrototypeOf(this) === AsyncIteratorPrototype) throw new $TypeError('Abstract class AsyncIterator not directly constructable'); }; AsyncIteratorConstructor.prototype = AsyncIteratorPrototype; if (!hasOwn(AsyncIteratorPrototype, TO_STRING_TAG)) { createNonEnumerableProperty(AsyncIteratorPrototype, TO_STRING_TAG, 'AsyncIterator'); } if (IS_PURE || !hasOwn(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPrototype.constructor === Object) { createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor); } // `AsyncIterator` constructor // https://github.com/tc39/proposal-async-iterator-helpers $({ global: true, constructor: true, forced: IS_PURE }, { AsyncIterator: AsyncIteratorConstructor }); /***/ }), /* 221 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var indexed = __webpack_require__(222); // `AsyncIterator.prototype.asIndexedPairs` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'AsyncIterator', name: 'indexed', proto: true, real: true, forced: true }, { asIndexedPairs: indexed }); /***/ }), /* 222 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var map = __webpack_require__(223); var callback = function (value, counter) { return [counter, value]; }; // `AsyncIterator.prototype.indexed` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function indexed() { return call(map, this, callback); }; /***/ }), /* 223 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var getIteratorDirect = __webpack_require__(186); var createAsyncIteratorProxy = __webpack_require__(224); var createIterResultObject = __webpack_require__(185); var closeAsyncIteration = __webpack_require__(188); var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { var state = this; var iterator = state.iterator; var mapper = state.mapper; return new Promise(function (resolve, reject) { var doneAndReject = function (error) { state.done = true; reject(error); }; var ifAbruptCloseAsyncIterator = function (error) { closeAsyncIteration(iterator, doneAndReject, error, doneAndReject); }; Promise.resolve(anObject(call(state.next, iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve(createIterResultObject(undefined, true)); } else { var value = step.value; try { var result = mapper(value, state.counter++); var handler = function (mapped) { resolve(createIterResultObject(mapped, false)); }; if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator); else handler(result); } catch (error2) { ifAbruptCloseAsyncIterator(error2); } } } catch (error) { doneAndReject(error); } }, doneAndReject); }); }); // `AsyncIterator.prototype.map` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function map(mapper) { anObject(this); aCallable(mapper); return new AsyncIteratorProxy(getIteratorDirect(this), { mapper: mapper }); }; /***/ }), /* 224 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var perform = __webpack_require__(138); var anObject = __webpack_require__(46); var create = __webpack_require__(87); var createNonEnumerableProperty = __webpack_require__(43); var defineBuiltIns = __webpack_require__(183); var wellKnownSymbol = __webpack_require__(33); var InternalStateModule = __webpack_require__(51); var getBuiltIn = __webpack_require__(23); var getMethod = __webpack_require__(29); var AsyncIteratorPrototype = __webpack_require__(184); var createIterResultObject = __webpack_require__(185); var iteratorClose = __webpack_require__(98); var Promise = getBuiltIn('Promise'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ASYNC_ITERATOR_HELPER = 'AsyncIteratorHelper'; var WRAP_FOR_VALID_ASYNC_ITERATOR = 'WrapForValidAsyncIterator'; var setInternalState = InternalStateModule.set; var createAsyncIteratorProxyPrototype = function (IS_ITERATOR) { var IS_GENERATOR = !IS_ITERATOR; var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ASYNC_ITERATOR : ASYNC_ITERATOR_HELPER); var getStateOrEarlyExit = function (that) { var stateCompletion = perform(function () { return getInternalState(that); }); var stateError = stateCompletion.error; var state = stateCompletion.value; if (stateError || (IS_GENERATOR && state.done)) { return { exit: true, value: stateError ? Promise.reject(state) : Promise.resolve(createIterResultObject(undefined, true)) }; } return { exit: false, value: state }; }; return defineBuiltIns(create(AsyncIteratorPrototype), { next: function next() { var stateCompletion = getStateOrEarlyExit(this); var state = stateCompletion.value; if (stateCompletion.exit) return state; var handlerCompletion = perform(function () { return anObject(state.nextHandler(Promise)); }); var handlerError = handlerCompletion.error; var value = handlerCompletion.value; if (handlerError) state.done = true; return handlerError ? Promise.reject(value) : Promise.resolve(value); }, 'return': function () { var stateCompletion = getStateOrEarlyExit(this); var state = stateCompletion.value; if (stateCompletion.exit) return state; state.done = true; var iterator = state.iterator; var returnMethod, result; var completion = perform(function () { if (state.inner) try { iteratorClose(state.inner.iterator, 'normal'); } catch (error) { return iteratorClose(iterator, 'throw', error); } return getMethod(iterator, 'return'); }); returnMethod = result = completion.value; if (completion.error) return Promise.reject(result); if (returnMethod === undefined) return Promise.resolve(createIterResultObject(undefined, true)); completion = perform(function () { return call(returnMethod, iterator); }); result = completion.value; if (completion.error) return Promise.reject(result); return IS_ITERATOR ? Promise.resolve(result) : Promise.resolve(result).then(function (resolved) { anObject(resolved); return createIterResultObject(undefined, true); }); } }); }; var WrapForValidAsyncIteratorPrototype = createAsyncIteratorProxyPrototype(true); var AsyncIteratorHelperPrototype = createAsyncIteratorProxyPrototype(false); createNonEnumerableProperty(AsyncIteratorHelperPrototype, TO_STRING_TAG, 'Async Iterator Helper'); module.exports = function (nextHandler, IS_ITERATOR) { var AsyncIteratorProxy = function AsyncIterator(record, state) { if (state) { state.iterator = record.iterator; state.next = record.next; } else state = record; state.type = IS_ITERATOR ? WRAP_FOR_VALID_ASYNC_ITERATOR : ASYNC_ITERATOR_HELPER; state.nextHandler = nextHandler; state.counter = 0; state.done = false; setInternalState(this, state); }; AsyncIteratorProxy.prototype = IS_ITERATOR ? WrapForValidAsyncIteratorPrototype : AsyncIteratorHelperPrototype; return AsyncIteratorProxy; }; /***/ }), /* 225 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-async-explicit-resource-management var call = __webpack_require__(7); var defineBuiltIn = __webpack_require__(47); var getBuiltIn = __webpack_require__(23); var getMethod = __webpack_require__(29); var hasOwn = __webpack_require__(38); var wellKnownSymbol = __webpack_require__(33); var AsyncIteratorPrototype = __webpack_require__(184); var ASYNC_DISPOSE = wellKnownSymbol('asyncDispose'); var Promise = getBuiltIn('Promise'); if (!hasOwn(AsyncIteratorPrototype, ASYNC_DISPOSE)) { defineBuiltIn(AsyncIteratorPrototype, ASYNC_DISPOSE, function () { var O = this; return new Promise(function (resolve, reject) { var $return = getMethod(O, 'return'); if ($return) { Promise.resolve(call($return, O)).then(function () { resolve(undefined); }, reject); } else resolve(undefined); }); }); } /***/ }), /* 226 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var notANaN = __webpack_require__(227); var toPositiveInteger = __webpack_require__(172); var createAsyncIteratorProxy = __webpack_require__(224); var createIterResultObject = __webpack_require__(185); var IS_PURE = __webpack_require__(35); var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { var state = this; return new Promise(function (resolve, reject) { var doneAndReject = function (error) { state.done = true; reject(error); }; var loop = function () { try { Promise.resolve(anObject(call(state.next, state.iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve(createIterResultObject(undefined, true)); } else if (state.remaining) { state.remaining--; loop(); } else resolve(createIterResultObject(step.value, false)); } catch (err) { doneAndReject(err); } }, doneAndReject); } catch (error) { doneAndReject(error); } }; loop(); }); }); // `AsyncIterator.prototype.drop` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, { drop: function drop(limit) { anObject(this); var remaining = toPositiveInteger(notANaN(+limit)); return new AsyncIteratorProxy(getIteratorDirect(this), { remaining: remaining }); } }); /***/ }), /* 227 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $RangeError = RangeError; module.exports = function (it) { // eslint-disable-next-line no-self-compare -- NaN check if (it === it) return it; throw new $RangeError('NaN is not allowed'); }; /***/ }), /* 228 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $every = __webpack_require__(187).every; // `AsyncIterator.prototype.every` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { every: function every(predicate) { return $every(this, predicate); } }); /***/ }), /* 229 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var getIteratorDirect = __webpack_require__(186); var createAsyncIteratorProxy = __webpack_require__(224); var createIterResultObject = __webpack_require__(185); var closeAsyncIteration = __webpack_require__(188); var IS_PURE = __webpack_require__(35); var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { var state = this; var iterator = state.iterator; var predicate = state.predicate; return new Promise(function (resolve, reject) { var doneAndReject = function (error) { state.done = true; reject(error); }; var ifAbruptCloseAsyncIterator = function (error) { closeAsyncIteration(iterator, doneAndReject, error, doneAndReject); }; var loop = function () { try { Promise.resolve(anObject(call(state.next, iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve(createIterResultObject(undefined, true)); } else { var value = step.value; try { var result = predicate(value, state.counter++); var handler = function (selected) { selected ? resolve(createIterResultObject(value, false)) : loop(); }; if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator); else handler(result); } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } } catch (error2) { doneAndReject(error2); } }, doneAndReject); } catch (error) { doneAndReject(error); } }; loop(); }); }); // `AsyncIterator.prototype.filter` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, { filter: function filter(predicate) { anObject(this); aCallable(predicate); return new AsyncIteratorProxy(getIteratorDirect(this), { predicate: predicate }); } }); /***/ }), /* 230 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $find = __webpack_require__(187).find; // `AsyncIterator.prototype.find` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { find: function find(predicate) { return $find(this, predicate); } }); /***/ }), /* 231 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var getIteratorDirect = __webpack_require__(186); var createAsyncIteratorProxy = __webpack_require__(224); var createIterResultObject = __webpack_require__(185); var getAsyncIteratorFlattenable = __webpack_require__(232); var closeAsyncIteration = __webpack_require__(188); var IS_PURE = __webpack_require__(35); var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { var state = this; var iterator = state.iterator; var mapper = state.mapper; return new Promise(function (resolve, reject) { var doneAndReject = function (error) { state.done = true; reject(error); }; var ifAbruptCloseAsyncIterator = function (error) { closeAsyncIteration(iterator, doneAndReject, error, doneAndReject); }; var outerLoop = function () { try { Promise.resolve(anObject(call(state.next, iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve(createIterResultObject(undefined, true)); } else { var value = step.value; try { var result = mapper(value, state.counter++); var handler = function (mapped) { try { state.inner = getAsyncIteratorFlattenable(mapped); innerLoop(); } catch (error4) { ifAbruptCloseAsyncIterator(error4); } }; if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator); else handler(result); } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } } catch (error2) { doneAndReject(error2); } }, doneAndReject); } catch (error) { doneAndReject(error); } }; var innerLoop = function () { var inner = state.inner; if (inner) { try { Promise.resolve(anObject(call(inner.next, inner.iterator))).then(function (result) { try { if (anObject(result).done) { state.inner = null; outerLoop(); } else resolve(createIterResultObject(result.value, false)); } catch (error1) { ifAbruptCloseAsyncIterator(error1); } }, ifAbruptCloseAsyncIterator); } catch (error) { ifAbruptCloseAsyncIterator(error); } } else outerLoop(); }; innerLoop(); }); }); // `AsyncIterator.prototype.flaMap` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, { flatMap: function flatMap(mapper) { anObject(this); aCallable(mapper); return new AsyncIteratorProxy(getIteratorDirect(this), { mapper: mapper, inner: null }); } }); /***/ }), /* 232 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var isCallable = __webpack_require__(20); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var getIteratorMethod = __webpack_require__(97); var getMethod = __webpack_require__(29); var wellKnownSymbol = __webpack_require__(33); var AsyncFromSyncIterator = __webpack_require__(182); var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); module.exports = function (obj) { var object = anObject(obj); var alreadyAsync = true; var method = getMethod(object, ASYNC_ITERATOR); var iterator; if (!isCallable(method)) { method = getIteratorMethod(object); alreadyAsync = false; } if (method !== undefined) { iterator = call(method, object); } else { iterator = object; alreadyAsync = true; } anObject(iterator); return getIteratorDirect(alreadyAsync ? iterator : new AsyncFromSyncIterator(getIteratorDirect(iterator))); }; /***/ }), /* 233 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $forEach = __webpack_require__(187).forEach; // `AsyncIterator.prototype.forEach` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { forEach: function forEach(fn) { return $forEach(this, fn); } }); /***/ }), /* 234 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var toObject = __webpack_require__(39); var isPrototypeOf = __webpack_require__(24); var getAsyncIteratorFlattenable = __webpack_require__(232); var AsyncIteratorPrototype = __webpack_require__(184); var WrapAsyncIterator = __webpack_require__(235); var IS_PURE = __webpack_require__(35); // `AsyncIterator.from` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', stat: true, forced: IS_PURE }, { from: function from(O) { var iteratorRecord = getAsyncIteratorFlattenable(typeof O == 'string' ? toObject(O) : O); return isPrototypeOf(AsyncIteratorPrototype, iteratorRecord.iterator) ? iteratorRecord.iterator : new WrapAsyncIterator(iteratorRecord); } }); /***/ }), /* 235 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var createAsyncIteratorProxy = __webpack_require__(224); module.exports = createAsyncIteratorProxy(function () { return call(this.next, this.iterator); }, true); /***/ }), /* 236 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var indexed = __webpack_require__(222); // `AsyncIterator.prototype.indexed` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { indexed: indexed }); /***/ }), /* 237 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var map = __webpack_require__(223); var IS_PURE = __webpack_require__(35); // `AsyncIterator.prototype.map` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, { map: map }); /***/ }), /* 238 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var isObject = __webpack_require__(19); var getBuiltIn = __webpack_require__(23); var getIteratorDirect = __webpack_require__(186); var closeAsyncIteration = __webpack_require__(188); var Promise = getBuiltIn('Promise'); var $TypeError = TypeError; // `AsyncIterator.prototype.reduce` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { anObject(this); aCallable(reducer); var record = getIteratorDirect(this); var iterator = record.iterator; var next = record.next; var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; var counter = 0; return new Promise(function (resolve, reject) { var ifAbruptCloseAsyncIterator = function (error) { closeAsyncIteration(iterator, reject, error, reject); }; var loop = function () { try { Promise.resolve(anObject(call(next, iterator))).then(function (step) { try { if (anObject(step).done) { noInitial ? reject(new $TypeError('Reduce of empty iterator with no initial value')) : resolve(accumulator); } else { var value = step.value; if (noInitial) { noInitial = false; accumulator = value; loop(); } else try { var result = reducer(accumulator, value, counter); var handler = function ($result) { accumulator = $result; loop(); }; if (isObject(result)) Promise.resolve(result).then(handler, ifAbruptCloseAsyncIterator); else handler(result); } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } counter++; } catch (error2) { reject(error2); } }, reject); } catch (error) { reject(error); } }; loop(); }); } }); /***/ }), /* 239 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $some = __webpack_require__(187).some; // `AsyncIterator.prototype.some` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { some: function some(predicate) { return $some(this, predicate); } }); /***/ }), /* 240 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var notANaN = __webpack_require__(227); var toPositiveInteger = __webpack_require__(172); var createAsyncIteratorProxy = __webpack_require__(224); var createIterResultObject = __webpack_require__(185); var IS_PURE = __webpack_require__(35); var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) { var state = this; var iterator = state.iterator; var returnMethod; if (!state.remaining--) { var resultDone = createIterResultObject(undefined, true); state.done = true; returnMethod = iterator['return']; if (returnMethod !== undefined) { return Promise.resolve(call(returnMethod, iterator, undefined)).then(function () { return resultDone; }); } return resultDone; } return Promise.resolve(call(state.next, iterator)).then(function (step) { if (anObject(step).done) { state.done = true; return createIterResultObject(undefined, true); } return createIterResultObject(step.value, false); }).then(null, function (error) { state.done = true; throw error; }); }); // `AsyncIterator.prototype.take` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true, forced: IS_PURE }, { take: function take(limit) { anObject(this); var remaining = toPositiveInteger(notANaN(+limit)); return new AsyncIteratorProxy(getIteratorDirect(this), { remaining: remaining }); } }); /***/ }), /* 241 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var $toArray = __webpack_require__(187).toArray; // `AsyncIterator.prototype.toArray` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'AsyncIterator', proto: true, real: true }, { toArray: function toArray() { return $toArray(this, undefined, []); } }); /***/ }), /* 242 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-bigint -- safe */ var $ = __webpack_require__(2); var NumericRangeIterator = __webpack_require__(243); // `BigInt.range` method // https://github.com/tc39/proposal-Number.range // TODO: Remove from `core-js@4` if (typeof BigInt == 'function') { $({ target: 'BigInt', stat: true, forced: true }, { range: function range(start, end, option) { return new NumericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1)); } }); } /***/ }), /* 243 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var InternalStateModule = __webpack_require__(51); var createIteratorConstructor = __webpack_require__(244); var createIterResultObject = __webpack_require__(185); var isNullOrUndefined = __webpack_require__(16); var isObject = __webpack_require__(19); var defineBuiltInAccessor = __webpack_require__(119); var DESCRIPTORS = __webpack_require__(5); var INCORRECT_RANGE = 'Incorrect Iterator.range arguments'; var NUMERIC_RANGE_ITERATOR = 'NumericRangeIterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(NUMERIC_RANGE_ITERATOR); var $RangeError = RangeError; var $TypeError = TypeError; var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) { // TODO: Drop the first `typeof` check after removing legacy methods in `core-js@4` if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) { throw new $TypeError(INCORRECT_RANGE); } if (start === Infinity || start === -Infinity) { throw new $RangeError(INCORRECT_RANGE); } var ifIncrease = end > start; var inclusiveEnd = false; var step; if (option === undefined) { step = undefined; } else if (isObject(option)) { step = option.step; inclusiveEnd = !!option.inclusive; } else if (typeof option == type) { step = option; } else { throw new $TypeError(INCORRECT_RANGE); } if (isNullOrUndefined(step)) { step = ifIncrease ? one : -one; } if (typeof step != type) { throw new $TypeError(INCORRECT_RANGE); } if (step === Infinity || step === -Infinity || (step === zero && start !== end)) { throw new $RangeError(INCORRECT_RANGE); } // eslint-disable-next-line no-self-compare -- NaN check var hitsEnd = start !== start || end !== end || step !== step || (end > start) !== (step > zero); setInternalState(this, { type: NUMERIC_RANGE_ITERATOR, start: start, end: end, step: step, inclusive: inclusiveEnd, hitsEnd: hitsEnd, currentCount: zero, zero: zero }); if (!DESCRIPTORS) { this.start = start; this.end = end; this.step = step; this.inclusive = inclusiveEnd; } }, NUMERIC_RANGE_ITERATOR, function next() { var state = getInternalState(this); if (state.hitsEnd) return createIterResultObject(undefined, true); var start = state.start; var end = state.end; var step = state.step; var currentYieldingValue = start + (step * state.currentCount++); if (currentYieldingValue === end) state.hitsEnd = true; var inclusiveEnd = state.inclusive; var endCondition; if (end > start) { endCondition = inclusiveEnd ? currentYieldingValue > end : currentYieldingValue >= end; } else { endCondition = inclusiveEnd ? end > currentYieldingValue : end >= currentYieldingValue; } if (endCondition) { state.hitsEnd = true; return createIterResultObject(undefined, true); } return createIterResultObject(currentYieldingValue, false); }); var addGetter = function (key) { defineBuiltInAccessor($RangeIterator.prototype, key, { get: function () { return getInternalState(this)[key]; }, set: function () { /* empty */ }, configurable: true, enumerable: false }); }; if (DESCRIPTORS) { addGetter('start'); addGetter('end'); addGetter('inclusive'); addGetter('step'); } module.exports = $RangeIterator; /***/ }), /* 244 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IteratorPrototype = __webpack_require__(245).IteratorPrototype; var create = __webpack_require__(87); var createPropertyDescriptor = __webpack_require__(10); var setToStringTag = __webpack_require__(123); var Iterators = __webpack_require__(95); var returnThis = function () { return this; }; module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; /***/ }), /* 245 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var create = __webpack_require__(87); var getPrototypeOf = __webpack_require__(85); var defineBuiltIn = __webpack_require__(47); var wellKnownSymbol = __webpack_require__(33); var IS_PURE = __webpack_require__(35); var ITERATOR = wellKnownSymbol('iterator'); var BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; /* eslint-disable es/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () { var test = {}; // FF44- legacy iterators case return IteratorPrototype[ITERATOR].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable(IteratorPrototype[ITERATOR])) { defineBuiltIn(IteratorPrototype, ITERATOR, function () { return this; }); } module.exports = { IteratorPrototype: IteratorPrototype, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; /***/ }), /* 246 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var apply = __webpack_require__(68); var getCompositeKeyNode = __webpack_require__(247); var getBuiltIn = __webpack_require__(23); var create = __webpack_require__(87); var $Object = Object; var initializer = function () { var freeze = getBuiltIn('Object', 'freeze'); return freeze ? freeze(create(null)) : create(null); }; // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey $({ global: true, forced: true }, { compositeKey: function compositeKey() { return apply(getCompositeKeyNode, $Object, arguments).get('object', initializer); } }); /***/ }), /* 247 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` __webpack_require__(248); __webpack_require__(260); var getBuiltIn = __webpack_require__(23); var create = __webpack_require__(87); var isObject = __webpack_require__(19); var $Object = Object; var $TypeError = TypeError; var Map = getBuiltIn('Map'); var WeakMap = getBuiltIn('WeakMap'); var Node = function () { // keys this.object = null; this.symbol = null; // child nodes this.primitives = null; this.objectsByIndex = create(null); }; Node.prototype.get = function (key, initializer) { return this[key] || (this[key] = initializer()); }; Node.prototype.next = function (i, it, IS_OBJECT) { var store = IS_OBJECT ? this.objectsByIndex[i] || (this.objectsByIndex[i] = new WeakMap()) : this.primitives || (this.primitives = new Map()); var entry = store.get(it); if (!entry) store.set(it, entry = new Node()); return entry; }; var root = new Node(); module.exports = function () { var active = root; var length = arguments.length; var i, it; // for prevent leaking, start from objects for (i = 0; i < length; i++) { if (isObject(it = arguments[i])) active = active.next(i, it, true); } if (this === $Object && active === root) throw new $TypeError('Composite keys must contain a non-primitive component'); for (i = 0; i < length; i++) { if (!isObject(it = arguments[i])) active = active.next(i, it, false); } return active; }; /***/ }), /* 248 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(249); /***/ }), /* 249 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var collection = __webpack_require__(250); var collectionStrong = __webpack_require__(258); // `Map` constructor // https://tc39.es/ecma262/#sec-map-objects collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), /* 250 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var uncurryThis = __webpack_require__(13); var isForced = __webpack_require__(67); var defineBuiltIn = __webpack_require__(47); var InternalMetadataModule = __webpack_require__(251); var iterate = __webpack_require__(91); var anInstance = __webpack_require__(125); var isCallable = __webpack_require__(20); var isNullOrUndefined = __webpack_require__(16); var isObject = __webpack_require__(19); var fails = __webpack_require__(6); var checkCorrectnessOfIteration = __webpack_require__(146); var setToStringTag = __webpack_require__(123); var inheritIfRequired = __webpack_require__(74); module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; var fixMethod = function (KEY) { var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]); defineBuiltIn(NativePrototype, KEY, KEY === 'add' ? function add(value) { uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; } : KEY === 'delete' ? function (key) { return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY === 'get' ? function get(key) { return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY === 'has' ? function has(key) { return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : function set(key, value) { uncurriedNativeMethod(this, key === 0 ? 0 : key, value); return this; } ); }; var REPLACE = isForced( CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) ); if (REPLACE) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.enable(); } else if (isForced(CONSTRUCTOR_NAME, true)) { var instance = new Constructor(); // early implementations not supports chaining var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) !== instance; // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); // most early implementations doesn't supports iterables, most modern - not close it correctly // eslint-disable-next-line no-new -- required for testing var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); // for early implementations -0 and +0 not the same var BUGGY_ZERO = !IS_WEAK && fails(function () { // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new NativeConstructor(); var index = 5; while (index--) $instance[ADDER](index, index); return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { Constructor = wrapper(function (dummy, iterable) { anInstance(dummy, NativePrototype); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); return that; }); Constructor.prototype = NativePrototype; NativePrototype.constructor = Constructor; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); // weak collections should not contains .clear method if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; } exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, constructor: true, forced: Constructor !== NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; /***/ }), /* 251 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var hiddenKeys = __webpack_require__(54); var isObject = __webpack_require__(19); var hasOwn = __webpack_require__(38); var defineProperty = __webpack_require__(44).f; var getOwnPropertyNamesModule = __webpack_require__(57); var getOwnPropertyNamesExternalModule = __webpack_require__(252); var isExtensible = __webpack_require__(255); var uid = __webpack_require__(40); var FREEZING = __webpack_require__(257); var REQUIRED = false; var METADATA = uid('meta'); var id = 0; var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID weakData: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData = function (it, create) { if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it); return it; }; var enable = function () { meta.enable = function () { /* empty */ }; REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; var splice = uncurryThis([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key if (getOwnPropertyNames(test).length) { getOwnPropertyNamesModule.f = function (it) { var result = getOwnPropertyNames(it); for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { splice(result, i, 1); break; } } return result; }; $({ target: 'Object', stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = module.exports = { enable: enable, fastKey: fastKey, getWeakData: getWeakData, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; /***/ }), /* 252 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-object-getownpropertynames -- safe */ var classof = __webpack_require__(14); var toIndexedObject = __webpack_require__(11); var $getOwnPropertyNames = __webpack_require__(57).f; var arraySlice = __webpack_require__(253); var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames(it); } catch (error) { return arraySlice(windowNames); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { return windowNames && classof(it) === 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); }; /***/ }), /* 253 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toAbsoluteIndex = __webpack_require__(60); var lengthOfArrayLike = __webpack_require__(63); var createProperty = __webpack_require__(254); var $Array = Array; var max = Math.max; module.exports = function (O, start, end) { var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); var result = $Array(max(fin - k, 0)); var n = 0; for (; k < fin; k++, n++) createProperty(result, n, O[k]); result.length = n; return result; }; /***/ }), /* 254 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPropertyKey = __webpack_require__(17); var definePropertyModule = __webpack_require__(44); var createPropertyDescriptor = __webpack_require__(10); module.exports = function (object, key, value) { var propertyKey = toPropertyKey(key); if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); else object[propertyKey] = value; }; /***/ }), /* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); var isObject = __webpack_require__(19); var classof = __webpack_require__(14); var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(256); // eslint-disable-next-line es/no-object-isextensible -- safe var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); }); // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { if (!isObject(it)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) === 'ArrayBuffer') return false; return $isExtensible ? $isExtensible(it) : true; } : $isExtensible; /***/ }), /* 256 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it var fails = __webpack_require__(6); module.exports = fails(function () { if (typeof ArrayBuffer == 'function') { var buffer = new ArrayBuffer(8); // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); } }); /***/ }), /* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); module.exports = !fails(function () { // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); /***/ }), /* 258 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var create = __webpack_require__(87); var defineBuiltInAccessor = __webpack_require__(119); var defineBuiltIns = __webpack_require__(183); var bind = __webpack_require__(92); var anInstance = __webpack_require__(125); var isNullOrUndefined = __webpack_require__(16); var iterate = __webpack_require__(91); var defineIterator = __webpack_require__(259); var createIterResultObject = __webpack_require__(185); var setSpecies = __webpack_require__(124); var DESCRIPTORS = __webpack_require__(5); var fastKey = __webpack_require__(251).fastKey; var InternalStateModule = __webpack_require__(51); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create(null), first: undefined, last: undefined, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index; // change existing entry if (entry) { entry.value = value; // create new entry } else { state.last = entry = { index: index = fastKey(key, true), key: key, value: value, previous: previous = state.last, next: undefined, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; // add to index if (index !== 'F') state.index[index] = entry; } return that; }; var getEntry = function (that, key) { var state = getInternalState(that); // fast case var index = fastKey(key); var entry; if (index !== 'F') return state.index[index]; // frozen object case for (entry = state.first; entry; entry = entry.next) { if (entry.key === key) return entry; } }; defineBuiltIns(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear clear: function clear() { var that = this; var state = getInternalState(that); var data = state.index; var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = undefined; delete data[entry.index]; entry = entry.next; } state.first = state.last = undefined; if (DESCRIPTORS) state.size = 0; else that.size = 0; }, // `{ Map, Set }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.delete // https://tc39.es/ecma262/#sec-set.prototype.delete 'delete': function (key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next; if (next) next.previous = prev; if (state.first === entry) state.first = next; if (state.last === entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods // https://tc39.es/ecma262/#sec-map.prototype.foreach // https://tc39.es/ecma262/#sec-set.prototype.foreach forEach: function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }, // `{ Map, Set}.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.has // https://tc39.es/ecma262/#sec-set.prototype.has has: function has(key) { return !!getEntry(this, key); } }); defineBuiltIns(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, // `Map.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-map.prototype.set set: function set(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { // `Set.prototype.add(value)` method // https://tc39.es/ecma262/#sec-set.prototype.add add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineBuiltInAccessor(Prototype, 'size', { configurable: true, get: function () { return getInternalState(this).size; } }); return Constructor; }, setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods // https://tc39.es/ecma262/#sec-map.prototype.entries // https://tc39.es/ecma262/#sec-map.prototype.keys // https://tc39.es/ecma262/#sec-map.prototype.values // https://tc39.es/ecma262/#sec-map.prototype-@@iterator // https://tc39.es/ecma262/#sec-set.prototype.entries // https://tc39.es/ecma262/#sec-set.prototype.keys // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind: kind, last: undefined }); }, function () { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; // get next entry if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { // or finish the iteration state.target = undefined; return createIterResultObject(undefined, true); } // return step by kind if (kind === 'keys') return createIterResultObject(entry.key, false); if (kind === 'values') return createIterResultObject(entry.value, false); return createIterResultObject([entry.key, entry.value], false); }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // `{ Map, Set }.prototype[@@species]` accessors // https://tc39.es/ecma262/#sec-get-map-@@species // https://tc39.es/ecma262/#sec-get-set-@@species setSpecies(CONSTRUCTOR_NAME); } }; /***/ }), /* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var IS_PURE = __webpack_require__(35); var FunctionName = __webpack_require__(49); var isCallable = __webpack_require__(20); var createIteratorConstructor = __webpack_require__(244); var getPrototypeOf = __webpack_require__(85); var setPrototypeOf = __webpack_require__(70); var setToStringTag = __webpack_require__(123); var createNonEnumerableProperty = __webpack_require__(43); var defineBuiltIn = __webpack_require__(47); var wellKnownSymbol = __webpack_require__(33); var Iterators = __webpack_require__(95); var IteratorsCore = __webpack_require__(245); var PROPER_FUNCTION_NAME = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) { defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) { createNonEnumerableProperty(IterablePrototype, 'name', VALUES); } else { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return call(nativeIterator, this); }; } } // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { defineBuiltIn(IterablePrototype, KEY, methods[KEY]); } } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } // define iterator if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); } Iterators[NAME] = defaultIterator; return methods; }; /***/ }), /* 260 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(261); /***/ }), /* 261 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var FREEZING = __webpack_require__(257); var global = __webpack_require__(3); var uncurryThis = __webpack_require__(13); var defineBuiltIns = __webpack_require__(183); var InternalMetadataModule = __webpack_require__(251); var collection = __webpack_require__(250); var collectionWeak = __webpack_require__(262); var isObject = __webpack_require__(19); var enforceInternalState = __webpack_require__(51).enforce; var fails = __webpack_require__(6); var NATIVE_WEAK_MAP = __webpack_require__(52); var $Object = Object; // eslint-disable-next-line es/no-array-isarray -- safe var isArray = Array.isArray; // eslint-disable-next-line es/no-object-isextensible -- safe var isExtensible = $Object.isExtensible; // eslint-disable-next-line es/no-object-isfrozen -- safe var isFrozen = $Object.isFrozen; // eslint-disable-next-line es/no-object-issealed -- safe var isSealed = $Object.isSealed; // eslint-disable-next-line es/no-object-freeze -- safe var freeze = $Object.freeze; // eslint-disable-next-line es/no-object-seal -- safe var seal = $Object.seal; var FROZEN = {}; var SEALED = {}; var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var InternalWeakMap; var wrapper = function (init) { return function WeakMap() { return init(this, arguments.length ? arguments[0] : undefined); }; }; // `WeakMap` constructor // https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = collection('WeakMap', wrapper, collectionWeak); var WeakMapPrototype = $WeakMap.prototype; var nativeSet = uncurryThis(WeakMapPrototype.set); // Chakra Edge bug: adding frozen arrays to WeakMap unfreeze them var hasMSEdgeFreezingBug = function () { return FREEZING && fails(function () { var frozenArray = freeze([]); nativeSet(new $WeakMap(), frozenArray, 1); return !isFrozen(frozenArray); }); }; // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 if (NATIVE_WEAK_MAP) if (IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.enable(); var nativeDelete = uncurryThis(WeakMapPrototype['delete']); var nativeHas = uncurryThis(WeakMapPrototype.has); var nativeGet = uncurryThis(WeakMapPrototype.get); defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else nativeSet(this, key, value); return this; } }); // Chakra Edge frozen keys fix } else if (hasMSEdgeFreezingBug()) { defineBuiltIns(WeakMapPrototype, { set: function set(key, value) { var arrayIntegrityLevel; if (isArray(key)) { if (isFrozen(key)) arrayIntegrityLevel = FROZEN; else if (isSealed(key)) arrayIntegrityLevel = SEALED; } nativeSet(this, key, value); if (arrayIntegrityLevel === FROZEN) freeze(key); if (arrayIntegrityLevel === SEALED) seal(key); return this; } }); } /***/ }), /* 262 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var defineBuiltIns = __webpack_require__(183); var getWeakData = __webpack_require__(251).getWeakData; var anInstance = __webpack_require__(125); var anObject = __webpack_require__(46); var isNullOrUndefined = __webpack_require__(16); var isObject = __webpack_require__(19); var iterate = __webpack_require__(91); var ArrayIterationModule = __webpack_require__(190); var hasOwn = __webpack_require__(38); var InternalStateModule = __webpack_require__(51); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; var splice = uncurryThis([].splice); var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (state) { return state.frozen || (state.frozen = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function () { this.entries = []; }; var findUncaughtFrozen = function (store, key) { return find(store.entries, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function (key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function (key) { return !!findUncaughtFrozen(this, key); }, set: function (key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.entries.push([key, value]); }, 'delete': function (key) { var index = findIndex(this.entries, function (it) { return it[0] === key; }); if (~index) splice(this.entries, index, 1); return !!~index; } }; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined }); if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var data = getWeakData(anObject(key), true); if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value; return that; }; defineBuiltIns(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete 'delete': function (key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)['delete'](key); return data && hasOwn(data, state.id) && delete data[state.id]; }, // `{ WeakMap, WeakSet }.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.has // https://tc39.es/ecma262/#sec-weakset.prototype.has has: function has(key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && hasOwn(data, state.id); } }); defineBuiltIns(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { var state = getInternalState(this); if (isObject(key)) { var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).get(key); return data ? data[state.id] : undefined; } }, // `WeakMap.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.set set: function set(key, value) { return define(this, key, value); } } : { // `WeakSet.prototype.add(value)` method // https://tc39.es/ecma262/#sec-weakset.prototype.add add: function add(value) { return define(this, value, true); } }); return Constructor; } }; /***/ }), /* 263 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getCompositeKeyNode = __webpack_require__(247); var getBuiltIn = __webpack_require__(23); var apply = __webpack_require__(68); // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey $({ global: true, forced: true }, { compositeSymbol: function compositeSymbol() { if (arguments.length === 1 && typeof arguments[0] == 'string') return getBuiltIn('Symbol')['for'](arguments[0]); return apply(getCompositeKeyNode, null, arguments).get('symbol', getBuiltIn('Symbol')); } }); /***/ }), /* 264 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var unpackIEEE754 = __webpack_require__(265).unpack; // eslint-disable-next-line es/no-typed-arrays -- safe var getUint16 = uncurryThis(DataView.prototype.getUint16); // `DataView.prototype.getFloat16` method // https://github.com/tc39/proposal-float16array $({ target: 'DataView', proto: true }, { getFloat16: function getFloat16(byteOffset /* , littleEndian */) { var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false); return unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10); } }); /***/ }), /* 265 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // IEEE754 conversions based on https://github.com/feross/ieee754 var $Array = Array; var abs = Math.abs; var pow = Math.pow; var floor = Math.floor; var log = Math.log; var LN2 = Math.LN2; var pack = function (number, mantissaLength, bytes) { var buffer = $Array(bytes); var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0; var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0; var index = 0; var exponent, mantissa, c; number = abs(number); // eslint-disable-next-line no-self-compare -- NaN check if (number !== number || number === Infinity) { // eslint-disable-next-line no-self-compare -- NaN check mantissa = number !== number ? 1 : 0; exponent = eMax; } else { exponent = floor(log(number) / LN2); c = pow(2, -exponent); if (number * c < 1) { exponent--; c *= 2; } if (exponent + eBias >= 1) { number += rt / c; } else { number += rt * pow(2, 1 - eBias); } if (number * c >= 2) { exponent++; c /= 2; } if (exponent + eBias >= eMax) { mantissa = 0; exponent = eMax; } else if (exponent + eBias >= 1) { mantissa = (number * c - 1) * pow(2, mantissaLength); exponent += eBias; } else { mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength); exponent = 0; } } while (mantissaLength >= 8) { buffer[index++] = mantissa & 255; mantissa /= 256; mantissaLength -= 8; } exponent = exponent << mantissaLength | mantissa; exponentLength += mantissaLength; while (exponentLength > 0) { buffer[index++] = exponent & 255; exponent /= 256; exponentLength -= 8; } buffer[--index] |= sign * 128; return buffer; }; var unpack = function (buffer, mantissaLength) { var bytes = buffer.length; var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; var nBits = exponentLength - 7; var index = bytes - 1; var sign = buffer[index--]; var exponent = sign & 127; var mantissa; sign >>= 7; while (nBits > 0) { exponent = exponent * 256 + buffer[index--]; nBits -= 8; } mantissa = exponent & (1 << -nBits) - 1; exponent >>= -nBits; nBits += mantissaLength; while (nBits > 0) { mantissa = mantissa * 256 + buffer[index--]; nBits -= 8; } if (exponent === 0) { exponent = 1 - eBias; } else if (exponent === eMax) { return mantissa ? NaN : sign ? -Infinity : Infinity; } else { mantissa += pow(2, mantissaLength); exponent -= eBias; } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength); }; module.exports = { pack: pack, unpack: unpack }; /***/ }), /* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); // eslint-disable-next-line es/no-typed-arrays -- safe var getUint8 = uncurryThis(DataView.prototype.getUint8); // `DataView.prototype.getUint8Clamped` method // https://github.com/tc39/proposal-dataview-get-set-uint8clamped $({ target: 'DataView', proto: true, forced: true }, { getUint8Clamped: function getUint8Clamped(byteOffset) { return getUint8(this, byteOffset); } }); /***/ }), /* 267 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var classof = __webpack_require__(77); var toIndex = __webpack_require__(213); var packIEEE754 = __webpack_require__(265).pack; var f16round = __webpack_require__(268); var $TypeError = TypeError; // eslint-disable-next-line es/no-typed-arrays -- safe var setUint16 = uncurryThis(DataView.prototype.setUint16); // `DataView.prototype.setFloat16` method // https://github.com/tc39/proposal-float16array $({ target: 'DataView', proto: true }, { setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) { if (classof(this) !== 'DataView') throw new $TypeError('Incorrect receiver'); var offset = toIndex(byteOffset); var bytes = packIEEE754(f16round(value), 10, 2); return setUint16(this, offset, bytes[1] << 8 | bytes[0], arguments.length > 2 ? arguments[2] : false); } }); /***/ }), /* 268 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var floatRound = __webpack_require__(269); var FLOAT16_EPSILON = 0.0009765625; var FLOAT16_MAX_VALUE = 65504; var FLOAT16_MIN_VALUE = 6.103515625e-05; // `Math.f16round` method implementation // https://github.com/tc39/proposal-float16array module.exports = Math.f16round || function f16round(x) { return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE); }; /***/ }), /* 269 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var sign = __webpack_require__(270); var abs = Math.abs; var EPSILON = 2.220446049250313e-16; // Number.EPSILON var INVERSE_EPSILON = 1 / EPSILON; var roundTiesToEven = function (n) { return n + INVERSE_EPSILON - INVERSE_EPSILON; }; module.exports = function (x, FLOAT_EPSILON, FLOAT_MAX_VALUE, FLOAT_MIN_VALUE) { var n = +x; var absolute = abs(n); var s = sign(n); if (absolute < FLOAT_MIN_VALUE) return s * roundTiesToEven(absolute / FLOAT_MIN_VALUE / FLOAT_EPSILON) * FLOAT_MIN_VALUE * FLOAT_EPSILON; var a = (1 + FLOAT_EPSILON / EPSILON) * absolute; var result = a - (a - absolute); // eslint-disable-next-line no-self-compare -- NaN check if (result > FLOAT_MAX_VALUE || result !== result) return s * Infinity; return s * result; }; /***/ }), /* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `Math.sign` method implementation // https://tc39.es/ecma262/#sec-math.sign // eslint-disable-next-line es/no-math-sign -- safe module.exports = Math.sign || function sign(x) { var n = +x; // eslint-disable-next-line no-self-compare -- NaN check return n === 0 || n !== n ? n : n < 0 ? -1 : 1; }; /***/ }), /* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var classof = __webpack_require__(77); var toIndex = __webpack_require__(213); var toUint8Clamped = __webpack_require__(272); var $TypeError = TypeError; // eslint-disable-next-line es/no-typed-arrays -- safe var setUint8 = uncurryThis(DataView.prototype.setUint8); // `DataView.prototype.setUint8Clamped` method // https://github.com/tc39/proposal-dataview-get-set-uint8clamped $({ target: 'DataView', proto: true, forced: true }, { setUint8Clamped: function setUint8Clamped(byteOffset, value) { if (classof(this) !== 'DataView') throw new $TypeError('Incorrect receiver'); var offset = toIndex(byteOffset); return setUint8(this, offset, toUint8Clamped(value)); } }); /***/ }), /* 272 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var round = Math.round; module.exports = function (it) { var value = round(it); return value < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF; }; /***/ }), /* 273 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-explicit-resource-management var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); var getBuiltIn = __webpack_require__(23); var aCallable = __webpack_require__(30); var anInstance = __webpack_require__(125); var defineBuiltIn = __webpack_require__(47); var defineBuiltIns = __webpack_require__(183); var defineBuiltInAccessor = __webpack_require__(119); var wellKnownSymbol = __webpack_require__(33); var InternalStateModule = __webpack_require__(51); var addDisposableResource = __webpack_require__(219); var SuppressedError = getBuiltIn('SuppressedError'); var $ReferenceError = ReferenceError; var DISPOSE = wellKnownSymbol('dispose'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var DISPOSABLE_STACK = 'DisposableStack'; var setInternalState = InternalStateModule.set; var getDisposableStackInternalState = InternalStateModule.getterFor(DISPOSABLE_STACK); var HINT = 'sync-dispose'; var DISPOSED = 'disposed'; var PENDING = 'pending'; var getPendingDisposableStackInternalState = function (stack) { var internalState = getDisposableStackInternalState(stack); if (internalState.state === DISPOSED) throw new $ReferenceError(DISPOSABLE_STACK + ' already disposed'); return internalState; }; var $DisposableStack = function DisposableStack() { setInternalState(anInstance(this, DisposableStackPrototype), { type: DISPOSABLE_STACK, state: PENDING, stack: [] }); if (!DESCRIPTORS) this.disposed = false; }; var DisposableStackPrototype = $DisposableStack.prototype; defineBuiltIns(DisposableStackPrototype, { dispose: function dispose() { var internalState = getDisposableStackInternalState(this); if (internalState.state === DISPOSED) return; internalState.state = DISPOSED; if (!DESCRIPTORS) this.disposed = true; var stack = internalState.stack; var i = stack.length; var thrown = false; var suppressed; while (i) { var disposeMethod = stack[--i]; stack[i] = null; try { disposeMethod(); } catch (errorResult) { if (thrown) { suppressed = new SuppressedError(errorResult, suppressed); } else { thrown = true; suppressed = errorResult; } } } internalState.stack = null; if (thrown) throw suppressed; }, use: function use(value) { addDisposableResource(getPendingDisposableStackInternalState(this), value, HINT); return value; }, adopt: function adopt(value, onDispose) { var internalState = getPendingDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, function () { onDispose(value); }); return value; }, defer: function defer(onDispose) { var internalState = getPendingDisposableStackInternalState(this); aCallable(onDispose); addDisposableResource(internalState, undefined, HINT, onDispose); }, move: function move() { var internalState = getPendingDisposableStackInternalState(this); var newDisposableStack = new $DisposableStack(); getDisposableStackInternalState(newDisposableStack).stack = internalState.stack; internalState.stack = []; internalState.state = DISPOSED; if (!DESCRIPTORS) this.disposed = true; return newDisposableStack; } }); if (DESCRIPTORS) defineBuiltInAccessor(DisposableStackPrototype, 'disposed', { configurable: true, get: function disposed() { return getDisposableStackInternalState(this).state === DISPOSED; } }); defineBuiltIn(DisposableStackPrototype, DISPOSE, DisposableStackPrototype.dispose, { name: 'dispose' }); defineBuiltIn(DisposableStackPrototype, TO_STRING_TAG, DISPOSABLE_STACK, { nonWritable: true }); $({ global: true, constructor: true }, { DisposableStack: $DisposableStack }); /***/ }), /* 274 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var demethodize = __webpack_require__(275); // `Function.prototype.demethodize` method // https://github.com/js-choi/proposal-function-demethodize $({ target: 'Function', proto: true, forced: true }, { demethodize: demethodize }); /***/ }), /* 275 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); module.exports = function demethodize() { return uncurryThis(aCallable(this)); }; /***/ }), /* 276 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var $isCallable = __webpack_require__(20); var inspectSource = __webpack_require__(50); var hasOwn = __webpack_require__(38); var DESCRIPTORS = __webpack_require__(5); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var classRegExp = /^\s*class\b/; var exec = uncurryThis(classRegExp.exec); var isClassConstructor = function (argument) { try { // `Function#toString` throws on some built-it function in some legacy engines // (for example, `DOMQuad` and similar in FF41-) if (!DESCRIPTORS || !exec(classRegExp, inspectSource(argument))) return false; } catch (error) { /* empty */ } var prototype = getOwnPropertyDescriptor(argument, 'prototype'); return !!prototype && hasOwn(prototype, 'writable') && !prototype.writable; }; // `Function.isCallable` method // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md $({ target: 'Function', stat: true, sham: true, forced: true }, { isCallable: function isCallable(argument) { return $isCallable(argument) && !isClassConstructor(argument); } }); /***/ }), /* 277 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isConstructor = __webpack_require__(128); // `Function.isConstructor` method // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md $({ target: 'Function', stat: true, forced: true }, { isConstructor: isConstructor }); /***/ }), /* 278 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); var defineProperty = __webpack_require__(44).f; var METADATA = wellKnownSymbol('metadata'); var FunctionPrototype = Function.prototype; // Function.prototype[@@metadata] // https://github.com/tc39/proposal-decorator-metadata if (FunctionPrototype[METADATA] === undefined) { defineProperty(FunctionPrototype, METADATA, { value: null }); } /***/ }), /* 279 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var demethodize = __webpack_require__(275); // `Function.prototype.unThis` method // https://github.com/js-choi/proposal-function-demethodize // TODO: Remove from `core-js@4` $({ target: 'Function', proto: true, forced: true, name: 'demethodize' }, { unThis: demethodize }); /***/ }), /* 280 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var anInstance = __webpack_require__(125); var isCallable = __webpack_require__(20); var getPrototypeOf = __webpack_require__(85); var createNonEnumerableProperty = __webpack_require__(43); var fails = __webpack_require__(6); var hasOwn = __webpack_require__(38); var wellKnownSymbol = __webpack_require__(33); var IteratorPrototype = __webpack_require__(245).IteratorPrototype; var IS_PURE = __webpack_require__(35); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $TypeError = TypeError; var NativeIterator = global.Iterator; // FF56- have non-standard global helper `Iterator` var FORCED = IS_PURE || !isCallable(NativeIterator) || NativeIterator.prototype !== IteratorPrototype // FF44- non-standard `Iterator` passes previous tests || !fails(function () { NativeIterator({}); }); var IteratorConstructor = function Iterator() { anInstance(this, IteratorPrototype); if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable'); }; if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) { createNonEnumerableProperty(IteratorPrototype, TO_STRING_TAG, 'Iterator'); } if (FORCED || !hasOwn(IteratorPrototype, 'constructor') || IteratorPrototype.constructor === Object) { createNonEnumerableProperty(IteratorPrototype, 'constructor', IteratorConstructor); } IteratorConstructor.prototype = IteratorPrototype; // `Iterator` constructor // https://github.com/tc39/proposal-iterator-helpers $({ global: true, constructor: true, forced: FORCED }, { Iterator: IteratorConstructor }); /***/ }), /* 281 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var indexed = __webpack_require__(282); // `Iterator.prototype.asIndexedPairs` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', name: 'indexed', proto: true, real: true, forced: true }, { asIndexedPairs: indexed }); /***/ }), /* 282 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var map = __webpack_require__(283); var callback = function (value, counter) { return [counter, value]; }; // `Iterator.prototype.indexed` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function indexed() { return call(map, this, callback); }; /***/ }), /* 283 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var createIteratorProxy = __webpack_require__(284); var callWithSafeIterationClosing = __webpack_require__(285); var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var result = anObject(call(this.next, iterator)); var done = this.done = !!result.done; if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true); }); // `Iterator.prototype.map` method // https://github.com/tc39/proposal-iterator-helpers module.exports = function map(mapper) { anObject(this); aCallable(mapper); return new IteratorProxy(getIteratorDirect(this), { mapper: mapper }); }; /***/ }), /* 284 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var create = __webpack_require__(87); var createNonEnumerableProperty = __webpack_require__(43); var defineBuiltIns = __webpack_require__(183); var wellKnownSymbol = __webpack_require__(33); var InternalStateModule = __webpack_require__(51); var getMethod = __webpack_require__(29); var IteratorPrototype = __webpack_require__(245).IteratorPrototype; var createIterResultObject = __webpack_require__(185); var iteratorClose = __webpack_require__(98); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ITERATOR_HELPER = 'IteratorHelper'; var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator'; var setInternalState = InternalStateModule.set; var createIteratorProxyPrototype = function (IS_ITERATOR) { var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER); return defineBuiltIns(create(IteratorPrototype), { next: function next() { var state = getInternalState(this); // for simplification: // for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject` // for `%IteratorHelperPrototype%.next` - just a value if (IS_ITERATOR) return state.nextHandler(); try { var result = state.done ? undefined : state.nextHandler(); return createIterResultObject(result, state.done); } catch (error) { state.done = true; throw error; } }, 'return': function () { var state = getInternalState(this); var iterator = state.iterator; state.done = true; if (IS_ITERATOR) { var returnMethod = getMethod(iterator, 'return'); return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true); } if (state.inner) try { iteratorClose(state.inner.iterator, 'normal'); } catch (error) { return iteratorClose(iterator, 'throw', error); } iteratorClose(iterator, 'normal'); return createIterResultObject(undefined, true); } }); }; var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true); var IteratorHelperPrototype = createIteratorProxyPrototype(false); createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper'); module.exports = function (nextHandler, IS_ITERATOR) { var IteratorProxy = function Iterator(record, state) { if (state) { state.iterator = record.iterator; state.next = record.next; } else state = record; state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER; state.nextHandler = nextHandler; state.counter = 0; state.done = false; setInternalState(this, state); }; IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype; return IteratorProxy; }; /***/ }), /* 285 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(46); var iteratorClose = __webpack_require__(98); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); } catch (error) { iteratorClose(iterator, 'throw', error); } }; /***/ }), /* 286 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-explicit-resource-management var call = __webpack_require__(7); var defineBuiltIn = __webpack_require__(47); var getMethod = __webpack_require__(29); var hasOwn = __webpack_require__(38); var wellKnownSymbol = __webpack_require__(33); var IteratorPrototype = __webpack_require__(245).IteratorPrototype; var DISPOSE = wellKnownSymbol('dispose'); if (!hasOwn(IteratorPrototype, DISPOSE)) { defineBuiltIn(IteratorPrototype, DISPOSE, function () { var $return = getMethod(this, 'return'); if ($return) call($return, this); }); } /***/ }), /* 287 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var notANaN = __webpack_require__(227); var toPositiveInteger = __webpack_require__(172); var createIteratorProxy = __webpack_require__(284); var IS_PURE = __webpack_require__(35); var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var next = this.next; var result, done; while (this.remaining) { this.remaining--; result = anObject(call(next, iterator)); done = this.done = !!result.done; if (done) return; } result = anObject(call(next, iterator)); done = this.done = !!result.done; if (!done) return result.value; }); // `Iterator.prototype.drop` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { drop: function drop(limit) { anObject(this); var remaining = toPositiveInteger(notANaN(+limit)); return new IteratorProxy(getIteratorDirect(this), { remaining: remaining }); } }); /***/ }), /* 288 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); // `Iterator.prototype.every` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { every: function every(predicate) { anObject(this); aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; return !iterate(record, function (value, stop) { if (!predicate(value, counter++)) return stop(); }, { IS_RECORD: true, INTERRUPTED: true }).stopped; } }); /***/ }), /* 289 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var createIteratorProxy = __webpack_require__(284); var callWithSafeIterationClosing = __webpack_require__(285); var IS_PURE = __webpack_require__(35); var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var predicate = this.predicate; var next = this.next; var result, done, value; while (true) { result = anObject(call(next, iterator)); done = this.done = !!result.done; if (done) return; value = result.value; if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value; } }); // `Iterator.prototype.filter` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { filter: function filter(predicate) { anObject(this); aCallable(predicate); return new IteratorProxy(getIteratorDirect(this), { predicate: predicate }); } }); /***/ }), /* 290 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); // `Iterator.prototype.find` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { find: function find(predicate) { anObject(this); aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; return iterate(record, function (value, stop) { if (predicate(value, counter++)) return stop(value); }, { IS_RECORD: true, INTERRUPTED: true }).result; } }); /***/ }), /* 291 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var getIteratorFlattenable = __webpack_require__(292); var createIteratorProxy = __webpack_require__(284); var iteratorClose = __webpack_require__(98); var IS_PURE = __webpack_require__(35); var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var mapper = this.mapper; var result, inner; while (true) { if (inner = this.inner) try { result = anObject(call(inner.next, inner.iterator)); if (!result.done) return result.value; this.inner = null; } catch (error) { iteratorClose(iterator, 'throw', error); } result = anObject(call(this.next, iterator)); if (this.done = !!result.done) return; try { this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false); } catch (error) { iteratorClose(iterator, 'throw', error); } } }); // `Iterator.prototype.flatMap` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { flatMap: function flatMap(mapper) { anObject(this); aCallable(mapper); return new IteratorProxy(getIteratorDirect(this), { mapper: mapper, inner: null }); } }); /***/ }), /* 292 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var getIteratorMethod = __webpack_require__(97); module.exports = function (obj, stringHandling) { if (!stringHandling || typeof obj !== 'string') anObject(obj); var method = getIteratorMethod(obj); return getIteratorDirect(anObject(method !== undefined ? call(method, obj) : obj)); }; /***/ }), /* 293 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); // `Iterator.prototype.forEach` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { forEach: function forEach(fn) { anObject(this); aCallable(fn); var record = getIteratorDirect(this); var counter = 0; iterate(record, function (value) { fn(value, counter++); }, { IS_RECORD: true }); } }); /***/ }), /* 294 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toObject = __webpack_require__(39); var isPrototypeOf = __webpack_require__(24); var IteratorPrototype = __webpack_require__(245).IteratorPrototype; var createIteratorProxy = __webpack_require__(284); var getIteratorFlattenable = __webpack_require__(292); var IS_PURE = __webpack_require__(35); var IteratorProxy = createIteratorProxy(function () { return call(this.next, this.iterator); }, true); // `Iterator.from` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', stat: true, forced: IS_PURE }, { from: function from(O) { var iteratorRecord = getIteratorFlattenable(typeof O == 'string' ? toObject(O) : O, true); return isPrototypeOf(IteratorPrototype, iteratorRecord.iterator) ? iteratorRecord.iterator : new IteratorProxy(iteratorRecord); } }); /***/ }), /* 295 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var indexed = __webpack_require__(282); // `Iterator.prototype.indexed` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: true }, { indexed: indexed }); /***/ }), /* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var map = __webpack_require__(283); var IS_PURE = __webpack_require__(35); // `Iterator.prototype.map` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { map: map }); /***/ }), /* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-bigint -- safe */ var $ = __webpack_require__(2); var NumericRangeIterator = __webpack_require__(243); var $TypeError = TypeError; // `Iterator.range` method // https://github.com/tc39/proposal-Number.range $({ target: 'Iterator', stat: true, forced: true }, { range: function range(start, end, option) { if (typeof start == 'number') return new NumericRangeIterator(start, end, option, 'number', 0, 1); if (typeof start == 'bigint') return new NumericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1)); throw new $TypeError('Incorrect Iterator.range arguments'); } }); /***/ }), /* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var $TypeError = TypeError; // `Iterator.prototype.reduce` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { anObject(this); aCallable(reducer); var record = getIteratorDirect(this); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; var counter = 0; iterate(record, function (value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = reducer(accumulator, value, counter); } counter++; }, { IS_RECORD: true }); if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value'); return accumulator; } }); /***/ }), /* 299 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var iterate = __webpack_require__(91); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); // `Iterator.prototype.some` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { some: function some(predicate) { anObject(this); aCallable(predicate); var record = getIteratorDirect(this); var counter = 0; return iterate(record, function (value, stop) { if (predicate(value, counter++)) return stop(); }, { IS_RECORD: true, INTERRUPTED: true }).stopped; } }); /***/ }), /* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var getIteratorDirect = __webpack_require__(186); var notANaN = __webpack_require__(227); var toPositiveInteger = __webpack_require__(172); var createIteratorProxy = __webpack_require__(284); var iteratorClose = __webpack_require__(98); var IS_PURE = __webpack_require__(35); var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; if (!this.remaining--) { this.done = true; return iteratorClose(iterator, 'normal', undefined); } var result = anObject(call(this.next, iterator)); var done = this.done = !!result.done; if (!done) return result.value; }); // `Iterator.prototype.take` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { take: function take(limit) { anObject(this); var remaining = toPositiveInteger(notANaN(+limit)); return new IteratorProxy(getIteratorDirect(this), { remaining: remaining }); } }); /***/ }), /* 301 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var anObject = __webpack_require__(46); var iterate = __webpack_require__(91); var getIteratorDirect = __webpack_require__(186); var push = [].push; // `Iterator.prototype.toArray` method // https://github.com/tc39/proposal-iterator-helpers $({ target: 'Iterator', proto: true, real: true }, { toArray: function toArray() { var result = []; iterate(getIteratorDirect(anObject(this)), push, { that: result, IS_RECORD: true }); return result; } }); /***/ }), /* 302 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var anObject = __webpack_require__(46); var AsyncFromSyncIterator = __webpack_require__(182); var WrapAsyncIterator = __webpack_require__(235); var getIteratorDirect = __webpack_require__(186); var IS_PURE = __webpack_require__(35); // `Iterator.prototype.toAsync` method // https://github.com/tc39/proposal-async-iterator-helpers $({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, { toAsync: function toAsync() { return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(anObject(this))))); } }); /***/ }), /* 303 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var NATIVE_RAW_JSON = __webpack_require__(304); var isRawJSON = __webpack_require__(305); // `JSON.parse` method // https://tc39.es/proposal-json-parse-with-source/#sec-json.israwjson // https://github.com/tc39/proposal-json-parse-with-source $({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, { isRawJSON: isRawJSON }); /***/ }), /* 304 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-json -- safe */ var fails = __webpack_require__(6); module.exports = !fails(function () { var unsafeInt = '9007199254740993'; var raw = JSON.rawJSON(unsafeInt); return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt; }); /***/ }), /* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(19); var getInternalState = __webpack_require__(51).get; module.exports = function isRawJSON(O) { if (!isObject(O)) return false; var state = getInternalState(O); return !!state && state.type === 'RawJSON'; }; /***/ }), /* 306 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var call = __webpack_require__(7); var isCallable = __webpack_require__(20); var isObject = __webpack_require__(19); var isArray = __webpack_require__(107); var hasOwn = __webpack_require__(38); var toString = __webpack_require__(76); var lengthOfArrayLike = __webpack_require__(63); var createProperty = __webpack_require__(254); var fails = __webpack_require__(6); var parseJSONString = __webpack_require__(307); var NATIVE_SYMBOL = __webpack_require__(26); var JSON = global.JSON; var Number = global.Number; var SyntaxError = global.SyntaxError; var nativeParse = JSON && JSON.parse; var enumerableOwnProperties = getBuiltIn('Object', 'keys'); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var at = uncurryThis(''.charAt); var slice = uncurryThis(''.slice); var exec = uncurryThis(/./.exec); var push = uncurryThis([].push); var IS_DIGIT = /^\d$/; var IS_NON_ZERO_DIGIT = /^[1-9]$/; var IS_NUMBER_START = /^(?:-|\d)$/; var IS_WHITESPACE = /^[\t\n\r ]$/; var PRIMITIVE = 0; var OBJECT = 1; var $parse = function (source, reviver) { source = toString(source); var context = new Context(source, 0, ''); var root = context.parse(); var value = root.value; var endIndex = context.skip(IS_WHITESPACE, root.end); if (endIndex < source.length) { throw new SyntaxError('Unexpected extra character: "' + at(source, endIndex) + '" after the parsed data at: ' + endIndex); } return isCallable(reviver) ? internalize({ '': value }, '', reviver, root) : value; }; var internalize = function (holder, name, reviver, node) { var val = holder[name]; var unmodified = node && val === node.value; var context = unmodified && typeof node.source == 'string' ? { source: node.source } : {}; var elementRecordsLen, keys, len, i, P; if (isObject(val)) { var nodeIsArray = isArray(val); var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {}; if (nodeIsArray) { elementRecordsLen = nodes.length; len = lengthOfArrayLike(val); for (i = 0; i < len; i++) { internalizeProperty(val, i, internalize(val, '' + i, reviver, i < elementRecordsLen ? nodes[i] : undefined)); } } else { keys = enumerableOwnProperties(val); len = lengthOfArrayLike(keys); for (i = 0; i < len; i++) { P = keys[i]; internalizeProperty(val, P, internalize(val, P, reviver, hasOwn(nodes, P) ? nodes[P] : undefined)); } } } return call(reviver, holder, name, val, context); }; var internalizeProperty = function (object, key, value) { if (DESCRIPTORS) { var descriptor = getOwnPropertyDescriptor(object, key); if (descriptor && !descriptor.configurable) return; } if (value === undefined) delete object[key]; else createProperty(object, key, value); }; var Node = function (value, end, source, nodes) { this.value = value; this.end = end; this.source = source; this.nodes = nodes; }; var Context = function (source, index) { this.source = source; this.index = index; }; // https://www.json.org/json-en.html Context.prototype = { fork: function (nextIndex) { return new Context(this.source, nextIndex); }, parse: function () { var source = this.source; var i = this.skip(IS_WHITESPACE, this.index); var fork = this.fork(i); var chr = at(source, i); if (exec(IS_NUMBER_START, chr)) return fork.number(); switch (chr) { case '{': return fork.object(); case '[': return fork.array(); case '"': return fork.string(); case 't': return fork.keyword(true); case 'f': return fork.keyword(false); case 'n': return fork.keyword(null); } throw new SyntaxError('Unexpected character: "' + chr + '" at: ' + i); }, node: function (type, value, start, end, nodes) { return new Node(value, end, type ? null : slice(this.source, start, end), nodes); }, object: function () { var source = this.source; var i = this.index + 1; var expectKeypair = false; var object = {}; var nodes = {}; while (i < source.length) { i = this.until(['"', '}'], i); if (at(source, i) === '}' && !expectKeypair) { i++; break; } // Parsing the key var result = this.fork(i).string(); var key = result.value; i = result.end; i = this.until([':'], i) + 1; // Parsing value i = this.skip(IS_WHITESPACE, i); result = this.fork(i).parse(); createProperty(nodes, key, result); createProperty(object, key, result.value); i = this.until([',', '}'], result.end); var chr = at(source, i); if (chr === ',') { expectKeypair = true; i++; } else if (chr === '}') { i++; break; } } return this.node(OBJECT, object, this.index, i, nodes); }, array: function () { var source = this.source; var i = this.index + 1; var expectElement = false; var array = []; var nodes = []; while (i < source.length) { i = this.skip(IS_WHITESPACE, i); if (at(source, i) === ']' && !expectElement) { i++; break; } var result = this.fork(i).parse(); push(nodes, result); push(array, result.value); i = this.until([',', ']'], result.end); if (at(source, i) === ',') { expectElement = true; i++; } else if (at(source, i) === ']') { i++; break; } } return this.node(OBJECT, array, this.index, i, nodes); }, string: function () { var index = this.index; var parsed = parseJSONString(this.source, this.index + 1); return this.node(PRIMITIVE, parsed.value, index, parsed.end); }, number: function () { var source = this.source; var startIndex = this.index; var i = startIndex; if (at(source, i) === '-') i++; if (at(source, i) === '0') i++; else if (exec(IS_NON_ZERO_DIGIT, at(source, i))) i = this.skip(IS_DIGIT, ++i); else throw new SyntaxError('Failed to parse number at: ' + i); if (at(source, i) === '.') i = this.skip(IS_DIGIT, ++i); if (at(source, i) === 'e' || at(source, i) === 'E') { i++; if (at(source, i) === '+' || at(source, i) === '-') i++; var exponentStartIndex = i; i = this.skip(IS_DIGIT, i); if (exponentStartIndex === i) throw new SyntaxError("Failed to parse number's exponent value at: " + i); } return this.node(PRIMITIVE, Number(slice(source, startIndex, i)), startIndex, i); }, keyword: function (value) { var keyword = '' + value; var index = this.index; var endIndex = index + keyword.length; if (slice(this.source, index, endIndex) !== keyword) throw new SyntaxError('Failed to parse value at: ' + index); return this.node(PRIMITIVE, value, index, endIndex); }, skip: function (regex, i) { var source = this.source; for (; i < source.length; i++) if (!exec(regex, at(source, i))) break; return i; }, until: function (array, i) { i = this.skip(IS_WHITESPACE, i); var chr = at(this.source, i); for (var j = 0; j < array.length; j++) if (array[j] === chr) return i; throw new SyntaxError('Unexpected character: "' + chr + '" at: ' + i); } }; var NO_SOURCE_SUPPORT = fails(function () { var unsafeInt = '9007199254740993'; var source; nativeParse(unsafeInt, function (key, value, context) { source = context.source; }); return source !== unsafeInt; }); var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails(function () { // Safari 9 bug return 1 / nativeParse('-0 \t') !== -Infinity; }); // `JSON.parse` method // https://tc39.es/ecma262/#sec-json.parse // https://github.com/tc39/proposal-json-parse-with-source $({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, { parse: function parse(text, reviver) { return PROPER_BASE_PARSE && !isCallable(reviver) ? nativeParse(text) : $parse(text, reviver); } }); /***/ }), /* 307 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var hasOwn = __webpack_require__(38); var $SyntaxError = SyntaxError; var $parseInt = parseInt; var fromCharCode = String.fromCharCode; var at = uncurryThis(''.charAt); var slice = uncurryThis(''.slice); var exec = uncurryThis(/./.exec); var codePoints = { '\\"': '"', '\\\\': '\\', '\\/': '/', '\\b': '\b', '\\f': '\f', '\\n': '\n', '\\r': '\r', '\\t': '\t' }; var IS_4_HEX_DIGITS = /^[\da-f]{4}$/i; // eslint-disable-next-line regexp/no-control-character -- safe var IS_C0_CONTROL_CODE = /^[\u0000-\u001F]$/; module.exports = function (source, i) { var unterminated = true; var value = ''; while (i < source.length) { var chr = at(source, i); if (chr === '\\') { var twoChars = slice(source, i, i + 2); if (hasOwn(codePoints, twoChars)) { value += codePoints[twoChars]; i += 2; } else if (twoChars === '\\u') { i += 2; var fourHexDigits = slice(source, i, i + 4); if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError('Bad Unicode escape at: ' + i); value += fromCharCode($parseInt(fourHexDigits, 16)); i += 4; } else throw new $SyntaxError('Unknown escape sequence: "' + twoChars + '"'); } else if (chr === '"') { unterminated = false; i++; break; } else { if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError('Bad control character in string literal at: ' + i); value += chr; i++; } } if (unterminated) throw new $SyntaxError('Unterminated string at: ' + i); return { value: value, end: i }; }; /***/ }), /* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var FREEZING = __webpack_require__(257); var NATIVE_RAW_JSON = __webpack_require__(304); var getBuiltIn = __webpack_require__(23); var call = __webpack_require__(7); var uncurryThis = __webpack_require__(13); var isCallable = __webpack_require__(20); var isRawJSON = __webpack_require__(305); var toString = __webpack_require__(76); var createProperty = __webpack_require__(254); var parseJSONString = __webpack_require__(307); var getReplacerFunction = __webpack_require__(309); var uid = __webpack_require__(40); var setInternalState = __webpack_require__(51).set; var $String = String; var $SyntaxError = SyntaxError; var parse = getBuiltIn('JSON', 'parse'); var $stringify = getBuiltIn('JSON', 'stringify'); var create = getBuiltIn('Object', 'create'); var freeze = getBuiltIn('Object', 'freeze'); var at = uncurryThis(''.charAt); var slice = uncurryThis(''.slice); var exec = uncurryThis(/./.exec); var push = uncurryThis([].push); var MARK = uid(); var MARK_LENGTH = MARK.length; var ERROR_MESSAGE = 'Unacceptable as raw JSON'; var IS_WHITESPACE = /^[\t\n\r ]$/; // `JSON.parse` method // https://tc39.es/proposal-json-parse-with-source/#sec-json.israwjson // https://github.com/tc39/proposal-json-parse-with-source $({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, { rawJSON: function rawJSON(text) { var jsonString = toString(text); if (jsonString === '' || exec(IS_WHITESPACE, at(jsonString, 0)) || exec(IS_WHITESPACE, at(jsonString, jsonString.length - 1))) { throw new $SyntaxError(ERROR_MESSAGE); } var parsed = parse(jsonString); if (typeof parsed == 'object' && parsed !== null) throw new $SyntaxError(ERROR_MESSAGE); var obj = create(null); setInternalState(obj, { type: 'RawJSON' }); createProperty(obj, 'rawJSON', jsonString); return FREEZING ? freeze(obj) : obj; } }); // `JSON.stringify` method // https://tc39.es/ecma262/#sec-json.stringify // https://github.com/tc39/proposal-json-parse-with-source if ($stringify) $({ target: 'JSON', stat: true, arity: 3, forced: !NATIVE_RAW_JSON }, { stringify: function stringify(text, replacer, space) { var replacerFunction = getReplacerFunction(replacer); var rawStrings = []; var json = $stringify(text, function (key, value) { // some old implementations (like WebKit) could pass numbers as keys var v = isCallable(replacerFunction) ? call(replacerFunction, this, $String(key), value) : value; return isRawJSON(v) ? MARK + (push(rawStrings, v.rawJSON) - 1) : v; }, space); if (typeof json != 'string') return json; var result = ''; var length = json.length; for (var i = 0; i < length; i++) { var chr = at(json, i); if (chr === '"') { var end = parseJSONString(json, ++i).end - 1; var string = slice(json, i, end); result += slice(string, 0, MARK_LENGTH) === MARK ? rawStrings[slice(string, MARK_LENGTH)] : '"' + string + '"'; i = end; } else result += chr; } return result; } }); /***/ }), /* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var isArray = __webpack_require__(107); var isCallable = __webpack_require__(20); var classof = __webpack_require__(14); var toString = __webpack_require__(76); var push = uncurryThis([].push); module.exports = function (replacer) { if (isCallable(replacer)) return replacer; if (!isArray(replacer)) return; var rawLength = replacer.length; var keys = []; for (var i = 0; i < rawLength; i++) { var element = replacer[i]; if (typeof element == 'string') push(keys, element); else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') push(keys, toString(element)); } var keysLength = keys.length; var root = true; return function (key, value) { if (root) { root = false; return value; } if (isArray(this)) return value; for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value; }; }; /***/ }), /* 310 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aMap = __webpack_require__(311); var remove = __webpack_require__(199).remove; // `Map.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { deleteAll: function deleteAll(/* ...elements */) { var collection = aMap(this); var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { wasDeleted = remove(collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; } }); /***/ }), /* 311 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = __webpack_require__(199).has; // Perform ? RequireInternalSlot(M, [[MapData]]) module.exports = function (it) { has(it); return it; }; /***/ }), /* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aMap = __webpack_require__(311); var MapHelpers = __webpack_require__(199); var get = MapHelpers.get; var has = MapHelpers.has; var set = MapHelpers.set; // `Map.prototype.emplace` method // https://github.com/tc39/proposal-upsert $({ target: 'Map', proto: true, real: true, forced: true }, { emplace: function emplace(key, handler) { var map = aMap(this); var value, inserted; if (has(map, key)) { value = get(map, key); if ('update' in handler) { value = handler.update(value, key, map); set(map, key, value); } return value; } inserted = handler.insert(key, map); set(map, key, inserted); return inserted; } }); /***/ }), /* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.every` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); return iterate(map, function (value, key) { if (!boundFunction(value, key, map)) return false; }, true) !== false; } }); /***/ }), /* 314 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var MapHelpers = __webpack_require__(199); var iterate = __webpack_require__(206); var Map = MapHelpers.Map; var set = MapHelpers.set; // `Map.prototype.filter` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var newMap = new Map(); iterate(map, function (value, key) { if (boundFunction(value, key, map)) set(newMap, key, value); }); return newMap; } }); /***/ }), /* 315 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.find` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var result = iterate(map, function (value, key) { if (boundFunction(value, key, map)) return { value: value }; }, true); return result && result.value; } }); /***/ }), /* 316 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.findKey` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { findKey: function findKey(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var result = iterate(map, function (value, key) { if (boundFunction(value, key, map)) return { key: key }; }, true); return result && result.key; } }); /***/ }), /* 317 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var from = __webpack_require__(318); // `Map.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from $({ target: 'Map', stat: true, forced: true }, { from: from }); /***/ }), /* 318 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-setmap-offrom/ var bind = __webpack_require__(92); var call = __webpack_require__(7); var aCallable = __webpack_require__(30); var aConstructor = __webpack_require__(127); var isNullOrUndefined = __webpack_require__(16); var iterate = __webpack_require__(91); var push = [].push; module.exports = function from(source /* , mapFn, thisArg */) { var length = arguments.length; var mapFn = length > 1 ? arguments[1] : undefined; var mapping, array, n, boundFunction; aConstructor(this); mapping = mapFn !== undefined; if (mapping) aCallable(mapFn); if (isNullOrUndefined(source)) return new this(); array = []; if (mapping) { n = 0; boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined); iterate(source, function (nextItem) { call(push, array, boundFunction(nextItem, n++)); }); } else { iterate(source, push, { that: array }); } return new this(array); }; /***/ }), /* 319 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); var requireObjectCoercible = __webpack_require__(15); var iterate = __webpack_require__(91); var MapHelpers = __webpack_require__(199); var IS_PURE = __webpack_require__(35); var Map = MapHelpers.Map; var has = MapHelpers.has; var get = MapHelpers.get; var set = MapHelpers.set; var push = uncurryThis([].push); // `Map.groupBy` method // https://github.com/tc39/proposal-array-grouping $({ target: 'Map', stat: true, forced: IS_PURE }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible(items); aCallable(callbackfn); var map = new Map(); var k = 0; iterate(items, function (value) { var key = callbackfn(value, k++); if (!has(map, key)) set(map, key, [value]); else push(get(map, key), value); }); return map; } }); /***/ }), /* 320 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var sameValueZero = __webpack_require__(321); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.includes` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { includes: function includes(searchElement) { return iterate(aMap(this), function (value) { if (sameValueZero(value, searchElement)) return true; }, true) === true; } }); /***/ }), /* 321 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `SameValueZero` abstract operation // https://tc39.es/ecma262/#sec-samevaluezero module.exports = function (x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y || x !== x && y !== y; }; /***/ }), /* 322 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var iterate = __webpack_require__(91); var isCallable = __webpack_require__(20); var aCallable = __webpack_require__(30); var Map = __webpack_require__(199).Map; // `Map.keyBy` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', stat: true, forced: true }, { keyBy: function keyBy(iterable, keyDerivative) { var C = isCallable(this) ? this : Map; var newMap = new C(); aCallable(keyDerivative); var setter = aCallable(newMap.set); iterate(iterable, function (element) { call(setter, newMap, keyDerivative(element), element); }); return newMap; } }); /***/ }), /* 323 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.keyOf` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { keyOf: function keyOf(searchElement) { var result = iterate(aMap(this), function (value, key) { if (value === searchElement) return { key: key }; }, true); return result && result.key; } }); /***/ }), /* 324 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var MapHelpers = __webpack_require__(199); var iterate = __webpack_require__(206); var Map = MapHelpers.Map; var set = MapHelpers.set; // `Map.prototype.mapKeys` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { mapKeys: function mapKeys(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var newMap = new Map(); iterate(map, function (value, key) { set(newMap, boundFunction(value, key, map), value); }); return newMap; } }); /***/ }), /* 325 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var MapHelpers = __webpack_require__(199); var iterate = __webpack_require__(206); var Map = MapHelpers.Map; var set = MapHelpers.set; // `Map.prototype.mapValues` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { mapValues: function mapValues(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var newMap = new Map(); iterate(map, function (value, key) { set(newMap, key, boundFunction(value, key, map)); }); return newMap; } }); /***/ }), /* 326 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aMap = __webpack_require__(311); var iterate = __webpack_require__(91); var set = __webpack_require__(199).set; // `Map.prototype.merge` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, { // eslint-disable-next-line no-unused-vars -- required for `.length` merge: function merge(iterable /* ...iterables */) { var map = aMap(this); var argumentsLength = arguments.length; var i = 0; while (i < argumentsLength) { iterate(arguments[i++], function (key, value) { set(map, key, value); }, { AS_ENTRIES: true }); } return map; } }); /***/ }), /* 327 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var of = __webpack_require__(328); // `Map.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of $({ target: 'Map', stat: true, forced: true }, { of: of }); /***/ }), /* 328 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var arraySlice = __webpack_require__(130); // https://tc39.github.io/proposal-setmap-offrom/ module.exports = function of() { return new this(arraySlice(arguments)); }; /***/ }), /* 329 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aCallable = __webpack_require__(30); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); var $TypeError = TypeError; // `Map.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var map = aMap(this); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aCallable(callbackfn); iterate(map, function (value, key) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = callbackfn(accumulator, value, key, map); } }); if (noInitial) throw new $TypeError('Reduce of empty map with no initial value'); return accumulator; } }); /***/ }), /* 330 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aMap = __webpack_require__(311); var iterate = __webpack_require__(206); // `Map.prototype.some` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var map = aMap(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); return iterate(map, function (value, key) { if (boundFunction(value, key, map)) return true; }, true) === true; } }); /***/ }), /* 331 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aCallable = __webpack_require__(30); var aMap = __webpack_require__(311); var MapHelpers = __webpack_require__(199); var $TypeError = TypeError; var get = MapHelpers.get; var has = MapHelpers.has; var set = MapHelpers.set; // `Map.prototype.update` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: true }, { update: function update(key, callback /* , thunk */) { var map = aMap(this); var length = arguments.length; aCallable(callback); var isPresentInMap = has(map, key); if (!isPresentInMap && length < 3) { throw new $TypeError('Updating absent value'); } var value = isPresentInMap ? get(map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); set(map, key, callback(value, key, map)); return map; } }); /***/ }), /* 332 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var min = Math.min; var max = Math.max; // `Math.clamp` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, forced: true }, { clamp: function clamp(x, lower, upper) { return min(upper, max(lower, x)); } }); /***/ }), /* 333 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); // `Math.DEG_PER_RAD` constant // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, { DEG_PER_RAD: Math.PI / 180 }); /***/ }), /* 334 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var RAD_PER_DEG = 180 / Math.PI; // `Math.degrees` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, forced: true }, { degrees: function degrees(radians) { return radians * RAD_PER_DEG; } }); /***/ }), /* 335 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var scale = __webpack_require__(336); var fround = __webpack_require__(337); // `Math.fscale` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, forced: true }, { fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { return fround(scale(x, inLow, inHigh, outLow, outHigh)); } }); /***/ }), /* 336 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // `Math.scale` method implementation // https://rwaldron.github.io/proposal-math-extensions/ module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { var nx = +x; var nInLow = +inLow; var nInHigh = +inHigh; var nOutLow = +outLow; var nOutHigh = +outHigh; // eslint-disable-next-line no-self-compare -- NaN check if (nx !== nx || nInLow !== nInLow || nInHigh !== nInHigh || nOutLow !== nOutLow || nOutHigh !== nOutHigh) return NaN; if (nx === Infinity || nx === -Infinity) return nx; return (nx - nInLow) * (nOutHigh - nOutLow) / (nInHigh - nInLow) + nOutLow; }; /***/ }), /* 337 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var floatRound = __webpack_require__(269); var FLOAT32_EPSILON = 1.1920928955078125e-7; // 2 ** -23; var FLOAT32_MAX_VALUE = 3.4028234663852886e+38; // 2 ** 128 - 2 ** 104 var FLOAT32_MIN_VALUE = 1.1754943508222875e-38; // 2 ** -126; // `Math.fround` method implementation // https://tc39.es/ecma262/#sec-math.fround // eslint-disable-next-line es/no-math-fround -- safe module.exports = Math.fround || function fround(x) { return floatRound(x, FLOAT32_EPSILON, FLOAT32_MAX_VALUE, FLOAT32_MIN_VALUE); }; /***/ }), /* 338 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var f16round = __webpack_require__(268); // `Math.f16round` method // https://github.com/tc39/proposal-float16array $({ target: 'Math', stat: true }, { f16round: f16round }); /***/ }), /* 339 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); // `Math.RAD_PER_DEG` constant // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, { RAD_PER_DEG: 180 / Math.PI }); /***/ }), /* 340 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var DEG_PER_RAD = Math.PI / 180; // `Math.radians` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, forced: true }, { radians: function radians(degrees) { return degrees * DEG_PER_RAD; } }); /***/ }), /* 341 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var scale = __webpack_require__(336); // `Math.scale` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true, forced: true }, { scale: scale }); /***/ }), /* 342 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); // `Math.signbit` method // https://github.com/tc39/proposal-Math.signbit $({ target: 'Math', stat: true, forced: true }, { signbit: function signbit(x) { var n = +x; // eslint-disable-next-line no-self-compare -- NaN check return n === n && n === 0 ? 1 / n === -Infinity : n < 0; } }); /***/ }), /* 343 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var toIntegerOrInfinity = __webpack_require__(61); var parseInt = __webpack_require__(344); var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; var $RangeError = RangeError; var $SyntaxError = SyntaxError; var $TypeError = TypeError; var pow = Math.pow; var valid = /^[\d.a-z]+$/; var charAt = uncurryThis(''.charAt); var exec = uncurryThis(valid.exec); var numberToString = uncurryThis(1.0.toString); var stringSlice = uncurryThis(''.slice); var split = uncurryThis(''.split); // `Number.fromString` method // https://github.com/tc39/proposal-number-fromstring $({ target: 'Number', stat: true, forced: true }, { fromString: function fromString(string, radix) { var sign = 1; if (typeof string != 'string') throw new $TypeError(INVALID_NUMBER_REPRESENTATION); if (!string.length) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); if (charAt(string, 0) === '-') { sign = -1; string = stringSlice(string, 1); if (!string.length) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); } var R = radix === undefined ? 10 : toIntegerOrInfinity(radix); if (R < 2 || R > 36) throw new $RangeError(INVALID_RADIX); if (!exec(valid, string)) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); var parts = split(string, '.'); var mathNum = parseInt(parts[0], R); if (parts.length > 1) mathNum += parseInt(parts[1], R) / pow(R, parts[1].length); if (numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); return sign * mathNum; } }); /***/ }), /* 344 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var fails = __webpack_require__(6); var uncurryThis = __webpack_require__(13); var toString = __webpack_require__(76); var trim = __webpack_require__(345).trim; var whitespaces = __webpack_require__(346); var $parseInt = global.parseInt; var Symbol = global.Symbol; var ITERATOR = Symbol && Symbol.iterator; var hex = /^[+-]?0x/i; var exec = uncurryThis(hex.exec); var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix module.exports = FORCED ? function parseInt(string, radix) { var S = trim(toString(string)); return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10)); } : $parseInt; /***/ }), /* 345 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var requireObjectCoercible = __webpack_require__(15); var toString = __webpack_require__(76); var whitespaces = __webpack_require__(346); var replace = uncurryThis(''.replace); var ltrim = RegExp('^[' + whitespaces + ']+'); var rtrim = RegExp('(^|[^' + whitespaces + '])[' + whitespaces + ']+$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation var createMethod = function (TYPE) { return function ($this) { var string = toString(requireObjectCoercible($this)); if (TYPE & 1) string = replace(string, ltrim, ''); if (TYPE & 2) string = replace(string, rtrim, '$1'); return string; }; }; module.exports = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod(3) }; /***/ }), /* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // a string of all valid unicode whitespaces module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), /* 347 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var NumericRangeIterator = __webpack_require__(243); // `Number.range` method // https://github.com/tc39/proposal-Number.range // TODO: Remove from `core-js@4` $({ target: 'Number', stat: true, forced: true }, { range: function range(start, end, option) { return new NumericRangeIterator(start, end, option, 'number', 0, 1); } }); /***/ }), /* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var aCallable = __webpack_require__(30); var requireObjectCoercible = __webpack_require__(15); var toPropertyKey = __webpack_require__(17); var iterate = __webpack_require__(91); var create = getBuiltIn('Object', 'create'); var push = uncurryThis([].push); // `Object.groupBy` method // https://github.com/tc39/proposal-array-grouping $({ target: 'Object', stat: true }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible(items); aCallable(callbackfn); var obj = create(null); var k = 0; iterate(items, function (value) { var key = toPropertyKey(callbackfn(value, k++)); // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` if (key in obj) push(obj[key], value); else obj[key] = [value]; }); return obj; } }); /***/ }), /* 349 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(350); __webpack_require__(351); __webpack_require__(352); /***/ }), /* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-observable var $ = __webpack_require__(2); var call = __webpack_require__(7); var DESCRIPTORS = __webpack_require__(5); var setSpecies = __webpack_require__(124); var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var anInstance = __webpack_require__(125); var isCallable = __webpack_require__(20); var isNullOrUndefined = __webpack_require__(16); var isObject = __webpack_require__(19); var getMethod = __webpack_require__(29); var defineBuiltIn = __webpack_require__(47); var defineBuiltIns = __webpack_require__(183); var defineBuiltInAccessor = __webpack_require__(119); var hostReportErrors = __webpack_require__(137); var wellKnownSymbol = __webpack_require__(33); var InternalStateModule = __webpack_require__(51); var $$OBSERVABLE = wellKnownSymbol('observable'); var OBSERVABLE = 'Observable'; var SUBSCRIPTION = 'Subscription'; var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver'; var getterFor = InternalStateModule.getterFor; var setInternalState = InternalStateModule.set; var getObservableInternalState = getterFor(OBSERVABLE); var getSubscriptionInternalState = getterFor(SUBSCRIPTION); var getSubscriptionObserverInternalState = getterFor(SUBSCRIPTION_OBSERVER); var SubscriptionState = function (observer) { this.observer = anObject(observer); this.cleanup = undefined; this.subscriptionObserver = undefined; }; SubscriptionState.prototype = { type: SUBSCRIPTION, clean: function () { var cleanup = this.cleanup; if (cleanup) { this.cleanup = undefined; try { cleanup(); } catch (error) { hostReportErrors(error); } } }, close: function () { if (!DESCRIPTORS) { var subscription = this.facade; var subscriptionObserver = this.subscriptionObserver; subscription.closed = true; if (subscriptionObserver) subscriptionObserver.closed = true; } this.observer = undefined; }, isClosed: function () { return this.observer === undefined; } }; var Subscription = function (observer, subscriber) { var subscriptionState = setInternalState(this, new SubscriptionState(observer)); var start; if (!DESCRIPTORS) this.closed = false; try { if (start = getMethod(observer, 'start')) call(start, observer, this); } catch (error) { hostReportErrors(error); } if (subscriptionState.isClosed()) return; var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState); try { var cleanup = subscriber(subscriptionObserver); var subscription = cleanup; if (!isNullOrUndefined(cleanup)) subscriptionState.cleanup = isCallable(cleanup.unsubscribe) ? function () { subscription.unsubscribe(); } : aCallable(cleanup); } catch (error) { subscriptionObserver.error(error); return; } if (subscriptionState.isClosed()) subscriptionState.clean(); }; Subscription.prototype = defineBuiltIns({}, { unsubscribe: function unsubscribe() { var subscriptionState = getSubscriptionInternalState(this); if (!subscriptionState.isClosed()) { subscriptionState.close(); subscriptionState.clean(); } } }); if (DESCRIPTORS) defineBuiltInAccessor(Subscription.prototype, 'closed', { configurable: true, get: function closed() { return getSubscriptionInternalState(this).isClosed(); } }); var SubscriptionObserver = function (subscriptionState) { setInternalState(this, { type: SUBSCRIPTION_OBSERVER, subscriptionState: subscriptionState }); if (!DESCRIPTORS) this.closed = false; }; SubscriptionObserver.prototype = defineBuiltIns({}, { next: function next(value) { var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; try { var nextMethod = getMethod(observer, 'next'); if (nextMethod) call(nextMethod, observer, value); } catch (error) { hostReportErrors(error); } } }, error: function error(value) { var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; subscriptionState.close(); try { var errorMethod = getMethod(observer, 'error'); if (errorMethod) call(errorMethod, observer, value); else hostReportErrors(value); } catch (err) { hostReportErrors(err); } subscriptionState.clean(); } }, complete: function complete() { var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; subscriptionState.close(); try { var completeMethod = getMethod(observer, 'complete'); if (completeMethod) call(completeMethod, observer); } catch (error) { hostReportErrors(error); } subscriptionState.clean(); } } }); if (DESCRIPTORS) defineBuiltInAccessor(SubscriptionObserver.prototype, 'closed', { configurable: true, get: function closed() { return getSubscriptionObserverInternalState(this).subscriptionState.isClosed(); } }); var $Observable = function Observable(subscriber) { anInstance(this, ObservablePrototype); setInternalState(this, { type: OBSERVABLE, subscriber: aCallable(subscriber) }); }; var ObservablePrototype = $Observable.prototype; defineBuiltIns(ObservablePrototype, { subscribe: function subscribe(observer) { var length = arguments.length; return new Subscription(isCallable(observer) ? { next: observer, error: length > 1 ? arguments[1] : undefined, complete: length > 2 ? arguments[2] : undefined } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber); } }); defineBuiltIn(ObservablePrototype, $$OBSERVABLE, function () { return this; }); $({ global: true, constructor: true, forced: true }, { Observable: $Observable }); setSpecies(OBSERVABLE); /***/ }), /* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var call = __webpack_require__(7); var anObject = __webpack_require__(46); var isConstructor = __webpack_require__(128); var getIterator = __webpack_require__(96); var getMethod = __webpack_require__(29); var iterate = __webpack_require__(91); var wellKnownSymbol = __webpack_require__(33); var $$OBSERVABLE = wellKnownSymbol('observable'); // `Observable.from` method // https://github.com/tc39/proposal-observable $({ target: 'Observable', stat: true, forced: true }, { from: function from(x) { var C = isConstructor(this) ? this : getBuiltIn('Observable'); var observableMethod = getMethod(anObject(x), $$OBSERVABLE); if (observableMethod) { var observable = anObject(call(observableMethod, x)); return observable.constructor === C ? observable : new C(function (observer) { return observable.subscribe(observer); }); } var iterator = getIterator(x); return new C(function (observer) { iterate(iterator, function (it, stop) { observer.next(it); if (observer.closed) return stop(); }, { IS_ITERATOR: true, INTERRUPTED: true }); observer.complete(); }); } }); /***/ }), /* 352 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var isConstructor = __webpack_require__(128); var Array = getBuiltIn('Array'); // `Observable.of` method // https://github.com/tc39/proposal-observable $({ target: 'Observable', stat: true, forced: true }, { of: function of() { var C = isConstructor(this) ? this : getBuiltIn('Observable'); var length = arguments.length; var items = Array(length); var index = 0; while (index < length) items[index] = arguments[index++]; return new C(function (observer) { for (var i = 0; i < length; i++) { observer.next(items[i]); if (observer.closed) return; } observer.complete(); }); } }); /***/ }), /* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var newPromiseCapabilityModule = __webpack_require__(143); var perform = __webpack_require__(138); // `Promise.try` method // https://github.com/tc39/proposal-promise-try $({ target: 'Promise', stat: true, forced: true }, { 'try': function (callbackfn) { var promiseCapability = newPromiseCapabilityModule.f(this); var result = perform(callbackfn); (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); return promiseCapability.promise; } }); /***/ }), /* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var newPromiseCapabilityModule = __webpack_require__(143); // `Promise.withResolvers` method // https://github.com/tc39/proposal-promise-with-resolvers $({ target: 'Promise', stat: true }, { withResolvers: function withResolvers() { var promiseCapability = newPromiseCapabilityModule.f(this); return { promise: promiseCapability.promise, resolve: promiseCapability.resolve, reject: promiseCapability.reject }; } }); /***/ }), /* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; // `Reflect.defineMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { defineMetadata: function defineMetadata(metadataKey, metadataValue, target /* , targetKey */) { var targetKey = arguments.length < 4 ? undefined : toMetadataKey(arguments[3]); ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), targetKey); } }); /***/ }), /* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` __webpack_require__(248); __webpack_require__(260); var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var shared = __webpack_require__(34); var Map = getBuiltIn('Map'); var WeakMap = getBuiltIn('WeakMap'); var push = uncurryThis([].push); var metadata = shared('metadata'); var store = metadata.store || (metadata.store = new WeakMap()); var getOrCreateMetadataMap = function (target, targetKey, create) { var targetMetadata = store.get(target); if (!targetMetadata) { if (!create) return; store.set(target, targetMetadata = new Map()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) return; targetMetadata.set(targetKey, keyMetadata = new Map()); } return keyMetadata; }; var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap(target, targetKey, false); var keys = []; if (metadataMap) metadataMap.forEach(function (_, key) { push(keys, key); }); return keys; }; var toMetadataKey = function (it) { return it === undefined || typeof it == 'symbol' ? it : String(it); }; module.exports = { store: store, getMap: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, toKey: toMetadataKey }; /***/ }), /* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var toMetadataKey = ReflectMetadataModule.toKey; var getOrCreateMetadataMap = ReflectMetadataModule.getMap; var store = ReflectMetadataModule.store; // `Reflect.deleteMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; if (metadataMap.size) return true; var targetMetadata = store.get(target); targetMetadata['delete'](targetKey); return !!targetMetadata.size || store['delete'](target); } }); /***/ }), /* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var getPrototypeOf = __webpack_require__(85); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var ordinaryGetOwnMetadata = ReflectMetadataModule.get; var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryGetMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); var parent = getPrototypeOf(O); return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; }; // `Reflect.getMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryGetMetadata(metadataKey, anObject(target), targetKey); } }); /***/ }), /* 359 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var getPrototypeOf = __webpack_require__(85); var $arrayUniqueBy = __webpack_require__(205); var arrayUniqueBy = uncurryThis($arrayUniqueBy); var concat = uncurryThis([].concat); var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryMetadataKeys = function (O, P) { var oKeys = ordinaryOwnMetadataKeys(O, P); var parent = getPrototypeOf(O); if (parent === null) return oKeys; var pKeys = ordinaryMetadataKeys(parent, P); return pKeys.length ? oKeys.length ? arrayUniqueBy(concat(oKeys, pKeys)) : pKeys : oKeys; }; // `Reflect.getMetadataKeys` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); return ordinaryMetadataKeys(anObject(target), targetKey); } }); /***/ }), /* 360 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var ordinaryGetOwnMetadata = ReflectMetadataModule.get; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.getOwnMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryGetOwnMetadata(metadataKey, anObject(target), targetKey); } }); /***/ }), /* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.getOwnMetadataKeys` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); return ordinaryOwnMetadataKeys(anObject(target), targetKey); } }); /***/ }), /* 362 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var getPrototypeOf = __webpack_require__(85); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryHasMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = getPrototypeOf(O); return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; }; // `Reflect.hasMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryHasMetadata(metadataKey, anObject(target), targetKey); } }); /***/ }), /* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.hasOwnMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryHasOwnMetadata(metadataKey, anObject(target), targetKey); } }); /***/ }), /* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var ReflectMetadataModule = __webpack_require__(356); var anObject = __webpack_require__(46); var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; // `Reflect.metadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { metadata: function metadata(metadataKey, metadataValue) { return function decorator(target, key) { ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetadataKey(key)); }; } }); /***/ }), /* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var toString = __webpack_require__(76); var WHITESPACES = __webpack_require__(346); var charCodeAt = uncurryThis(''.charCodeAt); var replace = uncurryThis(''.replace); var NEED_ESCAPING = RegExp('[!"#$%&\'()*+,\\-./:;<=>?@[\\\\\\]^`{|}~' + WHITESPACES + ']', 'g'); // `RegExp.escape` method // https://github.com/tc39/proposal-regex-escaping $({ target: 'RegExp', stat: true, forced: true }, { escape: function escape(S) { var str = toString(S); var firstCode = charCodeAt(str, 0); // escape first DecimalDigit return (firstCode > 47 && firstCode < 58 ? '\\x3' : '') + replace(str, NEED_ESCAPING, '\\$&'); } }); /***/ }), /* 366 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aSet = __webpack_require__(367); var add = __webpack_require__(368).add; // `Set.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { addAll: function addAll(/* ...elements */) { var set = aSet(this); for (var k = 0, len = arguments.length; k < len; k++) { add(set, arguments[k]); } return set; } }); /***/ }), /* 367 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = __webpack_require__(368).has; // Perform ? RequireInternalSlot(M, [[SetData]]) module.exports = function (it) { has(it); return it; }; /***/ }), /* 368 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); // eslint-disable-next-line es/no-set -- safe var SetPrototype = Set.prototype; module.exports = { // eslint-disable-next-line es/no-set -- safe Set: Set, add: uncurryThis(SetPrototype.add), has: uncurryThis(SetPrototype.has), remove: uncurryThis(SetPrototype['delete']), proto: SetPrototype }; /***/ }), /* 369 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aSet = __webpack_require__(367); var remove = __webpack_require__(368).remove; // `Set.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { deleteAll: function deleteAll(/* ...elements */) { var collection = aSet(this); var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { wasDeleted = remove(collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; } }); /***/ }), /* 370 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var difference = __webpack_require__(371); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('difference') }, { difference: difference }); /***/ }), /* 371 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var SetHelpers = __webpack_require__(368); var clone = __webpack_require__(372); var size = __webpack_require__(374); var getSetRecord = __webpack_require__(375); var iterateSet = __webpack_require__(373); var iterateSimple = __webpack_require__(207); var has = SetHelpers.has; var remove = SetHelpers.remove; // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods module.exports = function difference(other) { var O = aSet(this); var otherRec = getSetRecord(other); var result = clone(O); if (size(O) <= otherRec.size) iterateSet(O, function (e) { if (otherRec.includes(e)) remove(result, e); }); else iterateSimple(otherRec.getIterator(), function (e) { if (has(O, e)) remove(result, e); }); return result; }; /***/ }), /* 372 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var SetHelpers = __webpack_require__(368); var iterate = __webpack_require__(373); var Set = SetHelpers.Set; var add = SetHelpers.add; module.exports = function (set) { var result = new Set(); iterate(set, function (it) { add(result, it); }); return result; }; /***/ }), /* 373 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var iterateSimple = __webpack_require__(207); var SetHelpers = __webpack_require__(368); var Set = SetHelpers.Set; var SetPrototype = SetHelpers.proto; var forEach = uncurryThis(SetPrototype.forEach); var keys = uncurryThis(SetPrototype.keys); var next = keys(new Set()).next; module.exports = function (set, fn, interruptible) { return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn); }; /***/ }), /* 374 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThisAccessor = __webpack_require__(71); var SetHelpers = __webpack_require__(368); module.exports = uncurryThisAccessor(SetHelpers.proto, 'size', 'get') || function (set) { return set.size; }; /***/ }), /* 375 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(30); var anObject = __webpack_require__(46); var call = __webpack_require__(7); var toIntegerOrInfinity = __webpack_require__(61); var getIteratorDirect = __webpack_require__(186); var INVALID_SIZE = 'Invalid size'; var $RangeError = RangeError; var $TypeError = TypeError; var max = Math.max; var SetRecord = function (set, size, has, keys) { this.set = set; this.size = size; this.has = has; this.keys = keys; }; SetRecord.prototype = { getIterator: function () { return getIteratorDirect(anObject(call(this.keys, this.set))); }, includes: function (it) { return call(this.has, this.set, it); } }; // `GetSetRecord` abstract operation // https://tc39.es/proposal-set-methods/#sec-getsetrecord module.exports = function (obj) { anObject(obj); var numSize = +obj.size; // NOTE: If size is undefined, then numSize will be NaN // eslint-disable-next-line no-self-compare -- NaN check if (numSize !== numSize) throw new $TypeError(INVALID_SIZE); var intSize = toIntegerOrInfinity(numSize); if (intSize < 0) throw new $RangeError(INVALID_SIZE); return new SetRecord( obj, max(intSize, 0), aCallable(obj.has), aCallable(obj.keys) ); }; /***/ }), /* 376 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var createSetLike = function (size) { return { size: size, has: function () { return false; }, keys: function () { return { next: function () { return { done: true }; } }; } }; }; module.exports = function (name) { var Set = getBuiltIn('Set'); try { new Set()[name](createSetLike(0)); try { // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it // https://github.com/tc39/proposal-set-methods/pull/88 new Set()[name](createSetLike(-1)); return false; } catch (error2) { return true; } } catch (error) { return false; } }; /***/ }), /* 377 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $difference = __webpack_require__(371); // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { difference: function difference(other) { return call($difference, this, toSetLike(other)); } }); /***/ }), /* 378 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var isCallable = __webpack_require__(20); var isIterable = __webpack_require__(379); var isObject = __webpack_require__(19); var Set = getBuiltIn('Set'); var isSetLike = function (it) { return isObject(it) && typeof it.size == 'number' && isCallable(it.has) && isCallable(it.keys); }; // fallback old -> new set methods proposal arguments module.exports = function (it) { if (isSetLike(it)) return it; return isIterable(it) ? new Set(it) : it; }; /***/ }), /* 379 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(77); var hasOwn = __webpack_require__(38); var isNullOrUndefined = __webpack_require__(16); var wellKnownSymbol = __webpack_require__(33); var Iterators = __webpack_require__(95); var ITERATOR = wellKnownSymbol('iterator'); var $Object = Object; module.exports = function (it) { if (isNullOrUndefined(it)) return false; var O = $Object(it); return O[ITERATOR] !== undefined || '@@iterator' in O || hasOwn(Iterators, classof(O)); }; /***/ }), /* 380 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aSet = __webpack_require__(367); var iterate = __webpack_require__(373); // `Set.prototype.every` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var set = aSet(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); return iterate(set, function (value) { if (!boundFunction(value, value, set)) return false; }, true) !== false; } }); /***/ }), /* 381 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aSet = __webpack_require__(367); var SetHelpers = __webpack_require__(368); var iterate = __webpack_require__(373); var Set = SetHelpers.Set; var add = SetHelpers.add; // `Set.prototype.filter` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var set = aSet(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var newSet = new Set(); iterate(set, function (value) { if (boundFunction(value, value, set)) add(newSet, value); }); return newSet; } }); /***/ }), /* 382 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aSet = __webpack_require__(367); var iterate = __webpack_require__(373); // `Set.prototype.find` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var set = aSet(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var result = iterate(set, function (value) { if (boundFunction(value, value, set)) return { value: value }; }, true); return result && result.value; } }); /***/ }), /* 383 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var from = __webpack_require__(318); // `Set.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from $({ target: 'Set', stat: true, forced: true }, { from: from }); /***/ }), /* 384 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var fails = __webpack_require__(6); var intersection = __webpack_require__(385); var setMethodAcceptSetLike = __webpack_require__(376); var INCORRECT = !setMethodAcceptSetLike('intersection') || fails(function () { // eslint-disable-next-line es/no-array-from, es/no-set -- testing return Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2]))) !== '3,2'; }); // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { intersection: intersection }); /***/ }), /* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var SetHelpers = __webpack_require__(368); var size = __webpack_require__(374); var getSetRecord = __webpack_require__(375); var iterateSet = __webpack_require__(373); var iterateSimple = __webpack_require__(207); var Set = SetHelpers.Set; var add = SetHelpers.add; var has = SetHelpers.has; // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods module.exports = function intersection(other) { var O = aSet(this); var otherRec = getSetRecord(other); var result = new Set(); if (size(O) > otherRec.size) { iterateSimple(otherRec.getIterator(), function (e) { if (has(O, e)) add(result, e); }); } else { iterateSet(O, function (e) { if (otherRec.includes(e)) add(result, e); }); } return result; }; /***/ }), /* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $intersection = __webpack_require__(385); // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { intersection: function intersection(other) { return call($intersection, this, toSetLike(other)); } }); /***/ }), /* 387 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isDisjointFrom = __webpack_require__(388); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.isDisjointFrom` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isDisjointFrom') }, { isDisjointFrom: isDisjointFrom }); /***/ }), /* 388 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var has = __webpack_require__(368).has; var size = __webpack_require__(374); var getSetRecord = __webpack_require__(375); var iterateSet = __webpack_require__(373); var iterateSimple = __webpack_require__(207); var iteratorClose = __webpack_require__(98); // `Set.prototype.isDisjointFrom` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom module.exports = function isDisjointFrom(other) { var O = aSet(this); var otherRec = getSetRecord(other); if (size(O) <= otherRec.size) return iterateSet(O, function (e) { if (otherRec.includes(e)) return false; }, true) !== false; var iterator = otherRec.getIterator(); return iterateSimple(iterator, function (e) { if (has(O, e)) return iteratorClose(iterator, 'normal', false); }) !== false; }; /***/ }), /* 389 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $isDisjointFrom = __webpack_require__(388); // `Set.prototype.isDisjointFrom` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { isDisjointFrom: function isDisjointFrom(other) { return call($isDisjointFrom, this, toSetLike(other)); } }); /***/ }), /* 390 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isSubsetOf = __webpack_require__(391); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.isSubsetOf` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSubsetOf') }, { isSubsetOf: isSubsetOf }); /***/ }), /* 391 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var size = __webpack_require__(374); var iterate = __webpack_require__(373); var getSetRecord = __webpack_require__(375); // `Set.prototype.isSubsetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf module.exports = function isSubsetOf(other) { var O = aSet(this); var otherRec = getSetRecord(other); if (size(O) > otherRec.size) return false; return iterate(O, function (e) { if (!otherRec.includes(e)) return false; }, true) !== false; }; /***/ }), /* 392 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $isSubsetOf = __webpack_require__(391); // `Set.prototype.isSubsetOf` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { isSubsetOf: function isSubsetOf(other) { return call($isSubsetOf, this, toSetLike(other)); } }); /***/ }), /* 393 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isSupersetOf = __webpack_require__(394); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.isSupersetOf` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('isSupersetOf') }, { isSupersetOf: isSupersetOf }); /***/ }), /* 394 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var has = __webpack_require__(368).has; var size = __webpack_require__(374); var getSetRecord = __webpack_require__(375); var iterateSimple = __webpack_require__(207); var iteratorClose = __webpack_require__(98); // `Set.prototype.isSupersetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf module.exports = function isSupersetOf(other) { var O = aSet(this); var otherRec = getSetRecord(other); if (size(O) < otherRec.size) return false; var iterator = otherRec.getIterator(); return iterateSimple(iterator, function (e) { if (!has(O, e)) return iteratorClose(iterator, 'normal', false); }) !== false; }; /***/ }), /* 395 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $isSupersetOf = __webpack_require__(394); // `Set.prototype.isSupersetOf` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { isSupersetOf: function isSupersetOf(other) { return call($isSupersetOf, this, toSetLike(other)); } }); /***/ }), /* 396 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var uncurryThis = __webpack_require__(13); var aSet = __webpack_require__(367); var iterate = __webpack_require__(373); var toString = __webpack_require__(76); var arrayJoin = uncurryThis([].join); var push = uncurryThis([].push); // `Set.prototype.join` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { join: function join(separator) { var set = aSet(this); var sep = separator === undefined ? ',' : toString(separator); var array = []; iterate(set, function (value) { push(array, value); }); return arrayJoin(array, sep); } }); /***/ }), /* 397 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aSet = __webpack_require__(367); var SetHelpers = __webpack_require__(368); var iterate = __webpack_require__(373); var Set = SetHelpers.Set; var add = SetHelpers.add; // `Set.prototype.map` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { map: function map(callbackfn /* , thisArg */) { var set = aSet(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var newSet = new Set(); iterate(set, function (value) { add(newSet, boundFunction(value, value, set)); }); return newSet; } }); /***/ }), /* 398 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var of = __webpack_require__(328); // `Set.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of $({ target: 'Set', stat: true, forced: true }, { of: of }); /***/ }), /* 399 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aCallable = __webpack_require__(30); var aSet = __webpack_require__(367); var iterate = __webpack_require__(373); var $TypeError = TypeError; // `Set.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var set = aSet(this); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aCallable(callbackfn); iterate(set, function (value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = callbackfn(accumulator, value, value, set); } }); if (noInitial) throw new $TypeError('Reduce of empty set with no initial value'); return accumulator; } }); /***/ }), /* 400 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var bind = __webpack_require__(92); var aSet = __webpack_require__(367); var iterate = __webpack_require__(373); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var set = aSet(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); return iterate(set, function (value) { if (boundFunction(value, value, set)) return true; }, true) === true; } }); /***/ }), /* 401 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var symmetricDifference = __webpack_require__(402); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('symmetricDifference') }, { symmetricDifference: symmetricDifference }); /***/ }), /* 402 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var SetHelpers = __webpack_require__(368); var clone = __webpack_require__(372); var getSetRecord = __webpack_require__(375); var iterateSimple = __webpack_require__(207); var add = SetHelpers.add; var has = SetHelpers.has; var remove = SetHelpers.remove; // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods module.exports = function symmetricDifference(other) { var O = aSet(this); var keysIter = getSetRecord(other).getIterator(); var result = clone(O); iterateSimple(keysIter, function (e) { if (has(O, e)) remove(result, e); else add(result, e); }); return result; }; /***/ }), /* 403 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $symmetricDifference = __webpack_require__(402); // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { symmetricDifference: function symmetricDifference(other) { return call($symmetricDifference, this, toSetLike(other)); } }); /***/ }), /* 404 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var union = __webpack_require__(405); var setMethodAcceptSetLike = __webpack_require__(376); // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('union') }, { union: union }); /***/ }), /* 405 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aSet = __webpack_require__(367); var add = __webpack_require__(368).add; var clone = __webpack_require__(372); var getSetRecord = __webpack_require__(375); var iterateSimple = __webpack_require__(207); // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods module.exports = function union(other) { var O = aSet(this); var keysIter = getSetRecord(other).getIterator(); var result = clone(O); iterateSimple(keysIter, function (it) { add(result, it); }); return result; }; /***/ }), /* 406 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var call = __webpack_require__(7); var toSetLike = __webpack_require__(378); var $union = __webpack_require__(405); // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods // TODO: Obsolete version, remove from `core-js@4` $({ target: 'Set', proto: true, real: true, forced: true }, { union: function union(other) { return call($union, this, toSetLike(other)); } }); /***/ }), /* 407 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var cooked = __webpack_require__(408); // `String.cooked` method // https://github.com/tc39/proposal-string-cooked $({ target: 'String', stat: true, forced: true }, { cooked: cooked }); /***/ }), /* 408 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var toIndexedObject = __webpack_require__(11); var toString = __webpack_require__(76); var lengthOfArrayLike = __webpack_require__(63); var $TypeError = TypeError; var push = uncurryThis([].push); var join = uncurryThis([].join); // `String.cooked` method // https://tc39.es/proposal-string-cooked/ module.exports = function cooked(template /* , ...substitutions */) { var cookedTemplate = toIndexedObject(template); var literalSegments = lengthOfArrayLike(cookedTemplate); if (!literalSegments) return ''; var argumentsLength = arguments.length; var elements = []; var i = 0; while (true) { var nextVal = cookedTemplate[i++]; if (nextVal === undefined) throw new $TypeError('Incorrect template'); push(elements, toString(nextVal)); if (i === literalSegments) return join(elements, ''); if (i < argumentsLength) push(elements, toString(arguments[i])); } }; /***/ }), /* 409 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var createIteratorConstructor = __webpack_require__(244); var createIterResultObject = __webpack_require__(185); var requireObjectCoercible = __webpack_require__(15); var toString = __webpack_require__(76); var InternalStateModule = __webpack_require__(51); var StringMultibyteModule = __webpack_require__(410); var codeAt = StringMultibyteModule.codeAt; var charAt = StringMultibyteModule.charAt; var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // TODO: unify with String#@@iterator var $StringIterator = createIteratorConstructor(function StringIterator(string) { setInternalState(this, { type: STRING_ITERATOR, string: string, index: 0 }); }, 'String', function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return createIterResultObject(undefined, true); point = charAt(string, index); state.index += point.length; return createIterResultObject({ codePoint: codeAt(point, 0), position: index }, false); }); // `String.prototype.codePoints` method // https://github.com/tc39/proposal-string-prototype-codepoints $({ target: 'String', proto: true, forced: true }, { codePoints: function codePoints() { return new $StringIterator(toString(requireObjectCoercible(this))); } }); /***/ }), /* 410 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var toIntegerOrInfinity = __webpack_require__(61); var toString = __webpack_require__(76); var requireObjectCoercible = __webpack_require__(15); var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var stringSlice = uncurryThis(''.slice); var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString(requireObjectCoercible($this)); var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = charCodeAt(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; module.exports = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod(true) }; /***/ }), /* 411 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var FREEZING = __webpack_require__(257); var $ = __webpack_require__(2); var shared = __webpack_require__(34); var getBuiltIn = __webpack_require__(23); var makeBuiltIn = __webpack_require__(48); var uncurryThis = __webpack_require__(13); var apply = __webpack_require__(68); var anObject = __webpack_require__(46); var toObject = __webpack_require__(39); var isCallable = __webpack_require__(20); var lengthOfArrayLike = __webpack_require__(63); var defineProperty = __webpack_require__(44).f; var createArrayFromList = __webpack_require__(253); var cooked = __webpack_require__(408); var parse = __webpack_require__(412); var whitespaces = __webpack_require__(346); var WeakMap = getBuiltIn('WeakMap'); var globalDedentRegistry = shared('GlobalDedentRegistry', new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ globalDedentRegistry.has = globalDedentRegistry.has; globalDedentRegistry.get = globalDedentRegistry.get; globalDedentRegistry.set = globalDedentRegistry.set; /* eslint-enable no-self-assign -- prototype methods protection */ var $Array = Array; var $TypeError = TypeError; // eslint-disable-next-line es/no-object-freeze -- safe var freeze = Object.freeze || Object; // eslint-disable-next-line es/no-object-isfrozen -- safe var isFrozen = Object.isFrozen; var min = Math.min; var charAt = uncurryThis(''.charAt); var stringSlice = uncurryThis(''.slice); var split = uncurryThis(''.split); var exec = uncurryThis(/./.exec); var NEW_LINE = /([\n\u2028\u2029]|\r\n?)/g; var LEADING_WHITESPACE = RegExp('^[' + whitespaces + ']*'); var NON_WHITESPACE = RegExp('[^' + whitespaces + ']'); var INVALID_TAG = 'Invalid tag'; var INVALID_OPENING_LINE = 'Invalid opening line'; var INVALID_CLOSING_LINE = 'Invalid closing line'; var dedentTemplateStringsArray = function (template) { var rawInput = template.raw; // https://github.com/tc39/proposal-string-dedent/issues/75 if (FREEZING && !isFrozen(rawInput)) throw new $TypeError('Raw template should be frozen'); if (globalDedentRegistry.has(rawInput)) return globalDedentRegistry.get(rawInput); var raw = dedentStringsArray(rawInput); var cookedArr = cookStrings(raw); defineProperty(cookedArr, 'raw', { value: freeze(raw) }); freeze(cookedArr); globalDedentRegistry.set(rawInput, cookedArr); return cookedArr; }; var dedentStringsArray = function (template) { var t = toObject(template); var length = lengthOfArrayLike(t); var blocks = $Array(length); var dedented = $Array(length); var i = 0; var lines, common, quasi, k; if (!length) throw new $TypeError(INVALID_TAG); for (; i < length; i++) { var element = t[i]; if (typeof element == 'string') blocks[i] = split(element, NEW_LINE); else throw new $TypeError(INVALID_TAG); } for (i = 0; i < length; i++) { var lastSplit = i + 1 === length; lines = blocks[i]; if (i === 0) { if (lines.length === 1 || lines[0].length > 0) { throw new $TypeError(INVALID_OPENING_LINE); } lines[1] = ''; } if (lastSplit) { if (lines.length === 1 || exec(NON_WHITESPACE, lines[lines.length - 1])) { throw new $TypeError(INVALID_CLOSING_LINE); } lines[lines.length - 2] = ''; lines[lines.length - 1] = ''; } for (var j = 2; j < lines.length; j += 2) { var text = lines[j]; var lineContainsTemplateExpression = j + 1 === lines.length && !lastSplit; var leading = exec(LEADING_WHITESPACE, text)[0]; if (!lineContainsTemplateExpression && leading.length === text.length) { lines[j] = ''; continue; } common = commonLeadingIndentation(leading, common); } } var count = common ? common.length : 0; for (i = 0; i < length; i++) { lines = blocks[i]; quasi = lines[0]; k = 1; for (; k < lines.length; k += 2) { quasi += lines[k] + stringSlice(lines[k + 1], count); } dedented[i] = quasi; } return dedented; }; var commonLeadingIndentation = function (a, b) { if (b === undefined || a === b) return a; var i = 0; for (var len = min(a.length, b.length); i < len; i++) { if (charAt(a, i) !== charAt(b, i)) break; } return stringSlice(a, 0, i); }; var cookStrings = function (raw) { var i = 0; var length = raw.length; var result = $Array(length); for (; i < length; i++) { result[i] = parse(raw[i]); } return result; }; var makeDedentTag = function (tag) { return makeBuiltIn(function (template /* , ...substitutions */) { var args = createArrayFromList(arguments); args[0] = dedentTemplateStringsArray(anObject(template)); return apply(tag, this, args); }, ''); }; var cookedDedentTag = makeDedentTag(cooked); // `String.dedent` method // https://github.com/tc39/proposal-string-dedent $({ target: 'String', stat: true, forced: true }, { dedent: function dedent(templateOrFn /* , ...substitutions */) { anObject(templateOrFn); if (isCallable(templateOrFn)) return makeDedentTag(templateOrFn); return apply(cookedDedentTag, this, arguments); } }); /***/ }), /* 412 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // adapted from https://github.com/jridgewell/string-dedent var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var fromCharCode = String.fromCharCode; var fromCodePoint = getBuiltIn('String', 'fromCodePoint'); var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var stringIndexOf = uncurryThis(''.indexOf); var stringSlice = uncurryThis(''.slice); var ZERO_CODE = 48; var NINE_CODE = 57; var LOWER_A_CODE = 97; var LOWER_F_CODE = 102; var UPPER_A_CODE = 65; var UPPER_F_CODE = 70; var isDigit = function (str, index) { var c = charCodeAt(str, index); return c >= ZERO_CODE && c <= NINE_CODE; }; var parseHex = function (str, index, end) { if (end >= str.length) return -1; var n = 0; for (; index < end; index++) { var c = hexToInt(charCodeAt(str, index)); if (c === -1) return -1; n = n * 16 + c; } return n; }; var hexToInt = function (c) { if (c >= ZERO_CODE && c <= NINE_CODE) return c - ZERO_CODE; if (c >= LOWER_A_CODE && c <= LOWER_F_CODE) return c - LOWER_A_CODE + 10; if (c >= UPPER_A_CODE && c <= UPPER_F_CODE) return c - UPPER_A_CODE + 10; return -1; }; module.exports = function (raw) { var out = ''; var start = 0; // We need to find every backslash escape sequence, and cook the escape into a real char. var i = 0; var n; while ((i = stringIndexOf(raw, '\\', i)) > -1) { out += stringSlice(raw, start, i); // If the backslash is the last char of the string, then it was an invalid sequence. // This can't actually happen in a tagged template literal, but could happen if you manually // invoked the tag with an array. if (++i === raw.length) return; var next = charAt(raw, i++); switch (next) { // Escaped control codes need to be individually processed. case 'b': out += '\b'; break; case 't': out += '\t'; break; case 'n': out += '\n'; break; case 'v': out += '\v'; break; case 'f': out += '\f'; break; case 'r': out += '\r'; break; // Escaped line terminators just skip the char. case '\r': // Treat `\r\n` as a single terminator. if (i < raw.length && charAt(raw, i) === '\n') ++i; // break omitted case '\n': case '\u2028': case '\u2029': break; // `\0` is a null control char, but `\0` followed by another digit is an illegal octal escape. case '0': if (isDigit(raw, i)) return; out += '\0'; break; // Hex escapes must contain 2 hex chars. case 'x': n = parseHex(raw, i, i + 2); if (n === -1) return; i += 2; out += fromCharCode(n); break; // Unicode escapes contain either 4 chars, or an unlimited number between `{` and `}`. // The hex value must not overflow 0x10FFFF. case 'u': if (i < raw.length && charAt(raw, i) === '{') { var end = stringIndexOf(raw, '}', ++i); if (end === -1) return; n = parseHex(raw, i, end); i = end + 1; } else { n = parseHex(raw, i, i + 4); i += 4; } if (n === -1 || n > 0x10FFFF) return; out += fromCodePoint(n); break; default: if (isDigit(next, 0)) return; out += next; } start = i; } return out + stringSlice(raw, start); }; /***/ }), /* 413 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var defineWellKnownSymbol = __webpack_require__(414); var defineProperty = __webpack_require__(44).f; var getOwnPropertyDescriptor = __webpack_require__(4).f; var Symbol = global.Symbol; // `Symbol.asyncDispose` well-known symbol // https://github.com/tc39/proposal-async-explicit-resource-management defineWellKnownSymbol('asyncDispose'); if (Symbol) { var descriptor = getOwnPropertyDescriptor(Symbol, 'asyncDispose'); // workaround of NodeJS 20.4 bug // https://github.com/nodejs/node/issues/48699 // and incorrect descriptor from some transpilers and userland helpers if (descriptor.enumerable && descriptor.configurable && descriptor.writable) { defineProperty(Symbol, 'asyncDispose', { value: descriptor.value, enumerable: false, configurable: false, writable: false }); } } /***/ }), /* 414 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var path = __webpack_require__(415); var hasOwn = __webpack_require__(38); var wrappedWellKnownSymbolModule = __webpack_require__(416); var defineProperty = __webpack_require__(44).f; module.exports = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; /***/ }), /* 415 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); module.exports = global; /***/ }), /* 416 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(33); exports.f = wellKnownSymbol; /***/ }), /* 417 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var defineWellKnownSymbol = __webpack_require__(414); var defineProperty = __webpack_require__(44).f; var getOwnPropertyDescriptor = __webpack_require__(4).f; var Symbol = global.Symbol; // `Symbol.dispose` well-known symbol // https://github.com/tc39/proposal-explicit-resource-management defineWellKnownSymbol('dispose'); if (Symbol) { var descriptor = getOwnPropertyDescriptor(Symbol, 'dispose'); // workaround of NodeJS 20.4 bug // https://github.com/nodejs/node/issues/48699 // and incorrect descriptor from some transpilers and userland helpers if (descriptor.enumerable && descriptor.configurable && descriptor.writable) { defineProperty(Symbol, 'dispose', { value: descriptor.value, enumerable: false, configurable: false, writable: false }); } } /***/ }), /* 418 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isRegisteredSymbol = __webpack_require__(419); // `Symbol.isRegisteredSymbol` method // https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol $({ target: 'Symbol', stat: true }, { isRegisteredSymbol: isRegisteredSymbol }); /***/ }), /* 419 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var Symbol = getBuiltIn('Symbol'); var keyFor = Symbol.keyFor; var thisSymbolValue = uncurryThis(Symbol.prototype.valueOf); // `Symbol.isRegisteredSymbol` method // https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol module.exports = Symbol.isRegisteredSymbol || function isRegisteredSymbol(value) { try { return keyFor(thisSymbolValue(value)) !== undefined; } catch (error) { return false; } }; /***/ }), /* 420 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isRegisteredSymbol = __webpack_require__(419); // `Symbol.isRegistered` method // obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol $({ target: 'Symbol', stat: true, name: 'isRegisteredSymbol' }, { isRegistered: isRegisteredSymbol }); /***/ }), /* 421 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isWellKnownSymbol = __webpack_require__(422); // `Symbol.isWellKnownSymbol` method // https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected $({ target: 'Symbol', stat: true, forced: true }, { isWellKnownSymbol: isWellKnownSymbol }); /***/ }), /* 422 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var shared = __webpack_require__(34); var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var isSymbol = __webpack_require__(22); var wellKnownSymbol = __webpack_require__(33); var Symbol = getBuiltIn('Symbol'); var $isWellKnownSymbol = Symbol.isWellKnownSymbol; var getOwnPropertyNames = getBuiltIn('Object', 'getOwnPropertyNames'); var thisSymbolValue = uncurryThis(Symbol.prototype.valueOf); var WellKnownSymbolsStore = shared('wks'); for (var i = 0, symbolKeys = getOwnPropertyNames(Symbol), symbolKeysLength = symbolKeys.length; i < symbolKeysLength; i++) { // some old engines throws on access to some keys like `arguments` or `caller` try { var symbolKey = symbolKeys[i]; if (isSymbol(Symbol[symbolKey])) wellKnownSymbol(symbolKey); } catch (error) { /* empty */ } } // `Symbol.isWellKnownSymbol` method // https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected module.exports = function isWellKnownSymbol(value) { if ($isWellKnownSymbol && $isWellKnownSymbol(value)) return true; try { var symbol = thisSymbolValue(value); for (var j = 0, keys = getOwnPropertyNames(WellKnownSymbolsStore), keysLength = keys.length; j < keysLength; j++) { // eslint-disable-next-line eqeqeq -- polyfilled symbols case if (WellKnownSymbolsStore[keys[j]] == symbol) return true; } } catch (error) { /* empty */ } return false; }; /***/ }), /* 423 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var isWellKnownSymbol = __webpack_require__(422); // `Symbol.isWellKnown` method // obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected $({ target: 'Symbol', stat: true, name: 'isWellKnownSymbol', forced: true }, { isWellKnown: isWellKnownSymbol }); /***/ }), /* 424 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineWellKnownSymbol = __webpack_require__(414); // `Symbol.matcher` well-known symbol // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('matcher'); /***/ }), /* 425 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineWellKnownSymbol = __webpack_require__(414); // `Symbol.metadata` well-known symbol // https://github.com/tc39/proposal-decorators defineWellKnownSymbol('metadata'); /***/ }), /* 426 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(414); // `Symbol.metadataKey` well-known symbol // https://github.com/tc39/proposal-decorator-metadata defineWellKnownSymbol('metadataKey'); /***/ }), /* 427 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineWellKnownSymbol = __webpack_require__(414); // `Symbol.observable` well-known symbol // https://github.com/tc39/proposal-observable defineWellKnownSymbol('observable'); /***/ }), /* 428 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var getBuiltIn = __webpack_require__(23); var aConstructor = __webpack_require__(127); var arrayFromAsync = __webpack_require__(180); var ArrayBufferViewCore = __webpack_require__(166); var arrayFromConstructorAndList = __webpack_require__(112); var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = ArrayBufferViewCore.exportTypedArrayStaticMethod; // `%TypedArray%.fromAsync` method // https://github.com/tc39/proposal-array-from-async exportTypedArrayStaticMethod('fromAsync', function fromAsync(asyncItems /* , mapfn = undefined, thisArg = undefined */) { var C = this; var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var thisArg = argumentsLength > 2 ? arguments[2] : undefined; return new (getBuiltIn('Promise'))(function (resolve) { aConstructor(C); resolve(arrayFromAsync(asyncItems, mapfn, thisArg)); }).then(function (list) { return arrayFromConstructorAndList(aTypedArrayConstructor(C), list); }); }, true); /***/ }), /* 429 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var $filterReject = __webpack_require__(190).filterReject; var fromSpeciesAndList = __webpack_require__(430); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering exportTypedArrayMethod('filterReject', function filterReject(callbackfn /* , thisArg */) { var list = $filterReject(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return fromSpeciesAndList(this, list); }, true); /***/ }), /* 430 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var arrayFromConstructorAndList = __webpack_require__(112); var typedArraySpeciesConstructor = __webpack_require__(431); module.exports = function (instance, list) { return arrayFromConstructorAndList(typedArraySpeciesConstructor(instance), list); }; /***/ }), /* 431 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayBufferViewCore = __webpack_require__(166); var speciesConstructor = __webpack_require__(126); var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; // a part of `TypedArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#typedarray-species-create module.exports = function (originalArray) { return aTypedArrayConstructor(speciesConstructor(originalArray, getTypedArrayConstructor(originalArray))); }; /***/ }), /* 432 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var ArrayBufferViewCore = __webpack_require__(166); var $group = __webpack_require__(194); var typedArraySpeciesConstructor = __webpack_require__(431); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.groupBy` method // https://github.com/tc39/proposal-array-grouping exportTypedArrayMethod('groupBy', function groupBy(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; return $group(aTypedArray(this), callbackfn, thisArg, typedArraySpeciesConstructor); }, true); /***/ }), /* 433 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove from `core-js@4` var ArrayBufferViewCore = __webpack_require__(166); var lengthOfArrayLike = __webpack_require__(63); var isBigIntArray = __webpack_require__(176); var toAbsoluteIndex = __webpack_require__(60); var toBigInt = __webpack_require__(177); var toIntegerOrInfinity = __webpack_require__(61); var fails = __webpack_require__(6); var aTypedArray = ArrayBufferViewCore.aTypedArray; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var max = Math.max; var min = Math.min; // some early implementations, like WebKit, does not follow the final semantic var PROPER_ORDER = !fails(function () { // eslint-disable-next-line es/no-typed-arrays -- required for testing var array = new Int8Array([1]); var spliced = array.toSpliced(1, 0, { valueOf: function () { array[0] = 2; return 3; } }); return spliced[0] !== 2 || spliced[1] !== 3; }); // `%TypedArray%.prototype.toSpliced` method // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) { var O = aTypedArray(this); var C = getTypedArrayConstructor(O); var len = lengthOfArrayLike(O); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; var k = 0; var insertCount, actualDeleteCount, thisIsBigIntArray, convertedItems, value, newLen, A; if (argumentsLength === 0) { insertCount = actualDeleteCount = 0; } else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); insertCount = argumentsLength - 2; if (insertCount) { convertedItems = new C(insertCount); thisIsBigIntArray = isBigIntArray(convertedItems); for (var i = 2; i < argumentsLength; i++) { value = arguments[i]; // FF30- typed arrays doesn't properly convert objects to typed array values convertedItems[i - 2] = thisIsBigIntArray ? toBigInt(value) : +value; } } } newLen = len + insertCount - actualDeleteCount; A = new C(newLen); for (; k < actualStart; k++) A[k] = O[k]; for (; k < actualStart + insertCount; k++) A[k] = convertedItems[k - actualStart]; for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount]; return A; }, !PROPER_ORDER); /***/ }), /* 434 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); var ArrayBufferViewCore = __webpack_require__(166); var arrayFromConstructorAndList = __webpack_require__(112); var $arrayUniqueBy = __webpack_require__(205); var aTypedArray = ArrayBufferViewCore.aTypedArray; var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var arrayUniqueBy = uncurryThis($arrayUniqueBy); // `%TypedArray%.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique exportTypedArrayMethod('uniqueBy', function uniqueBy(resolver) { aTypedArray(this); return arrayFromConstructorAndList(getTypedArrayConstructor(this), arrayUniqueBy(this, resolver)); }, true); /***/ }), /* 435 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aWeakMap = __webpack_require__(436); var remove = __webpack_require__(437).remove; // `WeakMap.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakMap', proto: true, real: true, forced: true }, { deleteAll: function deleteAll(/* ...elements */) { var collection = aWeakMap(this); var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { wasDeleted = remove(collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; } }); /***/ }), /* 436 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = __webpack_require__(437).has; // Perform ? RequireInternalSlot(M, [[WeakMapData]]) module.exports = function (it) { has(it); return it; }; /***/ }), /* 437 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); // eslint-disable-next-line es/no-weak-map -- safe var WeakMapPrototype = WeakMap.prototype; module.exports = { // eslint-disable-next-line es/no-weak-map -- safe WeakMap: WeakMap, set: uncurryThis(WeakMapPrototype.set), get: uncurryThis(WeakMapPrototype.get), has: uncurryThis(WeakMapPrototype.has), remove: uncurryThis(WeakMapPrototype['delete']) }; /***/ }), /* 438 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var from = __webpack_require__(318); // `WeakMap.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from $({ target: 'WeakMap', stat: true, forced: true }, { from: from }); /***/ }), /* 439 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var of = __webpack_require__(328); // `WeakMap.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of $({ target: 'WeakMap', stat: true, forced: true }, { of: of }); /***/ }), /* 440 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aWeakMap = __webpack_require__(436); var WeakMapHelpers = __webpack_require__(437); var get = WeakMapHelpers.get; var has = WeakMapHelpers.has; var set = WeakMapHelpers.set; // `WeakMap.prototype.emplace` method // https://github.com/tc39/proposal-upsert $({ target: 'WeakMap', proto: true, real: true, forced: true }, { emplace: function emplace(key, handler) { var map = aWeakMap(this); var value, inserted; if (has(map, key)) { value = get(map, key); if ('update' in handler) { value = handler.update(value, key, map); set(map, key, value); } return value; } inserted = handler.insert(key, map); set(map, key, inserted); return inserted; } }); /***/ }), /* 441 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aWeakSet = __webpack_require__(442); var add = __webpack_require__(443).add; // `WeakSet.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakSet', proto: true, real: true, forced: true }, { addAll: function addAll(/* ...elements */) { var set = aWeakSet(this); for (var k = 0, len = arguments.length; k < len; k++) { add(set, arguments[k]); } return set; } }); /***/ }), /* 442 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = __webpack_require__(443).has; // Perform ? RequireInternalSlot(M, [[WeakSetData]]) module.exports = function (it) { has(it); return it; }; /***/ }), /* 443 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(13); // eslint-disable-next-line es/no-weak-set -- safe var WeakSetPrototype = WeakSet.prototype; module.exports = { // eslint-disable-next-line es/no-weak-set -- safe WeakSet: WeakSet, add: uncurryThis(WeakSetPrototype.add), has: uncurryThis(WeakSetPrototype.has), remove: uncurryThis(WeakSetPrototype['delete']) }; /***/ }), /* 444 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var aWeakSet = __webpack_require__(442); var remove = __webpack_require__(443).remove; // `WeakSet.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakSet', proto: true, real: true, forced: true }, { deleteAll: function deleteAll(/* ...elements */) { var collection = aWeakSet(this); var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { wasDeleted = remove(collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; } }); /***/ }), /* 445 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var from = __webpack_require__(318); // `WeakSet.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from $({ target: 'WeakSet', stat: true, forced: true }, { from: from }); /***/ }), /* 446 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var of = __webpack_require__(328); // `WeakSet.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of $({ target: 'WeakSet', stat: true, forced: true }, { of: of }); /***/ }), /* 447 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var tryNodeRequire = __webpack_require__(215); var getBuiltIn = __webpack_require__(23); var fails = __webpack_require__(6); var create = __webpack_require__(87); var createPropertyDescriptor = __webpack_require__(10); var defineProperty = __webpack_require__(44).f; var defineBuiltIn = __webpack_require__(47); var defineBuiltInAccessor = __webpack_require__(119); var hasOwn = __webpack_require__(38); var anInstance = __webpack_require__(125); var anObject = __webpack_require__(46); var errorToString = __webpack_require__(448); var normalizeStringArgument = __webpack_require__(75); var DOMExceptionConstants = __webpack_require__(449); var clearErrorStack = __webpack_require__(81); var InternalStateModule = __webpack_require__(51); var DESCRIPTORS = __webpack_require__(5); var IS_PURE = __webpack_require__(35); var DOM_EXCEPTION = 'DOMException'; var DATA_CLONE_ERR = 'DATA_CLONE_ERR'; var Error = getBuiltIn('Error'); // NodeJS < 17.0 does not expose `DOMException` to global var NativeDOMException = getBuiltIn(DOM_EXCEPTION) || (function () { try { // NodeJS < 15.0 does not expose `MessageChannel` to global var MessageChannel = getBuiltIn('MessageChannel') || tryNodeRequire('worker_threads').MessageChannel; // eslint-disable-next-line es/no-weak-map, unicorn/require-post-message-target-origin -- safe new MessageChannel().port1.postMessage(new WeakMap()); } catch (error) { if (error.name === DATA_CLONE_ERR && error.code === 25) return error.constructor; } })(); var NativeDOMExceptionPrototype = NativeDOMException && NativeDOMException.prototype; var ErrorPrototype = Error.prototype; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(DOM_EXCEPTION); var HAS_STACK = 'stack' in new Error(DOM_EXCEPTION); var codeFor = function (name) { return hasOwn(DOMExceptionConstants, name) && DOMExceptionConstants[name].m ? DOMExceptionConstants[name].c : 0; }; var $DOMException = function DOMException() { anInstance(this, DOMExceptionPrototype); var argumentsLength = arguments.length; var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); var code = codeFor(name); setInternalState(this, { type: DOM_EXCEPTION, name: name, message: message, code: code }); if (!DESCRIPTORS) { this.name = name; this.message = message; this.code = code; } if (HAS_STACK) { var error = new Error(message); error.name = DOM_EXCEPTION; defineProperty(this, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); } }; var DOMExceptionPrototype = $DOMException.prototype = create(ErrorPrototype); var createGetterDescriptor = function (get) { return { enumerable: true, configurable: true, get: get }; }; var getterFor = function (key) { return createGetterDescriptor(function () { return getInternalState(this)[key]; }); }; if (DESCRIPTORS) { // `DOMException.prototype.code` getter defineBuiltInAccessor(DOMExceptionPrototype, 'code', getterFor('code')); // `DOMException.prototype.message` getter defineBuiltInAccessor(DOMExceptionPrototype, 'message', getterFor('message')); // `DOMException.prototype.name` getter defineBuiltInAccessor(DOMExceptionPrototype, 'name', getterFor('name')); } defineProperty(DOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, $DOMException)); // FF36- DOMException is a function, but can't be constructed var INCORRECT_CONSTRUCTOR = fails(function () { return !(new NativeDOMException() instanceof Error); }); // Safari 10.1 / Chrome 32- / IE8- DOMException.prototype.toString bugs var INCORRECT_TO_STRING = INCORRECT_CONSTRUCTOR || fails(function () { return ErrorPrototype.toString !== errorToString || String(new NativeDOMException(1, 2)) !== '2: 1'; }); // Deno 1.6.3- DOMException.prototype.code just missed var INCORRECT_CODE = INCORRECT_CONSTRUCTOR || fails(function () { return new NativeDOMException(1, 'DataCloneError').code !== 25; }); // Deno 1.6.3- DOMException constants just missed var MISSED_CONSTANTS = INCORRECT_CONSTRUCTOR || NativeDOMException[DATA_CLONE_ERR] !== 25 || NativeDOMExceptionPrototype[DATA_CLONE_ERR] !== 25; var FORCED_CONSTRUCTOR = IS_PURE ? INCORRECT_TO_STRING || INCORRECT_CODE || MISSED_CONSTANTS : INCORRECT_CONSTRUCTOR; // `DOMException` constructor // https://webidl.spec.whatwg.org/#idl-DOMException $({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR }, { DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException }); var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION); var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype; if (INCORRECT_TO_STRING && (IS_PURE || NativeDOMException === PolyfilledDOMException)) { defineBuiltIn(PolyfilledDOMExceptionPrototype, 'toString', errorToString); } if (INCORRECT_CODE && DESCRIPTORS && NativeDOMException === PolyfilledDOMException) { defineBuiltInAccessor(PolyfilledDOMExceptionPrototype, 'code', createGetterDescriptor(function () { return codeFor(anObject(this).name); })); } // `DOMException` constants for (var key in DOMExceptionConstants) if (hasOwn(DOMExceptionConstants, key)) { var constant = DOMExceptionConstants[key]; var constantName = constant.s; var descriptor = createPropertyDescriptor(6, constant.c); if (!hasOwn(PolyfilledDOMException, constantName)) { defineProperty(PolyfilledDOMException, constantName, descriptor); } if (!hasOwn(PolyfilledDOMExceptionPrototype, constantName)) { defineProperty(PolyfilledDOMExceptionPrototype, constantName, descriptor); } } /***/ }), /* 448 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var fails = __webpack_require__(6); var anObject = __webpack_require__(46); var normalizeStringArgument = __webpack_require__(75); var nativeErrorToString = Error.prototype.toString; var INCORRECT_TO_STRING = fails(function () { if (DESCRIPTORS) { // Chrome 32- incorrectly call accessor // eslint-disable-next-line es/no-object-create, es/no-object-defineproperty -- safe var object = Object.create(Object.defineProperty({}, 'name', { get: function () { return this === object; } })); if (nativeErrorToString.call(object) !== 'true') return true; } // FF10- does not properly handle non-strings return nativeErrorToString.call({ message: 1, name: 2 }) !== '2: 1' // IE8 does not properly handle defaults || nativeErrorToString.call({}) !== 'Error'; }); module.exports = INCORRECT_TO_STRING ? function toString() { var O = anObject(this); var name = normalizeStringArgument(O.name, 'Error'); var message = normalizeStringArgument(O.message); return !name ? message : !message ? name : name + ': ' + message; } : nativeErrorToString; /***/ }), /* 449 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 } }; /***/ }), /* 450 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var getBuiltIn = __webpack_require__(23); var createPropertyDescriptor = __webpack_require__(10); var defineProperty = __webpack_require__(44).f; var hasOwn = __webpack_require__(38); var anInstance = __webpack_require__(125); var inheritIfRequired = __webpack_require__(74); var normalizeStringArgument = __webpack_require__(75); var DOMExceptionConstants = __webpack_require__(449); var clearErrorStack = __webpack_require__(81); var DESCRIPTORS = __webpack_require__(5); var IS_PURE = __webpack_require__(35); var DOM_EXCEPTION = 'DOMException'; var Error = getBuiltIn('Error'); var NativeDOMException = getBuiltIn(DOM_EXCEPTION); var $DOMException = function DOMException() { anInstance(this, DOMExceptionPrototype); var argumentsLength = arguments.length; var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); var that = new NativeDOMException(message, name); var error = new Error(message); error.name = DOM_EXCEPTION; defineProperty(that, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); inheritIfRequired(that, this, $DOMException); return that; }; var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype; var ERROR_HAS_STACK = 'stack' in new Error(DOM_EXCEPTION); var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(global, DOM_EXCEPTION); // Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it // https://github.com/Jarred-Sumner/bun/issues/399 var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable); var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK; // `DOMException` constructor patch for `.stack` where it's required // https://webidl.spec.whatwg.org/#es-DOMException-specialness $({ global: true, constructor: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException }); var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION); var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype; if (PolyfilledDOMExceptionPrototype.constructor !== PolyfilledDOMException) { if (!IS_PURE) { defineProperty(PolyfilledDOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, PolyfilledDOMException)); } for (var key in DOMExceptionConstants) if (hasOwn(DOMExceptionConstants, key)) { var constant = DOMExceptionConstants[key]; var constantName = constant.s; if (!hasOwn(PolyfilledDOMException, constantName)) { defineProperty(PolyfilledDOMException, constantName, createPropertyDescriptor(6, constant.c)); } } } /***/ }), /* 451 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(23); var setToStringTag = __webpack_require__(123); var DOM_EXCEPTION = 'DOMException'; // `DOMException.prototype[@@toStringTag]` property setToStringTag(getBuiltIn(DOM_EXCEPTION), DOM_EXCEPTION); /***/ }), /* 452 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(453); __webpack_require__(454); /***/ }), /* 453 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var clearImmediate = __webpack_require__(129).clear; // `clearImmediate` method // http://w3c.github.io/setImmediate/#si-clearImmediate $({ global: true, bind: true, enumerable: true, forced: global.clearImmediate !== clearImmediate }, { clearImmediate: clearImmediate }); /***/ }), /* 454 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var setTask = __webpack_require__(129).set; var schedulersFix = __webpack_require__(455); // https://github.com/oven-sh/bun/issues/1633 var setImmediate = global.setImmediate ? schedulersFix(setTask, false) : setTask; // `setImmediate` method // http://w3c.github.io/setImmediate/#si-setImmediate $({ global: true, bind: true, enumerable: true, forced: global.setImmediate !== setImmediate }, { setImmediate: setImmediate }); /***/ }), /* 455 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var apply = __webpack_require__(68); var isCallable = __webpack_require__(20); var ENGINE_IS_BUN = __webpack_require__(456); var USER_AGENT = __webpack_require__(28); var arraySlice = __webpack_require__(130); var validateArgumentsLength = __webpack_require__(131); var Function = global.Function; // dirty IE9- and Bun 0.3.0- checks var WRAP = /MSIE .\./.test(USER_AGENT) || ENGINE_IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })(); // IE9- / Bun 0.3.0- setTimeout / setInterval / setImmediate additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers // https://github.com/oven-sh/bun/issues/1633 module.exports = function (scheduler, hasTimeArg) { var firstParamIndex = hasTimeArg ? 2 : 1; return WRAP ? function (handler, timeout /* , ...arguments */) { var boundArgs = validateArgumentsLength(arguments.length, 1) > firstParamIndex; var fn = isCallable(handler) ? handler : Function(handler); var params = boundArgs ? arraySlice(arguments, firstParamIndex) : []; var callback = boundArgs ? function () { apply(fn, this, params); } : fn; return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback); } : scheduler; }; /***/ }), /* 456 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global Bun -- Deno case */ module.exports = typeof Bun == 'function' && Bun && typeof Bun.version == 'string'; /***/ }), /* 457 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var global = __webpack_require__(3); var defineBuiltInAccessor = __webpack_require__(119); var DESCRIPTORS = __webpack_require__(5); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; var INCORRECT_VALUE = global.self !== global; // `self` getter // https://html.spec.whatwg.org/multipage/window-object.html#dom-self try { if (DESCRIPTORS) { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var descriptor = Object.getOwnPropertyDescriptor(global, 'self'); // some engines have `self`, but with incorrect descriptor // https://github.com/denoland/deno/issues/15765 if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) { defineBuiltInAccessor(global, 'self', { get: function self() { return global; }, set: function self(value) { if (this !== global) throw new $TypeError('Illegal invocation'); defineProperty(global, 'self', { value: value, writable: true, configurable: true, enumerable: true }); }, configurable: true, enumerable: true }); } } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, { self: global }); } catch (error) { /* empty */ } /***/ }), /* 458 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_PURE = __webpack_require__(35); var $ = __webpack_require__(2); var global = __webpack_require__(3); var getBuiltIn = __webpack_require__(23); var uncurryThis = __webpack_require__(13); var fails = __webpack_require__(6); var uid = __webpack_require__(40); var isCallable = __webpack_require__(20); var isConstructor = __webpack_require__(128); var isNullOrUndefined = __webpack_require__(16); var isObject = __webpack_require__(19); var isSymbol = __webpack_require__(22); var iterate = __webpack_require__(91); var anObject = __webpack_require__(46); var classof = __webpack_require__(77); var hasOwn = __webpack_require__(38); var createProperty = __webpack_require__(254); var createNonEnumerableProperty = __webpack_require__(43); var lengthOfArrayLike = __webpack_require__(63); var validateArgumentsLength = __webpack_require__(131); var getRegExpFlags = __webpack_require__(162); var MapHelpers = __webpack_require__(199); var SetHelpers = __webpack_require__(368); var setIterate = __webpack_require__(373); var detachTransferable = __webpack_require__(214); var ERROR_STACK_INSTALLABLE = __webpack_require__(82); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(216); var Object = global.Object; var Array = global.Array; var Date = global.Date; var Error = global.Error; var TypeError = global.TypeError; var PerformanceMark = global.PerformanceMark; var DOMException = getBuiltIn('DOMException'); var Map = MapHelpers.Map; var mapHas = MapHelpers.has; var mapGet = MapHelpers.get; var mapSet = MapHelpers.set; var Set = SetHelpers.Set; var setAdd = SetHelpers.add; var setHas = SetHelpers.has; var objectKeys = getBuiltIn('Object', 'keys'); var push = uncurryThis([].push); var thisBooleanValue = uncurryThis(true.valueOf); var thisNumberValue = uncurryThis(1.0.valueOf); var thisStringValue = uncurryThis(''.valueOf); var thisTimeValue = uncurryThis(Date.prototype.getTime); var PERFORMANCE_MARK = uid('structuredClone'); var DATA_CLONE_ERROR = 'DataCloneError'; var TRANSFERRING = 'Transferring'; var checkBasicSemantic = function (structuredCloneImplementation) { return !fails(function () { var set1 = new global.Set([7]); var set2 = structuredCloneImplementation(set1); var number = structuredCloneImplementation(Object(7)); return set2 === set1 || !set2.has(7) || !isObject(number) || +number !== 7; }) && structuredCloneImplementation; }; var checkErrorsCloning = function (structuredCloneImplementation, $Error) { return !fails(function () { var error = new $Error(); var test = structuredCloneImplementation({ a: error, b: error }); return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack); }); }; // https://github.com/whatwg/html/pull/5749 var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { return !fails(function () { var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); return test.name !== 'AggregateError' || test.errors[0] !== 1 || test.message !== PERFORMANCE_MARK || test.cause !== 3; }); }; // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+ // FF<103 and Safari implementations can't clone errors // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604 // FF103 can clone errors, but `.stack` of clone is an empty string // https://bugzilla.mozilla.org/show_bug.cgi?id=1778762 // FF104+ fixed it on usual errors, but not on DOMExceptions // https://bugzilla.mozilla.org/show_bug.cgi?id=1777321 // Chrome <102 returns `null` if cloned object contains multiple references to one error // https://bugs.chromium.org/p/v8/issues/detail?id=12542 // NodeJS implementation can't clone DOMExceptions // https://github.com/nodejs/node/issues/41038 // only FF103+ supports new (html/5749) error cloning semantic var nativeStructuredClone = global.structuredClone; var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone); // Chrome 82+, Safari 14.1+, Deno 1.11+ // Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException` // Chrome returns `null` if cloned object contains multiple references to one error // Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround // Safari implementation can't clone errors // Deno 1.2-1.10 implementations too naive // NodeJS 16.0+ does not have `PerformanceMark` constructor // NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive // and can't clone, for example, `RegExp` or some boxed primitives // https://github.com/nodejs/node/issues/40840 // no one of those implementations supports new (html/5749) error cloning semantic var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) { return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail; }); var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark; var throwUncloneable = function (type) { throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR); }; var throwUnpolyfillable = function (type, action) { throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR); }; var tryNativeRestrictedStructuredClone = function (value, type) { if (!nativeRestrictedStructuredClone) throwUnpolyfillable(type); return nativeRestrictedStructuredClone(value); }; var createDataTransfer = function () { var dataTransfer; try { dataTransfer = new global.DataTransfer(); } catch (error) { try { dataTransfer = new global.ClipboardEvent('').clipboardData; } catch (error2) { /* empty */ } } return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null; }; var cloneBuffer = function (value, map, $type) { if (mapHas(map, value)) return mapGet(map, value); var type = $type || classof(value); var clone, length, options, source, target, i; if (type === 'SharedArrayBuffer') { if (nativeRestrictedStructuredClone) clone = nativeRestrictedStructuredClone(value); // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original else clone = value; } else { var DataView = global.DataView; // `ArrayBuffer#slice` is not available in IE10 // `ArrayBuffer#slice` and `DataView` are not available in old FF if (!DataView && !isCallable(value.slice)) throwUnpolyfillable('ArrayBuffer'); // detached buffers throws in `DataView` and `.slice` try { if (isCallable(value.slice) && !value.resizable) { clone = value.slice(0); } else { length = value.byteLength; options = 'maxByteLength' in value ? { maxByteLength: value.maxByteLength } : undefined; clone = new ArrayBuffer(length, options); source = new DataView(value); target = new DataView(clone); for (i = 0; i < length; i++) { target.setUint8(i, source.getUint8(i)); } } } catch (error) { throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR); } } mapSet(map, value, clone); return clone; }; var cloneView = function (value, type, offset, length, map) { var C = global[type]; // in some old engines like Safari 9, typeof C is 'object' // on Uint8ClampedArray or some other constructors if (!isObject(C)) throwUnpolyfillable(type); return new C(cloneBuffer(value.buffer, map), offset, length); }; var structuredCloneInternal = function (value, map) { if (isSymbol(value)) throwUncloneable('Symbol'); if (!isObject(value)) return value; // effectively preserves circular references if (map) { if (mapHas(map, value)) return mapGet(map, value); } else map = new Map(); var type = classof(value); var C, name, cloned, dataTransfer, i, length, keys, key; switch (type) { case 'Array': cloned = Array(lengthOfArrayLike(value)); break; case 'Object': cloned = {}; break; case 'Map': cloned = new Map(); break; case 'Set': cloned = new Set(); break; case 'RegExp': // in this block because of a Safari 14.1 bug // old FF does not clone regexes passed to the constructor, so get the source and flags directly cloned = new RegExp(value.source, getRegExpFlags(value)); break; case 'Error': name = value.name; switch (name) { case 'AggregateError': cloned = new (getBuiltIn(name))([]); break; case 'EvalError': case 'RangeError': case 'ReferenceError': case 'SuppressedError': case 'SyntaxError': case 'TypeError': case 'URIError': cloned = new (getBuiltIn(name))(); break; case 'CompileError': case 'LinkError': case 'RuntimeError': cloned = new (getBuiltIn('WebAssembly', name))(); break; default: cloned = new Error(); } break; case 'DOMException': cloned = new DOMException(value.message, value.name); break; case 'ArrayBuffer': case 'SharedArrayBuffer': cloned = cloneBuffer(value, map, type); break; case 'DataView': case 'Int8Array': case 'Uint8Array': case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': case 'Int32Array': case 'Uint32Array': case 'Float16Array': case 'Float32Array': case 'Float64Array': case 'BigInt64Array': case 'BigUint64Array': length = type === 'DataView' ? value.byteLength : value.length; cloned = cloneView(value, type, value.byteOffset, length, map); break; case 'DOMQuad': try { cloned = new DOMQuad( structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map) ); } catch (error) { cloned = tryNativeRestrictedStructuredClone(value, type); } break; case 'File': if (nativeRestrictedStructuredClone) try { cloned = nativeRestrictedStructuredClone(value); // NodeJS 20.0.0 bug, https://github.com/nodejs/node/issues/47612 if (classof(cloned) !== type) cloned = undefined; } catch (error) { /* empty */ } if (!cloned) try { cloned = new File([value], value.name, value); } catch (error) { /* empty */ } if (!cloned) throwUnpolyfillable(type); break; case 'FileList': dataTransfer = createDataTransfer(); if (dataTransfer) { for (i = 0, length = lengthOfArrayLike(value); i < length; i++) { dataTransfer.items.add(structuredCloneInternal(value[i], map)); } cloned = dataTransfer.files; } else cloned = tryNativeRestrictedStructuredClone(value, type); break; case 'ImageData': // Safari 9 ImageData is a constructor, but typeof ImageData is 'object' try { cloned = new ImageData( structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace } ); } catch (error) { cloned = tryNativeRestrictedStructuredClone(value, type); } break; default: if (nativeRestrictedStructuredClone) { cloned = nativeRestrictedStructuredClone(value); } else switch (type) { case 'BigInt': // can be a 3rd party polyfill cloned = Object(value.valueOf()); break; case 'Boolean': cloned = Object(thisBooleanValue(value)); break; case 'Number': cloned = Object(thisNumberValue(value)); break; case 'String': cloned = Object(thisStringValue(value)); break; case 'Date': cloned = new Date(thisTimeValue(value)); break; case 'Blob': try { cloned = value.slice(0, value.size, value.type); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMPoint': case 'DOMPointReadOnly': C = global[type]; try { cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMRect': case 'DOMRectReadOnly': C = global[type]; try { cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMMatrix': case 'DOMMatrixReadOnly': C = global[type]; try { cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value); } catch (error) { throwUnpolyfillable(type); } break; case 'AudioData': case 'VideoFrame': if (!isCallable(value.clone)) throwUnpolyfillable(type); try { cloned = value.clone(); } catch (error) { throwUncloneable(type); } break; case 'CropTarget': case 'CryptoKey': case 'FileSystemDirectoryHandle': case 'FileSystemFileHandle': case 'FileSystemHandle': case 'GPUCompilationInfo': case 'GPUCompilationMessage': case 'ImageBitmap': case 'RTCCertificate': case 'WebAssembly.Module': throwUnpolyfillable(type); // break omitted default: throwUncloneable(type); } } mapSet(map, value, cloned); switch (type) { case 'Array': case 'Object': keys = objectKeys(value); for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { key = keys[i]; createProperty(cloned, key, structuredCloneInternal(value[key], map)); } break; case 'Map': value.forEach(function (v, k) { mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map)); }); break; case 'Set': value.forEach(function (v) { setAdd(cloned, structuredCloneInternal(v, map)); }); break; case 'Error': createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map)); if (hasOwn(value, 'cause')) { createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map)); } if (name === 'AggregateError') { cloned.errors = structuredCloneInternal(value.errors, map); } else if (name === 'SuppressedError') { cloned.error = structuredCloneInternal(value.error, map); cloned.suppressed = structuredCloneInternal(value.suppressed, map); } // break omitted case 'DOMException': if (ERROR_STACK_INSTALLABLE) { createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map)); } } return cloned; }; var tryToTransfer = function (rawTransfer, map) { if (!isObject(rawTransfer)) throw new TypeError('Transfer option cannot be converted to a sequence'); var transfer = []; iterate(rawTransfer, function (value) { push(transfer, anObject(value)); }); var i = 0; var length = lengthOfArrayLike(transfer); var buffers = new Set(); var value, type, C, transferred, canvas, context; while (i < length) { value = transfer[i++]; type = classof(value); if (type === 'ArrayBuffer' ? setHas(buffers, value) : mapHas(map, value)) { throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); } if (type === 'ArrayBuffer') { setAdd(buffers, value); continue; } if (PROPER_STRUCTURED_CLONE_TRANSFER) { transferred = nativeStructuredClone(value, { transfer: [value] }); } else switch (type) { case 'ImageBitmap': C = global.OffscreenCanvas; if (!isConstructor(C)) throwUnpolyfillable(type, TRANSFERRING); try { canvas = new C(value.width, value.height); context = canvas.getContext('bitmaprenderer'); context.transferFromImageBitmap(value); transferred = canvas.transferToImageBitmap(); } catch (error) { /* empty */ } break; case 'AudioData': case 'VideoFrame': if (!isCallable(value.clone) || !isCallable(value.close)) throwUnpolyfillable(type, TRANSFERRING); try { transferred = value.clone(); value.close(); } catch (error) { /* empty */ } break; case 'MediaSourceHandle': case 'MessagePort': case 'OffscreenCanvas': case 'ReadableStream': case 'TransformStream': case 'WritableStream': throwUnpolyfillable(type, TRANSFERRING); } if (transferred === undefined) throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR); mapSet(map, value, transferred); } return buffers; }; var detachBuffers = function (buffers) { setIterate(buffers, function (buffer) { if (PROPER_STRUCTURED_CLONE_TRANSFER) { nativeRestrictedStructuredClone(buffer, { transfer: [buffer] }); } else if (isCallable(buffer.transfer)) { buffer.transfer(); } else if (detachTransferable) { detachTransferable(buffer); } else { throwUnpolyfillable('ArrayBuffer', TRANSFERRING); } }); }; // `structuredClone` method // https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone $({ global: true, enumerable: true, sham: !PROPER_STRUCTURED_CLONE_TRANSFER, forced: FORCED_REPLACEMENT }, { structuredClone: function structuredClone(value /* , { transfer } */) { var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined; var transfer = options ? options.transfer : undefined; var map, buffers; if (transfer !== undefined) { map = new Map(); buffers = tryToTransfer(transfer, map); } var clone = structuredCloneInternal(value, map); // since of an issue with cloning views of transferred buffers, we a forced to detach them later // https://github.com/zloirock/core-js/issues/1265 if (buffers) detachBuffers(buffers); return clone; } }); /***/ }), /* 459 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(2); var getBuiltIn = __webpack_require__(23); var fails = __webpack_require__(6); var validateArgumentsLength = __webpack_require__(131); var toString = __webpack_require__(76); var USE_NATIVE_URL = __webpack_require__(460); var URL = getBuiltIn('URL'); // https://github.com/nodejs/node/issues/47505 // https://github.com/denoland/deno/issues/18893 var THROWS_WITHOUT_ARGUMENTS = USE_NATIVE_URL && fails(function () { URL.canParse(); }); // `URL.canParse` method // https://url.spec.whatwg.org/#dom-url-canparse $({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS }, { canParse: function canParse(url) { var length = validateArgumentsLength(arguments.length, 1); var urlString = toString(url); var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]); try { return !!new URL(urlString, base); } catch (error) { return false; } } }); /***/ }), /* 460 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(6); var wellKnownSymbol = __webpack_require__(33); var DESCRIPTORS = __webpack_require__(5); var IS_PURE = __webpack_require__(35); var ITERATOR = wellKnownSymbol('iterator'); module.exports = !fails(function () { // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var params = url.searchParams; var params2 = new URLSearchParams('a=1&a=2&b=3'); var result = ''; url.pathname = 'c%20d'; params.forEach(function (value, key) { params['delete']('b'); result += key + value; }); params2['delete']('a', 2); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params2['delete']('b', undefined); return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b'))) || (!params.size && (IS_PURE || !DESCRIPTORS)) || !params.sort || url.href !== 'http://a/c%20d?a=1&c=3' || params.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !params[ITERATOR] // throws in Edge || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62- || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66- || result !== 'a1c3' // throws in Safari || new URL('http://x', undefined).host !== 'x'; }); /***/ }), /* 461 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineBuiltIn = __webpack_require__(47); var uncurryThis = __webpack_require__(13); var toString = __webpack_require__(76); var validateArgumentsLength = __webpack_require__(131); var $URLSearchParams = URLSearchParams; var URLSearchParamsPrototype = $URLSearchParams.prototype; var append = uncurryThis(URLSearchParamsPrototype.append); var $delete = uncurryThis(URLSearchParamsPrototype['delete']); var forEach = uncurryThis(URLSearchParamsPrototype.forEach); var push = uncurryThis([].push); var params = new $URLSearchParams('a=1&a=2&b=3'); params['delete']('a', 1); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params['delete']('b', undefined); if (params + '' !== 'a=2') { defineBuiltIn(URLSearchParamsPrototype, 'delete', function (name /* , value */) { var length = arguments.length; var $value = length < 2 ? undefined : arguments[1]; if (length && $value === undefined) return $delete(this, name); var entries = []; forEach(this, function (v, k) { // also validates `this` push(entries, { key: k, value: v }); }); validateArgumentsLength(length, 1); var key = toString(name); var value = toString($value); var index = 0; var dindex = 0; var found = false; var entriesLength = entries.length; var entry; while (index < entriesLength) { entry = entries[index++]; if (found || entry.key === key) { found = true; $delete(this, entry.key); } else dindex++; } while (dindex < entriesLength) { entry = entries[dindex++]; if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value); } }, { enumerable: true, unsafe: true }); } /***/ }), /* 462 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineBuiltIn = __webpack_require__(47); var uncurryThis = __webpack_require__(13); var toString = __webpack_require__(76); var validateArgumentsLength = __webpack_require__(131); var $URLSearchParams = URLSearchParams; var URLSearchParamsPrototype = $URLSearchParams.prototype; var getAll = uncurryThis(URLSearchParamsPrototype.getAll); var $has = uncurryThis(URLSearchParamsPrototype.has); var params = new $URLSearchParams('a=1'); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 if (params.has('a', 2) || !params.has('a', undefined)) { defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) { var length = arguments.length; var $value = length < 2 ? undefined : arguments[1]; if (length && $value === undefined) return $has(this, name); var values = getAll(this, name); // also validates `this` validateArgumentsLength(length, 1); var value = toString($value); var index = 0; while (index < values.length) { if (values[index++] === value) return true; } return false; }, { enumerable: true, unsafe: true }); } /***/ }), /* 463 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(5); var uncurryThis = __webpack_require__(13); var defineBuiltInAccessor = __webpack_require__(119); var URLSearchParamsPrototype = URLSearchParams.prototype; var forEach = uncurryThis(URLSearchParamsPrototype.forEach); // `URLSearchParams.prototype.size` getter // https://github.com/whatwg/url/pull/734 if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) { defineBuiltInAccessor(URLSearchParamsPrototype, 'size', { get: function size() { var count = 0; forEach(this, function () { count++; }); return count; }, configurable: true, enumerable: true }); } /***/ }) /******/ ]); }(); core-js-3.33.2/docs/000077500000000000000000000000001451776221300141045ustar00rootroot00000000000000core-js-3.33.2/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md000066400000000000000000001131551451776221300252160ustar00rootroot00000000000000# core-js@3, babel and a look into the future After more than 1.5 years of development, dozens of pre-releases, many sleepless nights, **[`core-js@3`](https://github.com/zloirock/core-js)** is finally released. It's the largest set of changes in `core-js` and polyfilling-related **[`babel`](https://babeljs.io)** features of all time. What is `core-js`? - It is a polyfill of the JavaScript standard library, which supports: - The latest ECMAScript standard. - ECMAScript standard library proposals. - Some WHATWG / W3C standards (cross-platform or closely related ECMAScript). - It is maximally modular: you can easily choose to load only the features you will be using. - It can be used without polluting the global namespace. - It is [tightly integrated with `babel`](#Babel): this allows many optimizations of `core-js` import. It's the most universal and [the most popular](https://npmtrends.com/airbnb-js-shims-vs-core-js-vs-es5-shim-vs-es6-shim-vs-js-polyfills-vs-polyfill-library-vs-polyfill-service) way to polyfill JavaScript standard library, but a big part of developers just don't know that they use `core-js` indirectly 🙂 ## Contributing `core-js` is my own hobby project and it does not bring me any profit. It takes too much time and it is really costly: to finish work on `core-js@3`, I had left my job some months ago. This project facilitates the life of many people and companies. For these reasons, it makes sense to start raising funds to support the maintenance of `core-js`. If you are interested in the `core-js` project or use it in your day-to-day work, you can become a sponsor on **[Open Collective](https://opencollective.com/core-js#sponsor)** or **[Patreon](https://www.patreon.com/zloirock)**. You can propose [me](http://zloirock.ru/) a good job where I will be able to work on something related. Or you can contribute in another way: you can help improve code, tests or documentation (currently, `core-js` documentation is terrible!). ## What changed in `core-js@3`? ### Changes in JavaScript standard library content Because of the following two reasons, this release is rich with new JavaScript polyfills: - `core-js` only has breaking changes in major releases, even if it is needed to reflect a change in a proposal. - `core-js@2` entered feature freeze 1.5 years ago; all new features were added only to the `core-js@3` branch. #### Stable ECMAScript features Stable ECMAScript features had already been almost completely supported by `core-js` for a long time, however, `core-js@3` introduced some new features: - Added support of [`@@isConcatSpreadable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/isConcatSpreadable) and [`@@species`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/species) well-known symbols, introduced in ECMAScript 2015, to all the methods which use them. - Added [`Array.prototype.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) and [`Array.prototype.flatMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap) methods from ECMAScript 2018 (`core-js@2` provided a polyfill for an old version of this proposal with `Array.prototype.flatten`). - Added [`Object.fromEntries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries) method, introduced in ECMAScript 2019. - Added [`Symbol.prototype.description`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/description) accessor, introduced ECMAScript 2019. Some features that have already been available for a long time as proposals have been accepted in ES2016-ES2019 and are now marked as stable: - [`Array.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) and [`%TypedArray%.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/includes) methods (ECMAScript 2016) - [`Object.values`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values) and [`Object.entries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) methods (ECMAScript 2017) - [`Object.getOwnPropertyDescriptors`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors) method (ECMAScript 2017) - [`String.prototype.padStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) and [`String.prototype.padEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) methods (ECMAScript 2017) - [`Promise.prototype.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) method (ECMAScript 2018) - [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator) well-known symbol (ECMAScript 2018) - [`Object.prototype.__define(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) and [`Object.prototype.__lookup(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__) methods (ECMAScript 2018) - [`String.prototype.trim(Start|End|Left|Right)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart) methods (ECMAScript 2019) Added many fixes for browsers bugs/issues. For example, [Safari 12.0 `Array.prototype.reverse` bug](https://bugs.webkit.org/show_bug.cgi?id=188794) has been fixed. #### ECMAScript proposals In addition to supported before, `core-js@3` now supports the following ECMAScript proposals: - [`globalThis`](https://github.com/tc39/proposal-global) stage 3 proposal - before, we had `global` and `System.global` - [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled) stage 2 proposal - [New `Set` methods](https://github.com/tc39/proposal-set-methods) stage 2 proposal: - `Set.prototype.difference` - `Set.prototype.intersection` - `Set.prototype.isDisjointFrom` - `Set.prototype.isSubsetOf` - `Set.prototype.isSupersetOf` - `Set.prototype.symmetricDifference` - `Set.prototype.union` - [New collections methods](https://github.com/tc39/proposal-collection-methods) stage 1 proposal, which includes many new useful methods: - `Map.groupBy` - `Map.keyBy` - `Map.prototype.deleteAll` - `Map.prototype.every` - `Map.prototype.filter` - `Map.prototype.find` - `Map.prototype.findKey` - `Map.prototype.includes` - `Map.prototype.keyOf` - `Map.prototype.mapKeys` - `Map.prototype.mapValues` - `Map.prototype.merge` - `Map.prototype.reduce` - `Map.prototype.some` - `Map.prototype.update` - `Set.prototype.addAll` - `Set.prototype.deleteAll` - `Set.prototype.every` - `Set.prototype.filter` - `Set.prototype.find` - `Set.prototype.join` - `Set.prototype.map` - `Set.prototype.reduce` - `Set.prototype.some` - `WeakMap.prototype.deleteAll` - `WeakSet.prototype.addAll` - `WeakSet.prototype.deleteAll` - [`String.prototype.replaceAll`](https://github.com/tc39/proposal-string-replace-all) stage 1 proposal - [`String.prototype.codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints) stage 1 proposal - [`Array.prototype.last(Item|Index)`](https://github.com/keithamus/proposal-array-last) stage 1 proposal - [`compositeKey` and `compositeSymbol` methods](https://github.com/bmeck/proposal-richer-keys/tree/master/compositeKey) stage 1 proposal - [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) stage 1 proposal - [`Math.seededPRNG`](https://github.com/tc39/proposal-seeded-random) stage 1 proposal - [`Promise.any` (with `AggregateError`)](https://github.com/tc39/proposal-promise-any) stage 0 proposal Some proposals have been largely changed, and `core-js` was updated accordingly: - [`String.prototype.matchAll`](https://github.com/tc39/proposal-string-matchall) stage 3 proposal - [`Observable`](https://github.com/tc39/proposal-observable) stage 1 proposal #### Web standards Many useful features have been added to this category. The most important one is support for [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) and [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). It was [one of the most popular feature requests](https://github.com/zloirock/core-js/issues/117). Adding `URL` and `URLSearchParams`, making maximally spec-compliant, supporting any environment keeping their source code small compact was [one of the hardest tasks](https://github.com/zloirock/core-js/pull/454/files) in the `core-js@3` development. `core-js@3` includes *a standard* method to create microtasks in JavaScript: [`queueMicrotask`](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing). `core-js@2` provided the `asap` function which did the same thing and was an old ECMAScript proposal. `queueMicrotask` is defined in the HTML standard and it is already available in modern engines like Chromium or NodeJS. Another popular feature request was support for the [`.forEach` method on DOM collection](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach). Since `core-js` already polyfilled iterators of DOM collections, why not add also `.forEach` to `NodeList` and `DOMTokenList`? #### Removed obsolete features: - `Reflect.enumerate` because it's removed from the spec - `System.global` and `global` since now they are replaced by `globalThis` - `Array.prototype.flatten` since it's replaced by `Array.prototype.flat` - `asap` since it's replaced by `queueMicrotask` - `Error.isError` has withdrawn a long time ago - `RegExp.escape` rejected a long time ago - `Map.prototype.toJSON` and `Set.prototype.toJSON` also rejected a long time ago - Unnecessary `CSSRuleList`, `MediaList`, `StyleSheetList` iteration methods which were added mistakenly #### No more non-standard non-proposed features Many years ago, I started writing a library which I needed as the core of my JavaScript applications: this library contained polyfills and some utilities for common needs. After some time, it was published as `core-js`. I think that at this moment most `core-js` users do not use non-standard `core-js` features. Almost all of them were removed in previous releases, and it's time to remove all the remaining ones from `core-js`. Starting from this release, `core-js` can be finally called a polyfill. ### Packages, entry points and modules names A popular issue was a big size (~2MB) of the `core-js` package and duplication of many of its files. For this reason, `core-js` was split into three packages: - [`core-js`](https://www.npmjs.com/package/core-js), which defines global polyfills. (~500KB, [40KB minified and gzipped](https://bundlephobia.com/result?p=core-js@3.0.0-beta.20)) - [`core-js-pure`](https://www.npmjs.com/package/core-js-pure), which provides polyfills without pollution the global environment. It's the equivalent of `core-js/library` from `core-js@2`. (~440KB) - [`core-js-bundle`](https://www.npmjs.com/package/core-js-bundle): a bundled version of `core-js` which defines global polyfills. In previous versions of `core-js`, modules with polyfills for stable ECMAScript features and ECMAScript proposals were prefixed with `es6.` and `es7.` respectively. It was a decision taken in 2014 when all the features which could be after ES6 were considered as ES7. In `core-js@3` all stable ECMAScript features are prefixed with `es.`, while ECMAScript proposals with `esnext.`. Almost all CommonJS entry points were changed. In `core-js@3` there are many more entry points than there were in `core-js@2`: they bring maximum flexibility, making it possible to include only the polyfills needed by your application. Here are some examples of how the new entry points can be used: ```js // polyfill all `core-js` features: import "core-js"; // polyfill only stable `core-js` features - ES and web standards: import "core-js/stable"; // polyfill only stable ES features: import "core-js/es"; // if you want to polyfill `Set`: // all `Set`-related features, with ES proposals: import "core-js/features/set"; // stable required for `Set` ES features and features from web standards // (DOM collections iterator in this case): import "core-js/stable/set"; // only stable ES features required for `Set`: import "core-js/es/set"; // the same without global namespace pollution: import Set from "core-js-pure/features/set"; import Set from "core-js-pure/stable/set"; import Set from "core-js-pure/es/set"; // if you want to polyfill just required methods: import "core-js/features/set/intersection"; import "core-js/stable/queue-microtask"; import "core-js/es/array/from"; // polyfill reflect metadata proposal: import "core-js/proposals/reflect-metadata"; // polyfill all stage 2+ proposals: import "core-js/stage/2"; ``` ### Some other important changes It's now possible to [configure the aggressiveness](https://github.com/zloirock/core-js/blob/master/README.md#configurable-level-of-aggressiveness) of `core-js` polyfills. If you think that `core-js` feature detection is too aggressive in some cases and that the native implementation is correct enough for your use-case, or if an incorrect implementation isn't detected by `core-js` as such, you can change the `core-js` default behavior. If a feature can't be implemented following the specification in every detail, `core-js` adds a `.sham` property to the polyfill. For example, in IE11 `Symbol.sham` is `true`. No more LiveScript! When I started the `core-js` project, I mainly used [LiveScript](http://livescript.net/); after some time, I rewrote all the polyfills in JavaScript. Tests and helper tools in `core-js@2` still used LiveScript: it is a very interesting CoffeeScript-like language with powerful syntax sugar which allows writing very compact code, but now it's almost dead. Other than that, it was an additional barrier for contributing to `core-js` because most `core-js` users do not know this language. `core-js@3` tests and tools use modern ES syntax: it could be a good moment to start contributing to `core-js` 🙂 For almost all users, for optimization of `core-js` import, I recommend using [`babel`](#Babel). However, [`core-js-builder`](https://npmjs.com/package/core-js-builder) is still useful in some cases. Now it supports the `targets` argument which takes a [`browserslist`](https://github.com/browserslist/browserslist) query with target engines - you can create a bundle which contains only required for target engines polyfills. For cases like this, I made the [`core-js-compat`](https://www.npmjs.com/package/core-js-compat) package, more info about it you could find in [`@babel/preset-env` part of this article](#babelpreset-env). --- This is just the tip of the iceberg, much more changes were done internally. You can find more info about `core-js` changes in the [changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300). ## Babel As mentioned above, `babel` and `core-js` are tightly integrated: `babel` gives the possibility of optimizing the `core-js` import as much as possible. A serious part of work on `core-js@3` was improving `core-js`-related `babel` features (see [this PR](https://github.com/babel/babel/pull/7646)). Those changes are published in [Babel 7.4.0](https://babeljs.io/blog/2019/03/19/7.4.0). ### `@babel/polyfill` [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) is a wrapper package which only includes imports of stable `core-js` features (in Babel 6 it also included proposals) and `regenerator-runtime/runtime`, needed by transpiled generators and async functions. This package doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`: for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. Instead of ```js import "@babel/polyfill"; ``` you should use those 2 lines: ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` Don't forget install those dependencies directly! ```sh npm i --save core-js regenerator-runtime ``` ### `@babel/preset-env` [`@babel/preset-env`](https://babeljs.io/docs/en/next/babel-preset-env#usebuiltins) has 2 different modes, which can be enabled with the `useBuiltIns` option: `entry` and `usage`, which optimize imports of `core-js` in different ways. Babel 7.4.0 introduces both changes commons to the two modes and specific to each mode. Since `@babel/preset-env` now supports `core-js@2` and `core-js@3`, `useBuiltIns` requires setting a new option, `corejs`, which specifies the used version (`corejs: 2` or `corejs: 3`). If it isn't directly set, `corejs: 2` will be used by default and it will show a warning. To make it possible for Babel to support new `core-js` features introduced in future minor versions, you also can specify the minor `core-js` version used in your project. For example, if you want to use `core-js@3.1` and take advantage of new features added in that version, you can set the `corejs` option to `3.1`: `corejs: '3.1'` or `corejs: { version: '3.1' }`. One of the most important parts of `@babel/preset-env` was the source providing data about the features supported by different target engines, to understand whether something needs to be polyfilled by `core-js` or not. [`caniuse`](https://caniuse.com/), [`mdn`](https://developer.mozilla.org/en-US/) and [`compat-table`](http://kangax.github.io/compat-table/es6/) are good educational resources but aren't really meant to be used as data sources for developer tools: only the `compat-table` contains a good set of ES-related data and it is used by `@babel/preset-env`, but it has some limitations: - it contains data only about ECMAScript features and proposals, but not about web platform features like `setImmediate` or DOM collections iterators. So, up to now, `@babel/preset-env` added all web platform features from `core-js` even for targets where they are supported. - it does not contain any information about (even serious) bugs in engines: for example, already mentioned `Array#reverse` broken in Safari 12 but it isn't marked as unsupported by `compat-table`. On the other hand, `core-js` correctly fixes broken implementations, but with `compat-table` this capability wasn't taken advantage of. - it contains only some basic and naive tests, which do not check that features work as they should in real-world cases. For example, old Safari has broken iterators without `.next` method, but `compat-table` shows them as supported because it just checks that `typeof` of methods which should return iterators is `"function"`. Some features like typed arrays are almost completely not covered. - `compat-table` is not designed for providing data for tools. I'm one of the `compat-table` maintainers, but [some of the other maintainers are against maintaining this functionality](https://github.com/kangax/compat-table/pull/1312). For this reason, I created the [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) package: it provides data about the necessity of `core-js` modules for different target engines. When using `core-js@3`, `@babel/preset-env` will use that new package instead of `compat-table`. [Please help us with testing and providing data and mappings for missing engines! 😊](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data) Until Babel 7.3, `@babel/preset-env` had some problems related to the order polyfills were injected. Starting from version 7.4.0, `@babel/preset-env` will add the polyfills only when it knows which of them is required and in the recommended order. #### `useBuiltIns: entry` with `corejs: 3` When using this option, `@babel/preset-env` replaces direct imports of `core-js` with imports of only the specific modules required for a target environment. Before those changes, `@babel/preset-env` replaced only `import '@babel/polyfill'` and `import 'core-js'`, they were synonyms and used for polyfilling all stable JavaScript features. Since `@babel/polyfill` is now deprecated, `@babel/preset-env` doesn't transpile it when `corejs` is set to `3`. An equivalent replacement for `@babel/polyfill` with `core-js@3` is ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` When targeting `chrome 72`, it will be transformed by `@babel/preset-env` to ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; ``` when targeting `chrome 73` (which completely support ES2019 standard library), it will just become a single smaller import: ```js import "core-js/modules/web.immediate"; ``` Since now `@babel/polyfill` is deprecated in favor of separate `core-js` and `regenerator-runtime` inclusion, we can optimize `regenerator-runtime` import. For this reason, `regenerator-runtime` import will be removed from the source code when targeting browsers that support generators natively. Now, `@babel/preset-env` in `useBuiltIns: entry` mode transpile **all available** `core-js` entry points and their combinations. This means that you can customize it as much as you want, by using different `core-js` entry points, and it will be optimized for your target environment. For example, when targeting `chrome 72`, ```js import "core-js/es"; import "core-js/proposals/set-methods"; import "core-js/features/set/map"; ``` will be replaced with ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.set.difference"; import "core-js/modules/esnext.set.intersection"; import "core-js/modules/esnext.set.is-disjoint-from"; import "core-js/modules/esnext.set.is-subset-of"; import "core-js/modules/esnext.set.is-superset-of"; import "core-js/modules/esnext.set.map"; import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; ``` #### `useBuiltIns: usage` with `corejs: 3` When using this option, `@babel/preset-env` adds at the top of each file imports of polyfills only for features used in the current and not supported by target environments. For example, ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` when targeting an old browser like `ie 11`, will be transformed to ```js import "core-js/modules/es.array.includes"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.object.to-string"; import "core-js/modules/es.set"; const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` when targeting, for example, `chrome 72` no imports will be injected, since those polyfills not required for this target: ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` Until Babel 7.3, `useBuiltIns: usage` was unstable and not fully reliable: many polyfills were not included, and many others were added without their required dependencies. In Babel 7.4, I tried to make it understand every possible usage pattern. I improved the techniques used to determine which polyfills should be added on property accesses, object destructuring, `in` operator, global object property accesses. `@babel/preset-env` now injections polyfills required for syntax features: iterators when using `for-of`, destructuring, spread and `yield` delegation; promises when using dynamic `import`, async functions and generators, etc. Babel 7.4 supports injecting proposals polyfills. By default, `@babel/preset-env` does not inject them, but you can opt-in using the `proposals` flag: `corejs: { version: 3, proposals: true }`. ### `@babel/runtime` When used with `core-js@3`, [`@babel/transform-runtime`](https://babeljs.io/docs/en/next/babel-plugin-transform-runtime#corejs) now injects polyfills from `core-js-pure`: a version of `core-js` that doesn't pollute the global namespace. `core-js@3` and `@babel/runtime` have been integrated together by adding a `corejs: 3` option to `@babel/transform-runtime` and creating the `@babel/runtime-corejs3` package. But what advantages did this bring? One of the most popular issue with `@babel/runtime` was that it did not support instance methods. Starting from `@babel/runtime-corejs3`, this problem has resolved. For example, ```js array.includes(something); ``` will be transpiled to ```js import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes"; _includesInstanceProperty(array).call(array, something); ``` Another notable change is the support of ECMAScript proposals. By default, `@babel/plugin-transform-runtime` does not inject polyfills for proposals and use entry points which do not include them but, exactly as you can do in `@babel/preset-env`, you can set the `proposals` flag to enable them: `corejs: { version: 3, proposals: true }`. Without `proposals` flag, ```js new Set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` is transpiled to: ```js import _Set from "@babel/runtime-corejs3/core-js-stable/set"; new _Set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` when proposals are enabled, it becomes: ```js import _Set from "@babel/runtime-corejs3/core-js/set"; import _matchAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/match-all"; new _Set([1, 2, 3, 2, 1]); _matchAllInstanceProperty(string).call(string, /something/g); ``` Some other old issues have been fixed. For example, this quite popular pattern didn't work when using `@babel/runtime-corejs2` but it is supported with `@babel/runtime-corejs3`. ```js myArrayLikeObject[Symbol.iterator] = Array.prototype[Symbol.iterator]; ``` Although previous versions of `@babel/runtime` did not work with instance methods, iterables (both `[Symbol.iterator]()` calls and its presence) were supported using some custom helper functions. Extracting the `[Symbol.iterator]` method was not supported, but now it works. As a cheap bonus, `@babel/runtime` now supports IE8-, with some limitations. For example, since IE8- does not support accessors, modules transform should be used in loose mode and `regenerator-runtime` (which internally uses some ES5+ built-ins) needs to be transpiled by this plugin. ## Look into the future Much work has been done, but `core-js` is still far from perfect. How can the library and tools be improved in the future and how do language changes can affect it? ### Old engines support At this moment, `core-js` tries to support all possible engines and platforms where we can test it: it even supports IE8- or, for example, early Firefox versions. While it is useful for some users, only a small part of developers using `core-js` need it. For many other users, it can cause some problems like bigger bundle size or slower runtime execution. The main problem comes from supporting ES3 engines (above all, IE8-): most modern ES features are based on ES5 features, which aren't available in those very old browsers. The biggest missing important feature is property descriptors: when they aren't available, some features can't be polyfilled because they either are accessors (like `RegExp.prototype.flags` or `URL` properties setters) or are accessors-based (like typed arrays polyfill). In order to workaround this lack, we need to use different workarounds (for example, to keep `Set.prototype.size` updated). Maintenance of those workarounds sometimes is too painful, and removing them would highly simplify many polyfills. However, descriptors are just a part of this problem. The ES5 standard library contains many other features that can be considered as the basis of modern JavaScript: `Object.keys`, `Object.create`, `Object.getPrototypeOf`, `Array.prototype.forEach`, `Function.prototype.bind`, etc. Unlike the most modern features, `core-js` internally relies on them and [in order to implement even a simple modern function, `core-js` needs to load implementations of some of those "building blocks"](https://github.com/babel/babel/pull/7646#discussion_r179333093). It is a problem for users who want to create [a maximally minimalistic bundle](https://github.com/zloirock/core-js/issues/388) and only import just a few `core-js` polyfills. In some countries, IE8 still is quite popular, but browsers should disappear at some point to allow the web to move forward. IE8 was released 19-03-2009; today it is 19-03-2019: it's the 10th birthday of IE8. IE6 is about to turn 18: I stopped testing new `core-js` versions in IE6 some months ago. We should drop IE8- and other engines without basic ES5 support in `core-js@4`. ### ECMAScript modules `core-js` use `CommonJS` modules. It has been the most popular JavaScript modules format for a long time, but now ECMAScript provides its own modules format. Many engines already support them; some bundlers (like `rollup`) are based on them, and some other bundlers provide them as an alternative to `CommonJS`. It would make sense to provide an alternative version of `core-js` which uses ECMAScript modules format. ### Extended web standards support? `core-js` is currently focused on ECMAScript support, but it also supports a few web standards features which are available cross-platform and closely related to ECMAScript. Adding polyfills for web standards like `fetch` is a very popular feature request. The main reason why `core-js` doesn’t include them was that it would have seriously increased bundles size and it would have forced `core-js` users to load features which might not have been needed. Now `core-js` is maximally modular, user can include only some chosen features, there are tools like `@babel/preset-env` and `@babel/runtime` which helps to get rid of unused or unnecessary polyfills. Maybe it's time to revisit this old decision? ### `@babel/runtime` for target environment Currently, we can't set the target environment as `@babel/runtime` like we can do for `@babel/preset-env`. That means that `@babel/runtime` injects all possible polyfills even when targeting modern engines: it unnecessarily increases the size of the final bundle. Since `core-js-compat` contains all the necessary data, in the future, it will be possible to add support for compiling for a target environment to `@babel/runtime` and to add a `useBuiltIns: runtime` option to `@babel/preset-env`. ### Better optimization of polyfill loading As explained above, Babel plugins give us different ways of optimizing `core-js` usage, but they are not perfect: we can improve them. `@babel/preset-env` with `useBuiltIns: usage` now should work much better than before, but it could still fail in some uncommon cases: when the code can't be statically analyzed. For that case, we need to find a way for library developers to specify which polyfills are required by their library instead of directly loading them: some kind of metadata, which will be used to inject polyfills when creating the final bundle. Another issue of `useBuiltIns: usage` is the duplication of polyfills import. `useBuiltIns: usage` can inject dozens of `core-js` imports in each file. But what if our project has thousands of files or even tenths of thousands? In this case, we will have more lines of code with `import "core-js/..."` than lines of code in `core-js` itself: we need a way to collect all imports to one file so that they can be deduplicated. Almost every `@babel/preset-env` user which targets old engines like IE11 uses a single bundle for every browser. That means that even modern engines with full ES2019 support will be loading the unnecessary polyfills only required by IE11. Sure, we can create different bundles for different targets and use, for example, the `type=module` / `nomodules` attributes: one bundle for modern engines with modules support, another for legacy engines. Unfortunately, it’s not a complete solution to this problem: a service that bundles polyfills for the required target based on the user agent would be really useful. And we already have one - [`polyfill-service`](https://github.com/Financial-Times/polyfill-service). Although it is an interesting and popular service, polyfills quality leaves much to be desired. It’s not as bad as it was some years ago: the team of this project is actively working to improve it, but I wouldn't recommend using polyfills from this project if you want them to match native implementations. Some years ago was an attempt to use `core-js` as a polyfills source for this project, but it hadn't been possible because `polyfill-service` relies on files concatenation instead of modules (like `core-js` in the first few months after it was published 😊). A service like this one integrated with a good polyfills source like `core-js`, which only loads the needed polyfills by statically analyzing the source like Babel's `useBuiltIns: usage` option does could cause a revolution in the way we think about polyfills. ### New features proposals from TC39 and possible problems for `core-js` TC39 is working really hard to improve ECMAScript: you can see the progress by looking at all the new proposals implemented in `core-js`. However, I think that some features of some proposals could cause serious problems for polyfilling / transpiling. There would be enough to say about this topic to write a whole new post, but I'll try to summarize my thoughts here. #### Standard library proposal, stage 1 At this moment, TC39 is considering adding to ECMAScript [built-in modules](https://github.com/tc39/proposal-javascript-standard-library): a modular standard library. It would be a great addition to JavaScript, and `core-js` is the best place where it could be polyfilled. With the techniques used in `@babel/preset-env` and `@babel/runtime`, we could theoretically inject polyfills for required built-in modules in a very simple way. However, the current version of this proposal causes some serious problems which don't make it as straightforward. Polyfilling of built-in modules, [as stated by the authors of the proposal](https://github.com/tc39/proposal-javascript-standard-library/issues/2), only means falling back to layered APIs or import maps. This means that if a native module will be missing, it will be possible to load a polyfill from a provided URL. That's absolutely not what polyfills need, and it is incompatible with the architecture of `core-js` and every other popular polyfill project. Import maps shouldn't be the only way to polyfill built-in modules. We will be able to get a built-in module just by using ES modules syntax with a special prefix. This syntax haven't any equal based on the previous version of the language - transpiled modules will not be able to interact with not transpiled in modern engines - it will cause problems for package distribution. More other, it will work asynchronously. It's a critical problem for feature detection - scripts will not wait when you'll detect a feature and load a polyfill - feature detection should be done synchronously. [The first implementation of built-in modules without a proper way of transpiling / polyfilling already available](https://developers.google.com/web/updates/2019/03/kv-storage). If it will not be revised, built-in modules will not be able to be polyfilled in the current `core-js` format. The proposed way of polyfilling will seriously complicate the lives of developers. The issue with the standard library can be solved by adding a new global (maybe it will be the last one?): a registry of built-in modules which will allow getting and setting them synchronously, like ```js StandardLibraryRegistry.get(moduleName); StandardLibraryRegistry.set(moduleName, value); ``` Asynchronous fallbacks like layered APIs should be used only after this global registry. As a bonus point, it would simplify transpiling native modules import to old syntax. #### Decorators proposal, new iteration, stage 2 [In the new iteration](https://github.com/tc39/proposal-decorators) of this proposal, it has been seriously reworked. Decorator definitions aren't a syntax sugar anymore and, like with built-in modules, we will not be able to write a decorator in an old version of the language and use it as a native decorator. Other than that, decorators are not just usual identifiers - they live in a parallel lexical scope: this means that transpiled decorators can't interact with native decorators. The proposal authors recommend distributing packages with untranspiled decorators and leaving to the library consumers the choice to transpile their dependencies. However, it's not possible in different scenarios. This approach could prevent `core-js` from polyfilling new built-in decorators when they will be added to the JS standard library. Decorators should be just an alternative way of applying functions on something, they should only be syntax sugar for wrappers. Why complicate things? --- If a new language feature does not introduce to the language something fundamentally new, an alternative for what couldn't be implemented in a previous version of the language, we should be able to transpile and/or polyfill it, and transpiled/polyfilled code should be able to interact with the native feature in engines which supports this feature natively. I hope for the wisdom of the authors of those proposals and of the committee, that these proposals will be adapted so that it will be possible to properly transpile or polyfill them. --- If you are interested in the `core-js` project or use it in your day-to-day work, you can become a sponsor on **[Open Collective](https://opencollective.com/core-js#sponsor)** or **[Patreon](https://www.patreon.com/zloirock)**. `core-js` isn't backed by a company: its future depends on you. --- **Feel free to add comments to this article [here](https://github.com/zloirock/core-js/discussions/963).** **[Denis Pushkarev](https://github.com/zloirock)**, **19-03-2019**, *thanks [Nicolò Ribaudo](https://github.com/nicolo-ribaudo) for redaction* core-js-3.33.2/docs/2023-02-14-so-whats-next.md000066400000000000000000002270311451776221300202010ustar00rootroot00000000000000

core-js

# So, what's next? Hi. I am (**[@zloirock](https://github.com/zloirock)**), a full-time open-source developer. I don't like to write long posts, but it seems it is high time to do it. Initially, this post was supposed to be a post about the start of active development of the new major version of `core-js` and the roadmap (it was moved to [the second half](#roadmap)), however, due to recent events, it became a really long post about many different things... I'm fucking tired. Free open-source software is fundamentally broken. I could stop working on this silently, but I want to give open-source one last chance.
🔻 Click to see how you can help 🔻 If you or your company use `core-js` in one way or another and are interested in the quality of your supply chain, support the project: - [**Open Collective**](https://opencollective.com/core-js) - [**Patreon**](https://patreon.com/zloirock) - [**Boosty**](https://boosty.to/zloirock) - **Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz )** - [**Alipay**](https://user-images.githubusercontent.com/2213682/219464783-c17ad329-17ce-4795-82a7-f609493345ed.png) **Write me if you want to offer a good job on Web-standards and open-source.**
## What is [`core-js`](https://github.com/zloirock/core-js)? - It is the most popular and the most universal polyfill of the JavaScript standard library, which provides support for the latest ECMAScript standard and proposals, from ancient ES5 features to bleeding edge features like [iterator helpers](https://github.com/tc39/proposal-iterator-helpers), and web platform features closely related to ECMAScript, like `structuredClone`. - It is the most complex and comprehensive polyfill project. At the time of publishing this post, `core-js` contains about half a thousand polyfill modules with different levels of complexity — from `Object.hasOwn` or `Array.prototype.at` to `URL`, `Promise` or `Symbol` — that are designed to work together. With a different architecture, each of them could be a separate package — however, it is not as convenient. - It is maximally modular — you can easily (or even automatically) choose to load only the features you will be using. It can be used without polluting the global namespace (someone calls such a use case "ponyfill"). - It is designed for integration with tools and provides everything that's required for this — for example, `@babel/preset-env`, `@babel/transform-runtime`, and similar SWC features are based on `core-js`. - It is one of the main reasons why developers could use modern ECMAScript features in their development process every day for many years, but most developers just don't know that they have this possibility because of `core-js` since they use `core-js` indirectly as it's provided by their transpilers / frameworks / intermediate packages like `babel-polyfill` / etc. - It is not a framework or a library, whose usage requires the developer to know their API, periodically look at the documentation, or at least remember that he or she is using it. Even if developers use `core-js` directly — it's just some lines of import or some lines in the configuration (in most cases — with mistakes, since almost no one read the documentation), after that, they forget about `core-js` and just use features from web-standards provided by `core-js` — but sometimes this is the most of JS standard library that they use. [About 9 billion NPM downloads / 250 million NPM downloads for a month](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-bundle&from=2014-11-18), 19 million dependent GitHub repositories ([global](https://github.com/zloirock/core-js/network/dependents?package_id=UGFja2FnZS00ODk5NjgyNDU%3D) ⋃ [pure](https://github.com/zloirock/core-js/network/dependents?package_id=UGFja2FnZS00MjYyOTI0Ng%3D%3D)) — big numbers, however, they do not show the real spread of `core-js`. Let's check it. I wrote [a simple script](https://github.com/zloirock/core-js/blob/master/scripts/usage/usage.mjs) that checks the usage of `core-js` in the wild by the Alexa top websites list. We can detect obvious cases of `core-js` usage and used versions (only modern).

usage

At this moment, this script running on the TOP 1000 websites **detects usage of `core-js` on [52%](https://gist.github.com/zloirock/7ad972bba4b21596a4037ea2d87616f6) of tested websites**. Depending on the phase of the moon (the list, websites, etc. are not constants), results may vary by a few percent. However, it's just a naive detection on websites' home pages using a modern browser that loses many cases, **manual check shows that it's additional dozens of percent**. For example, let's leave the home pages of some websites from the screenshot above where `core-js` was **not** found by this script, without repeating for each company (at first — MS that's already on the screenshot) websites (be patient, after the series of screenshots the number of pictures will decrease):

whatsapp

---

linkedin

---

netflix

---

qq

---

ebay

---

apple

---

fandom

---

pornhub

---

paypal

---

binance

---

spotify

**With such a manual check, you can find `core-js` on about 75-80% of the top 100 websites** while the script found it on about 55-60%. On a larger sample the percentage, of course, decreases. [Wappalyzer](https://www.wappalyzer.com/technologies/javascript-libraries/) allows to detect used technologies, including `core-js`, with a browser plugin and has previously shown interesting results, but now on their website, all the most popular technologies' public results are limited to only about 5 million positives. Statistics based on Wappalyzer results are available [here](https://almanac.httparchive.org/en/2022/javascript#library-usage) and show `core-js` on 41% and 44% of 8 million mobile and 5 million desktop tested pages. [Built With at this moment shows `core-js` on 54% of TOP 10000 sites](https://trends.builtwith.com/javascript/core-js) (however, I'm not sure about the completeness of their detection and see the graph from another reality). Anyway, we can say with confidence that **`core-js` is used by most of the popular websites**. Even if `core-js` is not used on the main site of any large corporation, it's definitely used in some of their projects. What JS libraries are more widespread on websites? It's not [React](https://trends.builtwith.com/javascript/React), [Lodash](https://trends.builtwith.com/javascript/lodash), or any other most talked-about library or framework, I am pretty sure only about ["good old" jQuery](https://trends.builtwith.com/javascript/jQuery). And `core-js` is not only about a website's frontend — it's used almost everywhere where JavaScript is used — but I think that's more than enough statistics.

github

However, for the above reasons, [**almost no one remembers that he or she uses `core-js`**](https://2022.stateofjs.com/en-US/other-tools). Why am I posting this? No, not to show how cool I am, but to show how bad everything is. Read on. --- ## Let's start the next part with one popular `xkcd` picture [

xkcd

](https://xkcd.com/2347/) ### Beginning I switched my development stack to full-stack JavaScript in 2012. It was a time when JavaScript still was too raw — IE still was more popular than anything else, ES3 era browsers still occupied a significant part of the web, the latest NodeJS version was 0.7 — it was just starting its way. JavaScript still was not adapted for writing of serious applications and developers solved the lack of required language syntax sugar with compilers from languages like CoffeeScript and the lack of proper standard library with libraries like Underscore. However, it wasn't a standard — over time, these languages and libraries became obsolete together with the projects that used them. So, I took all news of the upcoming ECMAScript ~~Harmony~~ 6 standard with great hope. Given the prevalence of old JavaScript engines and the fact that users were in no hurry and often did not have the opportunity to abandon them, even in the case of quick and problem-free adoption of the new ECMAScript standard, the ability to use it only through JavaScript engines was postponed for many and many years. But it was possible to try to get support features from this standard using some tools. Transpilers (this word was not as popular as it is now) should have to solve the problem with the syntax, and polyfills — with the standard library. However, at that time the necessary toolkit was only just beginning to emerge. It was a time when ECMAScript transpilers started to become popular and develop actively. However, at the same time, polyfills have barely evolved according to users' and real-life projects' needs. They were not modular. They could not be used without global namespace pollution — so they were not suitable for libraries. They weren't a single complex — it was required to use multiple different polyfill libraries from different authors and somehow make them work together — but in some cases, it was almost impossible. Too many necessary fundamental language features were just missing. To fix these problems, at the end of 2012, initially for my own projects, I started to work on a project that was later called `core-js`. I wanted to make the life of all JS developers easier and in November 2014, I published `core-js` as an open-source project. *Maybe it was the biggest mistake in my life.* Since I was not the only one who faced these issues, after a few months, `core-js` has already become the de facto standard of polyfill for JavaScript standard library features. `core-js` was integrated into Babel (`6to5` at that moment) which appeared a couple of months before `core-js` was published — some of the aforementioned issues were critical for that project too. `core-js` began to be distributed as `6to5/polyfill`; and after rebranding as `babel-polyfill`. After a few months of collaboration, a tool has appeared, which became `babel-runtime` after rebranding and evolution. A few months later `core-js` was integrated into the key frameworks. ### Ensuring compatibility for the whole Web I didn't promote myself or the project. *This is the second mistake.* `core-js` didn't have a website or social media accounts, only GitHub. I did not show up at conferences to talk about it. I wrote almost no posts about it. I was just making a really useful and wanted part of the modern development stack, and I was happy about that. I gave developers a chance to use the most modern and really necessary JavaScript features without waiting for years until they are implemented in all required engines, without thinking about compatibility and bugs — and they started to use it. The spread of the project had grown exponentially — very soon it was already used on dozens of percent of popular websites. However, it was just the start of the required work. Many years of hard work followed. Almost every day I spent some hours on `core-js` and maintenance of related projects (mainly Babel and [`compat-table`](https://kangax.github.io/compat-table/es2016plus/)). ![github](https://user-images.githubusercontent.com/2213682/218516268-6ec765a5-50df-4d45-971f-3c3fc4aba7a1.png) `core-js` is not a several lines library that you can write and forget about it. Unlike the vast majority of libraries, it's bound to the state of the Web. It should react to any change of JavaScript standards or proposals, to any new JS engine release, to any detection of a bug in JS engines, etc. ECMAScript ~~6~~ 2015 was followed by new proposals, new versions of ECMAScript, new non-ECMAScript web standards, new engines and tools, etc. The evolution, the improvement of the project, and the adaptation to the current state of the Web have never stopped — and almost all of this work remains not visible to the average user. The scale of required work was constantly growing. I tried to find other maintainers or at least constant contributors for `core-js` in different ways for a long time, but all attempts have failed. Almost every JS developer used `core-js` indirectly and knew, for example, `babel-polyfill`, `babel-runtime`, or that their framework polyfilled all required features, but almost no one knew `core-js`. In some posts about polyfilling where `core-js` was mentioned, it was called "a small library". It was not a trendy and widely discussed project, so why help maintain it if it works great anyway? Over time, I lost hope for it, but I felt a responsibility to the community, so I was forced to continue working alone. After a few years combining full-time work and FOSS became almost impossible — no one wanted to pay money for the working time devoted to FOSS, non-working hours were not enough, and sometimes `core-js` required complete immersion for weeks. I thought that proper polyfilling is required for the community and money was not my priority. I left a high-paying job and did not accept some very good options because in those positions I would not have had the opportunity to devote enough time to work on open-source. I started to work on open-source full-time. No one paid me for it. I hoped sooner or later to find a job where I could fully dedicate myself to open-source and web standards. Periodically, I earned the money required for living and work on FOSS, on short-term contracts. I returned to Russia, where it was possible to have a decent standard of living with relatively little money. *One more mistake — as you will see below, money matters.* --- Until April 2019, for about one and a half years as a whole and about a half-year full-time without distraction of any other work, I worked on [the `core-js@3` with a fundamental improvement of polyfilling-related Babel tools](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md), the foundation of the toolkit generation that now is used almost everywhere. ### Accident Shit happened 3 weeks after the `core-js@3` release. One April night, at 3 AM, I was driving home. Two deadly drunk 18-years-old girls in dark clothes decided somehow *to crawl* across a poorly lit highway — one of them laid down on the road, another sat down and dragged the first, but not from the road — directly under my wheels. That's what the witnesses said. I had absolutely no chance to see them. One more witness said that before the accident they were just jokingly fighting on the road. Nothing unusual, it's Russia. One of them died and another girl went to the hospital. However, even in this case, according to Russian arbitrage practice, if the driver is not a son of a deputy or someone like that, he would almost always be found guilty — he has to see and anticipate everything, and a pedestrian owes nothing to anyone. I could end up in prison for a long time, IIRC later the prosecutor requested 7 years. The only way not to end up in prison was reconciliation with "victims" — a standard practice after such accidents — and a good lawyer. Within a few weeks after the accident, I received financial claims totaling about 80 thousand dollars at the exchange rate at that time from "victims'" relatives. A significant amount of money was also needed for a lawyer. Maybe it's not an inconceivable amount of money for a good software engineer, but, as I wrote just above, I worked full time on the `core-js@3` release for a long time. Of course, no one paid me for this work, and I completely exhausted all my financial reserves, so, sure, I didn't have that kind of money and I didn't have a chance to find the money required from available sources. The time I had was running out. ### Fundraising By that time `core-js` already was used almost as widely as it is now. As I wrote above, I looked for contributors for `core-js` for a long time without any success. However, `core-js` is a project that should be actively maintained and it can't stay just frozen. My long-term imprisonment would have caused problems not only for me — but it would have also been the death of `core-js` and a problem for everyone who had been using it — for half of the Web. The notorious [bus factor](https://en.wikipedia.org/wiki/Bus_factor). Some months before that, I started raising funds to support the `core-js` development (mainly it was posted in READMEs on GitHub and NPM). The result was... \$57 / month. Fair pay for full-time work on ensuring compatibility for the whole web 😂 I decided to do a little experiment — to ask for help from the `core-js` users — those who will suffer if `core-js` will be left without maintenance. I added a message in `core-js` installation: ![postinstall](https://user-images.githubusercontent.com/2213682/153024428-28b8102c-ce08-461c-af99-d0417dc7d2cd.png) I understood that I'd have hardly gotten all the required money from donations, however, every dollar mattered. I added a job search message to get a chance to earn the other part. I was thinking that a few lines in the NPM installation log asking to help, which can be hidden if needed, is an acceptable price for using `core-js`. The original plan was to delete this message in a few weeks, but everything went against the plan. How wrong I was about people... ### Hate Of course, I expected that someone would not like to see a request for help in their console, but the continuous stream of hate that I began to receive went through the roof. It was hundreds of messages, posts, and comments every day. All of it can be reduced to something like:

get-rid

This is far from the funniest thing I've seen — if I wanted to, I could collect a huge selection of statements in the style [collected here](https://github.com/samdark/opensource-hate) — but why? I already have enough negativity in my life. **Developers love to use free open-source software — it's free and works great, they are not interested in the fact that many and many thousands of hours of development, and real people with their own problems and needs are behind it. They consider any mention of this as an invasion of their personal space or even a personal affront. For them, these are just gears that should automatically change without any noise and their participation.** So, thousands of developers attacked me with insults and claimed that I have no right to ask them for any kind of help. My request for help offended them so much that they began to demand restricting my access to the repository and packages and move them to someone else like it was done with [`left-pad`](https://arstechnica.com/information-technology/2016/03/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet/). Almost none of them understood what `core-js` does, the scale of the project, and, of course, nobody wanted to maintain it — it should be done by "the community", someone else. Seeing all this hatred, in order to not be led by the haters, I did not delete the help-asking message, which was initially planned to be there only for a couple of weeks, just out of principle. **What about companies which `core-js` helped and is helping to make big money? It's almost every big company. Let's rephrase [this old tweet](https://twitter.com/AdamRackis/status/931195056479965185):** > Company: "We'd like to use SQL Server Enterprise" > > MS: "That'll be a quarter million dollars + $20K/month" > > Company: "Ok!" > > ... > > Company: "We'd like to use core-js" > > core-js: "Ok! npm i core-js" > > Company: "Cool" > > core-js: "Would you like to help contribute financially?" > > Company: "lol no" A few months later, tired of user complaints, NPM presented [`npm fund`](https://docs.npmjs.com/cli/v6/commands/npm-fund) — it was not a solution for the problem, it was just a way to get rid of those complaints. How often did you call `npm fund`? How often did you donate to someone who you saw in `npm fund`? Who did you see and support at first — `core-js` or someone who maintains a dozen of one-line libraries dependent on each other? It also provided NPM with a perfect justification for the future step (read below). Within 9 months many thousands of developers, including developers of projects fundamentally dependent on `core-js`, knew about the situation — but no one offered to maintain `core-js`. Within many months I talked with maintainers of some significant projects dependent on `core-js`, but without any success — they didn't have the necessary time resources. So I was forced to ask some of my friends who were not related to FOSS community (at first **[@slowcheetah](https://github.com/slowcheetah)**, thanks him for his help) to cover for me and at least try to fix significant issues until I get free. --- Few users and small companies supported the `core-js` — and I am very grateful to them. However, the amount of money raised in 9 months was only about 1/4 of the money that should have been collected within a couple of weeks to change something. During the same time, despite everything, the number of `core-js` downloads per day almost doubled. In January 2020 I ended up in prison. ### Release I don't wanna say many words about prison and I have no great desire remembering this. It was slave labor at a chemical factory where my health was significantly ruined and where I 24/7 had a great time in a company of drug dealers, thieves, and killers (from other regimes), without access to the Internet and computers. After about 10 months, I was released early. --- I saw dozens of articles, hundreds of posts, and thousands of comments the essence of many of which can be expressed by this:

reddit

What do you think I did? *Of course, I made the same mistake.* I saw some people who supported the development of `core-js`, many issues, questions, and messages — sure, not as many as angry comments. `core-js` became even more popular and was already used by almost the same percentage of websites as it is now. ### Ensuring compatibility for the whole Web again I returned to `core-js` maintenance like it was before. Moreover, I completely stopped being distracted by contracts and any other work in favor of working on `core-js`. `core-js` had some money on funding platforms — not so much, many times less than I received before starting work on `core-js` full-time — but for me alone it was enough to live on. A kind of down-shifting, full-time Open-Source to make the world better... I didn't think about the tens of thousands of dollars in lawsuits left over from the accident. I didn't think about my future. I thought about a better future for the Web. And, of course, I was hoping that some company would offer me a position with the opportunity to work on web standards and would sponsor my work on polyfills and FOSS. [A lot has been accomplished](https://github.com/zloirock/core-js/compare/0943d43e98aca9ea7b23cdd23ab8b7f3901d04f1...master) over the next two years — in terms of work, almost as much as in the previous 8 years. This is still `core-js@3` — but much better. However, the changelog and even the previous diff reflect only a small percentage of the work done. Almost all of this work remains in the shadows, not visible to the average user. It is the fundamental work with standards and proposals. As a side effect of this work, taking into account the hard work that was done and changes after my feedback and suggestions, I consider many of the ECMAScript proposals — that have become part of the language — are my achievements as much as they are achievements of their champions. It is the work with engines and their bug trackers in searching for bugs. It is the constant automatic and (too often) manual testing in many hundreds of environments, many thousands of environments / builds / test suites combinations to ensure proper operation of the standard library everywhere and to collect compat data. From a raw prototype, made in a couple of days, `core-js` compat data became an exhaustive data set with proper external and internal tooling. It is the design and prototyping of many features that are yet to appear in the project. And also much, much more. --- As you can see above, `core-js` is present in most of the popular websites, provides an almost complete JavaScript standard library, and fixes improper implementations. The number of web page openings with `core-js` is greater than the number of web page openings in Safari and Firefox. Thus, from a certain point of view, `core-js` can be called one of the most popular JavaScript runtimes. When working on `core-js`, I am the first implementer of almost all modern and future JavaScript standard library features, almost all of them have my feedback and they have been fixed according to it. `core-js` is the best playground for experimentation with ECMAScript proposals. In too many cases, proposals receive feedback from other users after they play with experimental `core-js` implementations of these proposals. The best way forward for JavaScript would be for TC39 and `core-js` to work together on the future of JavaScript. For example, TC39 invites members of projects like Babel and others as experts. Except `core-js`. Instead, too often, I see the ignoring of my or `core-js`'s issues or even creation of roadblocks by TC39 members; and they don't even hide it:

shu

---

lj

--- After a while, "support" came from NPM. In `npm@7`, which was released at the end of 2020, as a logical continuation of `npm fund`, the console output was disabled in post-install scripts. The result was expectable, because people stopped seeing the funding request and almost no one uses `npm fund`, the number of `core-js` backers began to decline. An excellent support for the project from those, who not only earn by distributing my work, but also use it themselves :-)

npm

In addition, another factor came into play again. Higher quality — less support. Is the library well-maintained? There are practically almost no open bug reports, and when they happen, they are fixed almost instantly? Does the library already give us almost everything we want? Yes? So why should we support the maintenance of the library? The price at which this is done for the maintainers is not on the surface — for most developers and companies, it's still just "a small library". Many of those, who backed `core-js` before, stopped doing it. The `core-js` code contains my copyright. As you can see at the top of this post, it's present in about half of all websites. Regularly someone finds it in the source code of harmful sites / applications — but they don't know what `core-js` is and their tech level is not good enough even to find it out. When this happens, the police will call and threaten me, and someone even tried to blackmail me. Sometimes it's not funny at all. I have been contacted several times by American and Canadian journalists who discovered `core-js` on American news and government websites. They were very disappointed that I was not an evil Russian hacker who meddles in American elections. The endless stream of hatred decreased slightly over time but continues. However, most of it moved from something like GitHub issues or Twitter threads to my mail or IM. Today, one developer wrote me a message. He called me a parasite on the body of the developer community that makes a lot of money spamming and doing nothing useful. He called me the same murderer as [Hans Reiser](https://en.wikipedia.org/wiki/Hans_Reiser), but who bought the judge and escaped unpunished. He wished death for me and all my relatives. And there is nothing unusual here, I get several of such messages a month. Last year, one more thing was added that I am a "Russian fascist". ### Some words about the war **Open-source should be out of politics.** I don't want to choose between two kinds of evil. I will not comment on this in more detail, since there are people close to me on both sides of the border who may suffer because of this. Let me remind you what I wrote about above: I returned to Russia because it was a place where it was possible to have a decent standard of living for relatively little money and to concentrate on FOSS instead of making money. Now I cannot leave Russia, because after the accident I have outstanding lawsuits in the amount of tens of thousands of dollars and I am forbidden to leave the country until they are paid off. ### What do you think, how much money does `core-js` receive each month? When I started to maintain `core-js` full-time, without being distracted by contracts and any other work, **it was about \$2500 per month — it was about 4-5 times less than I usually had on full-time contracts**. Remember, a kind of down-shifting, to make the Web better. Temporarily. Reduce issues and bugs to zero, make the highest quality product, which is used by almost everyone... and the project will be sufficiently supported, right? Right? After a few months, the reoccurring monthly income **decreased to about \$1700** *(at least that's what I thought)*, \$1000 via Tidelift, \$600 via Open Collective, and \$100 via Patreon. In addition to the reoccurring monthly, one-time donations came periodically (on average it was maybe \$100 per month). Crypto? Adding a crypto wallet for donations was a very popular request. However, for all the time, only 2 transfers for a total amount of about \$200 have been received on crypto wallets, the last one was more than a year ago. GitHub sponsors? It's not available in Russia and never was. PayPal? It's banned for Russians. When it was available, `core-js` received about \$60 in all that time. Grants? I applied for a lot of grants — all applications were ignored. **The main part, \$400 per month, of those donations, `core-js` received from... [Bower](https://bower.io/), another FOSS community. I am also very grateful [to all other sponsors](https://opencollective.com/core-js#section-contributors): because of your donations, I'm still working on this project.** However, in this list there is not a single big corporation or at least a company from the top 1000 website list. Let's be honest, there are mainly individuals, and only a few small companies on the current list of backers and they pay a few dollars a month. If someone says that they don't know that `core-js` requires funding... Come on, I regularly see memes like [this](https://www.reddit.com/r/ProgrammerHumor/comments/fbfb2o/thank_you_for_using_corejs/):

sanders

--- A year ago, Tidelift stopped sending me money. They said that because of the political situation, the Hyperwallet, that they used, is no longer available to Russians (but it was available to me till last month when I tried to update some personal data), and for safety, they will store my money on their side. Over the previous couple of months, I tried to get this money to a bank or a Hyperwallet account, but only received replies that they will try to do something (*sounds great, doesn't it?*). Since the end of the last year, they have just stopped responding to emails. And now, I've got this: ![tidelift](https://user-images.githubusercontent.com/2213682/217650273-548d123d-4ee4-4beb-ad5b-631c55e612a6.png) **In such an amusing way, I found out that I will not receive the money for the previous year, and this year I worked not for \$1800, but for \$800 a month.** There were, of course, no replies to subsequent emails. However, their site indicated that I received and still receive money through them.

tidelift

I wonder how the companies that support their dependencies chain through them will react to such a scam. --- On the same day, on OpenCollective I saw that the reoccurring monthly was reduced from about \$600 to about \$300. Apparently, the financial reserves of `Bower` have come to an end. This means that **for this month I'll get about \$400 total**. In the previous months, I measured how much time it takes to work on `core-js`. It turned out about... **250 hours a month** — significantly more than a full day without any days off, which makes it impossible to have a "real" (as many say) full-time work or work for any significant contracts. \$400 for 250 hours... It will be less than **\$2 per hour of work, for the year before a little more: \$4 per hour**. Yes, in some months, I did spend less time working on the project, but it does not change much. This is the current price for ensuring compatibility for the whole Web. And no insurance or social security. **Awesome earning growth and career, right?** I think you understand well how much senior software engineers in key IT companies get paid. I received a lot of comparable offers, however, they are not compatible with the proper work on `core-js`. --- Among the regular threats, accusations, demands, and insults, I often get something like "Stop begging and go to work, idler. Remove your beggarly messages immediately — I don't wanna see them." The funny thing is that at least some of these people get over $300,000 a year (which I know for sure because I talk to their colleagues), and (because of the nature of their work) `core-js` saves them many hours of work each month. ### Everything changes When I started working on `core-js`, I was alone. Now I have a family. A little over a year ago, I became a father of my son. Now I have to provide him with a decent standard of living. ![son](https://user-images.githubusercontent.com/2213682/208297825-7f98a8e2-088e-47d3-95a6-a853077296b3.png) I have a wife, and sometimes she wants some new shoes or a bag, a new iPhone or an Apple Watch. My parents are already at the age that I need to significantly support them. I think it is obvious that it is impossible to properly support a family with the money that I have or had from `core-js` maintenance. Financial reserves that I used, have finally come to the end. More and more often I hear reproaches like: "Give up your Open-Source, this is pampering. Go back to a normal job. `%USERNAME%` has been working as a programmer for just a year. He understands almost nothing about it, works a couple of hours a day, and already earns many times more than you do." # NO MORE I'm damn tired. I love working on open-source and `core-js`. But who or what am I doing this for? Let's summarize the above. - I have been ensuring zero compatibility issues and providing bleeding edge features of the web platform for most of the Web since 2014; and I've been working on it for most of the time for money, that now will not even be enough for food. - Rather than any gratitude, all I see is the huge hatred from developers whose life I simplify. - Companies that save and earn many millions of dollars on `core-js` usage just ignore `core-js` funding requests. - Even in a critical situation, in response to a request for help, instead of help, most of them preferred to ignore or hate. - Instead of working together with standards' and browsers' developers on a better future for JavaScript, I'm forced to struggle with roadblocks that they make. --- I don't care about the haters. Otherwise, I would have left open-source a long time ago. I can tolerate the lack of normal interaction with the standards developers. First of all, this means future problems for users and, when the Web will be broken, for standards developers themselves. **However, money matters.** I've had enough of sponsoring corporations at the expense of my and my family's well-being. I should be able to ensure a bright future for my family, for my son. The work on `core-js` occupies almost all of my time, more than a full working day. This work ensures the proper functioning of the most of the popular websites and this work should be paid properly. I'm not going to keep working for free or for \$2 per hour. I'm willing to continue working on a project for at least \$80 an hour. This is the rate that have, for example, [`eslint` team members per hour](https://eslint.org/blog/2022/02/paying-contributors-sponsoring-projects/#paying-team-members-per-hour). And, if the work on open-source requires it, I'm ready to pay off my lawsuits and leave Russia — however, it's not cheap. --- Regularly I see comments like this:

core-js approach

Ok guys, if you want it — let's use such an approach. --- ## Depending on your feedback, `core-js` will soon follow one of the following ways: - **Appropriate financial backing** I hope that, at least after reading this post, corporations, small companies, and developers will finally think about the sustainability of their development stack and will properly back `core-js` development. In this case, `core-js` will be appropriately maintained and I'll be able to focus on adding [a new level of functionality](#roadmap). The scale of the necessary work goes through the roof, a single me is no longer enough — I can't work more physically. Some work, for example, improving test coverage or documentation, is simple enough and takes a lot of time, but it's not the kind of work that volunteers want to do — I don't remember any PRs with improvements for test coverage of existent features. So it makes sense to attract at least one or two developers (at least students, better — higher level) on a paid basis. Taking into account the involvement of additional maintainers and other expenses, I think that at this moment about 30 thousand dollars a month could be enough. More money — better product and faster development. A couple times less — it makes sense to resume the work on `core-js` full-time alone — sure, not as productive as it could be with a team. - **I may be hired by a company where I will be able to work on Open-Source and Web standards** and that will give me the resources required for continuation of the work. - **`core-js` will become a commercial project** if it will not receive an appropriate support from users It's problematic to create a commercial infrastructure around the current `core-js` packages, so most likely the new `core-js` major release will change the license. The free version will be significantly limited. All extra functionality will be paid for. `core-js` will continue to evolve appropriately and, in the scope of this project, many new tools will be created to ensure web compatibility. Sure, it will significantly reduce the spread of `core-js` and will cause problems for many developers, however, even some paying customers could be enough and my family will have money to pay the bills. - A **slow death** in case I'll see that `core-js` is not required I have many ideas for commercial projects, I have a lot of good job offers — all this takes time, which now goes into `core-js` maintenance. It does not mean that I'll immediately completely stop maintaining `core-js`, I'll just maintain pro-rata donations. If they are at the current level, it will be only a few hours of maintenance a month instead of hundreds like now. The project will stop the upgrowth — maybe minor bugs will be fixed and compatibility data will be updated — this time is not enough for more. After a while, `core-js` will become just useless and will die. I still hope for the first outcome since `core-js` is one of the key components of the modern digital infrastructure, but, looking at the present and the past, I am mentally getting ready for other options. ## I will answer some angry comments in advance that I see regularly and that will definitely come up after this post: - **"Not a problem, we will just pin the `core-js` dependency."** Unlike most projects, `core-js` should be on the bleeding edge since `core-js` allows you to be on the bleeding edge of JavaScript: use the most recent JavaScript features and don't think about engines compatibility and bugs. However, the library has a good safety margin for the future. Maybe for a year or a couple, you will not have serious problems. After that, they will appear — polyfills will become obsolete, but still will be present in your bundles and will become just a useless ballast. You will not be able to use new features of the language and will face new bugs in JS engines. - **"It's open-source, we will fork it, fuck off."** I see such comments regularly, someone even tries to scare me with a fork. I've said already too many times that **if someone will fork and properly maintain `core-js`, I'd be happy** — it makes no sense just to fork it without maintenance. Now I don't see anyone at all who tries to add something significant to `core-js` or at least contribute regularly. The project ought to follow up on each new JavaScript engine release to update compatibility data, fix or at least take into account each new (no matter how significant) bug from each engine, take a look and implement each new JavaScript feature possible, do it maximally properly, test and take into account the specifics of each version of each modern or legacy engine. It's a hard work, are you ready and have the required knowledge and time for that? For example, when I was in prison, Babel said that they are not:

babel

- **"We don't need `core-js`, many alternative projects are available."** Nobody is holding you. But where are those alternatives in real life? Sure, `core-js` is not the only polyfill of the JavaScript standard library. But all other projects are [tens](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=es6-shim&from=2014-11-18) of [times](https://user-images.githubusercontent.com/2213682/205467964-2dfcce78-5cdf-4f4f-b0d6-e37c02e1bf01.png) less popular than `core-js`, and it's not unreasonable — all of them provide only a small part of `core-js` functionality, they are not proper and complex enough, the number of cases where they can be used is significantly limited, they can't be properly integrated into your project in such a simple way and have other significant problems. In the case if proper alternatives existed, I would have stopped working on `core-js` a long time ago. - **"We can drop IE support, so we no longer need polyfills."** As I wrote a just above, nobody is holding you. In some cases, polyfills are really not required and you can avoid them, but it's only a small part of all cases — almost the same as it was in the IE era. Of course, if you don't need IE support, polyfills will not expand your possibilities as much as it was with adding ES6 support to IE8. But even the most modern engines do not implement the most modern JavaScript features. Even the most modern engines contain bugs. Are you pretty sure that you and your team perfectly know all limitations of all engines that you support and can work around them? Even I sometimes may forget some quirks and missing features. - **"You are an asshole, we will expel you from the FOSS community."** Yes, you're right. I'm such an asshole that gives you a chance to use modern JavaScript features in the real life, have been solving your cross-engine compatibility issues for many years, and had sacrificed for this more than anyone else. I'm such an asshole that just wants his son to be well-fed, wants his family to have enough money to pay the bills, so they don't need anything. Some options above suppose my departure from FOSS in favor of commercial software, so we'll see. --- Now let's move away from the negative to the second half of this post where we will talk about things that would be nice to implement in `core-js` and the problems of polyfilling in general. # Roadmap JavaScript, browsers, and web development are evolving at an amazing speed. The time when almost all of the `core-js` modules were required for all browsers is gone. The latest browsers have good standards support and, in the common use cases, they need only some percentage of the `core-js` modules for the most recent language features and bug fixes. Some companies are already dropping support for IE11 which was recently "buried" once more. However, even without IE, old browsers will always be there, bugs will happen in modern browsers too, and new language features will appear regularly and they will appear in browsers with a delay anyway; so, if we want to use modern JS in development and minimize possible problems, polyfills stay with us for a long time, but they should continue to evolve. Here I will write (almost) nothing about adding new or improving existing specific polyfills (but, sure, it's one of the main parts of `core-js` development), let's talk about some other crucial moments without focusing on minor things. If it is decided to make a commercial project from `core-js`, the roadmap will be adapted to this outcome. I am trying to keep `core-js` as compact as possible, but one of the main conceptions that it should follow is to be maximally useful in the modern web — the client should not load any unnecessary polyfills and polyfills should be maximally compact and optimized. Currently, a maximal `core-js` bundle size with early-stage proposals [is about 220KB minified, 70KB gzipped](https://bundlephobia.com/package/core-js) — it's not a tiny package, it's big enough — it's like jQuery, LoDash, and Axios together — the reason is that the package covers almost the entire standard library of the language. The individual weight of each component is several times less than the weight of quite correct alternatives. It's possible to load only the `core-js` features that you use and in minimal cases, the bundle size can be reduced to some kilobytes. When `core-js` is used correctly, this is usually a couple of tens of kilobytes — however, there is something to strive for. [Most pages contain pictures larger](https://almanac.httparchive.org/en/2022/media#bytesizes) than the entire `core-js` bundle, most users have Internet speed in dozens of Mbps, so why is this concept so significant? I don't want to repeat old posts about [the cost of JavaScript](https://medium.com/dev-channel/the-cost-of-javascript-84009f51e99e) in detail where you can read why adding JS increases the time when the user can start interacting with the page much more than adding a similar size picture — it's not only downloading, it's also parsing, compiling, evaluating the script, it blocks the page rendering. In too many places the mobile Internet is not perfect and is still 3G or even 2G. In the case of 3G, the download of one full copy of `core-js` can take a couple of seconds. However, pages contain more than one copy of `core-js` and many other duplicated polyfills too often. Some (mainly mobile) Internet providers have very limited "unlimited" data plans and after a few gigabytes reduce the speed to a few Kbps. The connection speed is often limited for many other reasons too. The speed of the page load equals revenue.

conversion

> Illustration is from a [random post](https://medium.com/@vikigreen/impact-of-slow-page-load-time-on-website-performance-40d5c9ce568a) by googling The size of `core-js` is constantly growing because of the addition of new or improvements to the existing polyfills. This issue also is a blocker for some big polyfills — the addition of `Intl`, `Temporal`, and some other features to `core-js` could increase the maximal bundle size by a dozen times up to a few megabytes. One of the main `core-js` killer features is that it can be optimized with the usage of Babel, SWC, or manually, however, current approaches solve only a part of the problem. To properly solve them, the modern web requires a new generation of the toolkit that could be simply integrated into the current development stack. And in some cases, as you will see below, this toolkit could help to make the size of your web pages even less than just without `core-js`. I already wrote about some of this in [**`core-js@3`, Babel and a look into the future** post](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#look-into-the-future), but those were just raw ideas. Now they're in the stage of experimentation or even implementation. Since the future of the project is uncertain, it makes no sense to write any specific dates here, I do not promise that all of this will be done shortly, but this is what should be strived for. --- ### New major version `core-js@3` was released about 4 years ago — it's been a long time. It's not a big problem for me to add some breaking changes (rather ensuring backward compatibility is often a challenge) and to mark a new version as a major release — it's a big problem for the users. At this moment, about 25% of `core-js` downloads are critically obsolete `core-js@2`. Many users wanna update it to `core-js@3`, but because their dependencies use `core-js@2` they still use the obsolete version to avoid multiple copies (I saw such issues on GitHub in too many projects). Too frequent major updates would worsen such cases even more. However, it's better not to get too obsessed with compatibility with older versions. The library contains too much that's not removed only for compatibility reasons. The absence of some long-needed breaking changes for someone will negatively affect the future. Judging by how the standards, the ecosystem, and the Web change, and how legacy accumulates, it's better to release a new major version each 2-3 years. The addition of all the new things that we would like to see in the new major version would take many years, which is unacceptable. However, `core-js` follows [SemVer](https://semver.org/) and it makes sense to release a new major release at first with breaking changes (some of them below), most of the new features can be added in minor releases. In this case, such a release can take just about 2-3 months of full-time work and it can be the first `core-js` version that reduced the size compared to the previous -) ### `core-js` package directly ### Drop critically obsolete engines support IE is dead. However, not for all — for many different reasons, someone is still forced to make or maintain websites that should work in IE. `core-js` is one of the main tools that makes life easier for them. At this moment, `core-js` tries to support all possible engines and platforms, even ES3 — IE8-. But only a small part of developers using `core-js` needs support of ES3 engines — at this moment, the IE8- segment of browsers is about 0.1%. For many other users, it causes problems — bigger bundle size and slower runtime execution. The main problem comes from supporting ES3 engines: most modern ES features are based on ES5 features, which aren't available in those old engines. Some features (like getters / setters) can't be polyfilled, so some polyfills (like typed arrays) can't work in IE8- at all. Some others require heavy workarounds. In cases where you need to polyfill only some simple features, the main part of the `core-js` size in the bundle is the implementation of ES5 methods (in the case of polyfilling a lot of features, it's only some percent, so this problem is related mainly to minimalistic bundles). Even the simple replacement of internal fallbacks of ES5 features to implementations to direct usage of those native features reduces minimalistic `core-js` bundle size by 2+ times. After reworking the architecture, it will be reduced even more. The IE9-10 segment of browsers already is also small — at this moment, the same 0.1%. But it makes no sense to consider dropping their support without dropping support of some other obsolete engines with similar or even greater restrictions, for example, Android 4.4.4 — in total, it's about 1%. Raising the lower bar higher than ES5 is a more difficult decision at least because of some non-browser engines. However, even dropping IE11 support in the future will not give as many benefits as dropping IE8- support would now. ### ECMAScript modules and modern syntax At this moment, `core-js` uses CommonJS modules. For a long time, it was the most popular JavaScript modules format, but now ECMAScript provides its own modules format and it's already very popular and supported *almost* everywhere. For example, Deno, like browsers, doesn't support CommonJS, but supports ES modules. `core-js` should get an ECMAScript modules version in the near future. But, for example, on NodeJS, ECMAScript modules are supported only in the modern versions — but on NodeJS `core-js` should work without transpiling / bundling even in ancient versions, [Electron still does not support it](https://github.com/electron/electron/issues/21457), etc., so it's problematic to get rid of the CommonJS version immediately. The situation with the rest of modern syntax is not so obvious. At this moment, `core-js` uses ES3 syntax. Initially, it was for maximal optimization since it should be pre-transpiled to old syntax anyway. But it was true only initially. Now, `core-js` just can't be properly transpiled in userland and should be ignored in transpiler configs. Why? Let's take a look, for example, at Babel transforms: - A big part of transforms rely on modern built-ins, for example, transforms which use `@@iterator` protocol — yet `Symbol.iterator`, iterators, and all other related built-ins are implemented in `core-js` and absent before `core-js` loading. - Another problem is transpiling `core-js` with transforms that inject `core-js` polyfills. Obviously, we can't inject polyfills into the place where they are implemented since it is circular dependencies. - Some other transforms applied on `core-js` just break its internals — for example, [the `typeof` transform](https://babeljs.io/docs/en/babel-plugin-transform-typeof-symbol) (that should help with support of polyfilled symbols) breaks the `Symbol` polyfill. However, the usage of modern syntax in polyfills code could significantly improve the readability of the source code, reduce the size and in some cases improve performance if polyfill is bundled for a modern engine, so it's time to think about rewriting `core-js` to modern syntax, making it transpilable by getting around those problems and publishing versions with different syntax for different use cases. ### Web standards polyfills I've been thinking about adding the most possible web standards (not only ECMAScript and closely related features) support to `core-js` for a long time. First of all, about the remaining features from the [Minimum Common Web Platform API](https://common-min-api.proposal.wintercg.org/#index) ([what is it?](https://blog.cloudflare.com/introducing-the-wintercg/)), but not only about them. It could be good to have one bulletproof polyfills project for all possible web development cases, not only for ECMAScript. At the moment, the situation with the support of web standards in browsers is much worse than with the support of modern ECMAScript features. One of the barriers preventing the addition of web standards polyfills to `core-js` was a significant increase of bundles' size, but I think that with current techniques of loading only the required polyfills and techniques which you can see below, we could add polyfills of web standards to `core-js`. But the main problem is that it should not be naive polyfills. As I wrote above, today the correctness of ECMAScript features is not in a very bad shape almost universally, but we can't say this about web platform features. For example, [a `structuredClone` polyfill](https://github.com/zloirock/core-js#structuredclone) was relatively recently added. When working on it, taking into account the dependencies, I faced **hundreds** of different JavaScript engines bugs — I don't remember when I saw something like that when I added new ECMAScript features — for this reason, the work on this simple method, that naively could be implemented within a couple hours, including resolving all issues and adding required features, lasted for several months. In the case of polyfills, better to do nothing than to do bad. The proper testing, polyfilling, and ensuring cross-platform compatibility web platform features require even more significant resources than what I spend on ECMAScript polyfills. So adding the maximum possible web standards support to `core-js` will be started only in case if I have such resources. --- ### New approaches to tooling are more interesting Someone will ask why it's here. What do tools, like transpilers, have to do with the `core-js` project? `core-js` is just a polyfill, and those tools are written and maintained by other people. Once I also thought that it is enough to write a great project with a good API, explain its possibilities, and when it becomes popular, it will acquire an ecosystem with proper third-party tools. However, over the years, I realized that this will not happen if you do not do, or at least not control, it yourself. For example, for many years, instance methods were not able to be polyfilled through Babel `runtime`, but I explained how to do it too many times. Polyfilling via `preset-env` could not be used in real-life projects because of incomplete detection of required polyfills and a bad source of compatibility data, which I explained from the beginning. Because of such problems, I was forced [to almost completely rewrite those tools in 2018-2019, for the `core-js@3` release](https://github.com/babel/babel/pull/7646), after that we got the current state of statically analysis-based tools for polyfills injecting. I am sure that if the approaches below are not implemented in the scope of `core-js`, they will not be properly implemented at all. --- To avoid some questions related to the following text: `core-js` tools will be moved to scoped packages — tools like `core-js-builder` and `core-js-compat` will become `@core-js/builder` and `@core-js/compat` respectively. ### Not only Babel: plugins for transpilers and module bundlers At this moment, some users are forced to use Babel only due to the need to automatically inject / optimize required polyfills. At this moment, Babel's [`preset-env`](https://babeljs.io/docs/en/babel-preset-env#usebuiltins) and [`runtime`](https://babeljs.io/docs/en/babel-plugin-transform-runtime#core-js-aliasing) are the only good enough and well-known ways to optimize usage of `core-js` with statical analysis. Historically, it happened because I helped Babel with polyfills. It does not mean that it's the only or the best place where it could be done. Babel is only one of many transpilers. TypeScript is another popular option. Other transpilers are gaining popularity now, for example, [SWC](https://swc.rs/) (that already contains [a tool for automatic polyfilling / `core-js` optimization](https://swc.rs/docs/configuration/supported-browsers), but it's still not perfect). However, why do we talk about the transpilers layer? The bundlers layer and tools like `webpack` or [`esbuild`](https://esbuild.github.io/) (that also contains an integrated transpiler) are more interesting for the optimization of polyfills. [Rome](https://rome.tools/) has been in development for several years and still is not ready, but its concept looks very promising. One of the main problems with statical analysis-based automatic polyfilling on the transpiler layer is that usually not all files from the bundle are transpiled — for example, dependencies. If some of your dependencies need a polyfill of a modern built-in feature, but you don't use this built-in in your userland code, this polyfill will not be added to the bundle. Unnecessary polyfills import also will not be removed from your dependencies (see below). Moving automatic polyfilling to the bundlers layer fixes this problem. Sure, writing or using such plugins in many places is difficult compared to Babel. For example, [now without some extra tools you can't use plugins for custom transforms in TypeScript](https://github.com/microsoft/TypeScript/issues/14419). However, where there's a will there's a way. Automatic polyfilling / optimization of `core-js` should be available not only in Babel. It's almost impossible to write and maintain plugins for all transpilers and bundlers in the scope of the `core-js` project, but it's possible to do those things: - Improve data provided by `core-js` (`@core-js/compat`) and tools for integration with third-party projects, they should be comprehensive. For example, "built-in definitions" are still on Babel's side that causing problems with their reuse in other projects. - Since some tools already provide `core-js` integration, it makes sense to help them too, not just Babel. - It makes sense to write and maintain plugins for some significant tools in the scope of the `core-js` project. Which? We will see. ### Polyfills collector One of the problems of the statical analysis-based automatic polyfilling on the files layer (`usage` polyfilling mode of Babel `preset-env`) was explained above, but it's not the only problem. Let's talk about some others. Your dependencies could have their own `core-js` dependencies and they can be incompatible with the `core-js` version that you use at the root of your project, so injecting `core-js` imports to your dependencies directly could cause breakage. Projects often contain multiple entry points, multiple bundles, and, in some cases, the proper moving of all `core-js` modules to one chunk can be problematic and it could cause duplication of `core-js` in each bundle. I already posted [the `core-js` usage statistics](https://gist.github.com/zloirock/7331cec2a1ba74feae09e64584ec5d0e) above. In many cases, you could see the duplication of `core-js` — and it's only on the first loaded page of the application. Sometimes it's even like what we see on the Bloomberg website:

bloomberg

[Some time ago this number was even higher.](https://user-images.githubusercontent.com/2213682/115339234-87e1f700-a1ce-11eb-853c-8b93b7fc5657.png) Of course, such a number of copies and various versions of `core-js` is not something typical, but a situation with several copies of `core-js` is too common as you saw above, affecting about half the websites with `core-js`. To prevent this **a new solution is required to collect all polyfills from all entry points, bundles and dependencies of the project in one place.** Let's call a tool for this `@core-js/collector`. This tool should take an entry point or a list of entry points and should use the same statical analysis that's used in `preset-env`, however, this tool should not transform code or inject anything, should check full dependencies trees and should return a full list of required `core-js` modules. As a requirement, it should be simple to integrate into the current development stack. One possible way can be a new polyfilling mode in plugins, let's call it `collected` — that will allow loading all collected polyfills of the application in one place and remove the unnecessary (see below). ### Removing unnecessary third-party polyfills Now it's typical to see, for example, a dozen copies of `Promise` polyfills with the same functionality on a website — you load only one `Promise` polyfill from `core-js`, but some of your dependencies load `Promise` polyfills by themself — `Promise` polyfill from one more `core-js` copy, `es6-promise`, `promise-polyfill`, `es6-promise-polyfill`, `native-promise-only`, etc. But it's just ES6 `Promise` which is already completely covered by `core-js` — and available in most browsers without polyfills. Sometimes, due to this, the size of all polyfills in the bundle swells to several megabytes. It's not an ideal illustration for this issue, many other examples would have been better, but since above we started to talk about the Bloomberg website, let's take a look at this site one more time. We have no access to the source code, however, we have, for example, such an awesome tool as [`bundlescanner.com`](https://bundlescanner.com/website/bloomberg.com%2Feurope/all) (I hope that the Bloomberg team will fix it ASAP, so the result could be outdated).

bundlescanner

As shown in the practice, since such analysis it's not a simple work, this tool detects only about half of libraries' code. However, in addition to 450 kilobytes of `core-js`, we see hundreds of kilobytes of other polyfills — many copies of `es6-promise`, `promise-polyfill`, `whatwg-fetch` ([for the above reason](#web-standards-polyfills), `core-js` *still* does not polyfill it), `string.prototype.codepointat`, `object-assign` (it's a *ponyfill* and the next section is about them), `array-find-index`, etc. But how many polyfills were not detected? What's the size of all polyfills that this website loads? It seems a couple of megabytes. However, even for *very* old browsers, at most a hundred kilobytes are more than be enough... And this situation is not something unique — it's a too common problem. Since many of those polyfills contain just a subset of `core-js` functionality, in the scope of `@core-js/compat`, we could collect data that will show if a module is an unnecessary third-party polyfill or not and, if this functionality is contained in `core-js`, a transpiler or bundler plugin will remove the import of this module or will replace it to the import of suitable `core-js` modules. The same approach could be applied to get rid of dependencies from old `core-js` versions. ### Globalization of pure version polyfills / ponyfills One more popular and similar issue is a duplication of polyfills from global and pure `core-js` versions. The pure version of `core-js` / `babel-runtime` is intended for usage in libraries' code, so it's a normal situation if you use a global version of `core-js` and your dependencies also load some copies of `core-js` without global namespace pollution. They use different internals and it's problematic to share similar code between them. I'm thinking about resolving this issue on the transpiler or bundler plugins side similarly to the previous one (but, sure, a little more complex) — we could replace imports from the pure version with imports from the global version and remove polyfills unnecessary for the target engines. That also could be applied to third-party ponyfills or obsolete libraries that implement something already available in the JS standard library. For example, the usage of `has` package can be replaced by `Object.hasOwn`, `left-pad` by `String.prototype.padStart`, some `lodash` methods by related modern built-in JS methods, etc. ### Service Loading the same polyfills, for example, in IE11, iOS Safari 14.8, and the latest Firefox is wrong — too much dead code will be loaded in modern browsers. At this moment, a popular pattern is the use of 2 bundles — for "modern" browsers that will be loaded if native modules are supported, ` core-js-3.33.2/docs/compat/tests.js000066400000000000000000001722631451776221300171020ustar00rootroot00000000000000'use strict'; /* eslint-disable prefer-regex-literals, radix -- required for testing */ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-lazy-ends, regexp/no-useless-quantifier -- required for testing */ var GLOBAL = typeof global != 'undefined' ? global : Function('return this')(); var WHITESPACES = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; var NOT_WHITESPACES = '\u200B\u0085\u180E'; var USERAGENT = GLOBAL.navigator && GLOBAL.navigator.userAgent || ''; var process = GLOBAL.process; var Bun = GLOBAL.Bun; var Deno = GLOBAL.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, V8_VERSION; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us V8_VERSION = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!V8_VERSION && USERAGENT) { match = USERAGENT.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = USERAGENT.match(/Chrome\/(\d+)/); if (match) V8_VERSION = +match[1]; } } var IS_BROWSER = typeof window == 'object' && typeof Deno != 'object'; var IS_BUN = typeof Bun == 'function' && Bun && typeof Bun.version == 'string'; var IS_DENO = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; // var IS_NODE = Object.prototype.toString.call(process) == '[object process]'; var WEBKIT_STRING_PAD_BUG = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(USERAGENT); var DESCRIPTORS_SUPPORT = function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a === 7; }; var V8_PROTOTYPE_DEFINE_BUG = function () { return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype === 42; }; var PROMISES_SUPPORT = function () { var promise = new Promise(function (resolve) { resolve(1); }); var empty = function () { /* empty */ }; var FakePromise = (promise.constructor = {})[Symbol.species] = function (exec) { exec(empty, empty); }; return promise.then(empty) instanceof FakePromise && V8_VERSION !== 66 && (!(IS_BROWSER || IS_DENO) || typeof PromiseRejectionEvent == 'function'); }; var PROMISE_STATICS_ITERATION = function () { var ITERATION_SUPPORT = false; try { var object = {}; object[Symbol.iterator] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; Promise.all(object).then(undefined, function () { /* empty */ }); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; var SYMBOLS_SUPPORT = function () { return Object.getOwnPropertySymbols && String(Symbol('symbol detection')) && !(V8_VERSION && V8_VERSION < 41); }; var SYMBOL_REGISTRY = [SYMBOLS_SUPPORT, function () { return Symbol['for'] && Symbol.keyFor; }]; var URL_AND_URL_SEARCH_PARAMS_SUPPORT = function () { // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return searchParams.sort && url.href === 'http://a/c%20d?a=1&c=3' && searchParams.get('c') === '3' && String(new URLSearchParams('?a=1')) === 'a=1' && searchParams[Symbol.iterator] && new URL('https://a@b').username === 'a' && new URLSearchParams(new URLSearchParams('a=b')).get('a') === 'b' && new URL('http://тест').host === 'xn--e1aybc' && new URL('http://a#б').hash === '#%D0%B1' && result === 'a1c3' && new URL('http://x', undefined).host === 'x'; }; var OBJECT_PROTOTYPE_ACCESSORS_SUPPORT = function () { try { Object.prototype.__defineSetter__.call(null, Math.random(), function () { /* empty */ }); } catch (error) { return Object.prototype.__defineSetter__; } }; var SAFE_ITERATION_CLOSING_SUPPORT = function () { var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[Symbol.iterator] = function () { return this; }; Array.from(iteratorWithReturn, function () { throw new Error('close'); }); } catch (error) { return SAFE_CLOSING; } }; var ARRAY_BUFFER_SUPPORT = function () { return ArrayBuffer && DataView; }; var TYPED_ARRAY_CONSTRUCTORS_LIST = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var ARRAY_BUFFER_VIEWS_SUPPORT = function () { for (var constructor in TYPED_ARRAY_CONSTRUCTORS_LIST) if (!GLOBAL[constructor]) return false; return ARRAY_BUFFER_SUPPORT(); }; var TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS = function () { try { return !Int8Array(1); } catch (error) { /* empty */ } try { return !new Int8Array(-1); } catch (error) { /* empty */ } new Int8Array(); new Int8Array(null); new Int8Array(1.5); var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; return new Int8Array(iterable)[0] === 1 && new Int8Array(new ArrayBuffer(2), 1, undefined).length === 1; }; function NCG_SUPPORT() { var re = RegExp('(?b)'); return re.exec('b').groups.a === 'b' && 'b'.replace(re, '$c') === 'bc'; } function createIsRegExpLogicTest(name) { return function () { var regexp = /./; try { '/./'[name](regexp); } catch (error1) { try { regexp[Symbol.match] = false; return '/./'[name](regexp); } catch (error2) { /* empty */ } } return false; }; } function createStringHTMLMethodTest(METHOD_NAME) { return function () { var test = ''[METHOD_NAME]('"'); return test === test.toLowerCase() && test.split('"').length <= 3; }; } function createStringTrimMethodTest(METHOD_NAME) { return function () { return !WHITESPACES[METHOD_NAME]() && NOT_WHITESPACES[METHOD_NAME]() === NOT_WHITESPACES && WHITESPACES[METHOD_NAME].name === METHOD_NAME; }; } function createSetLike(size) { return { size: size, has: function () { return false; }, keys: function () { return { next: function () { return { done: true }; } }; } }; } function createSetMethodTest(METHOD_NAME) { return function () { try { new Set()[METHOD_NAME](createSetLike(0)); try { // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it // https://github.com/tc39/proposal-set-methods/pull/88 new Set()[METHOD_NAME](createSetLike(-1)); return false; } catch (error2) { return true; } } catch (error) { return false; } }; } function NATIVE_RAW_JSON() { var unsafeInt = '9007199254740993'; var raw = JSON.rawJSON(unsafeInt); return JSON.isRawJSON(raw) && JSON.stringify(raw) === unsafeInt; } function IMMEDIATE() { return setImmediate && clearImmediate && !(IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })()); } function TIMERS() { return !(/MSIE .\./.test(USERAGENT) || IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })()); } GLOBAL.tests = { // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.symbol': [SYMBOLS_SUPPORT, function () { var symbol = Symbol('stringify detection'); return Object.getOwnPropertySymbols('qwe') && Symbol['for'] && Symbol.keyFor && JSON.stringify([symbol]) === '[null]' && JSON.stringify({ a: symbol }) === '{}' && JSON.stringify(Object(symbol)) === '{}' && Symbol.prototype[Symbol.toPrimitive] && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.constructor': SYMBOLS_SUPPORT, 'es.symbol.description': function () { // eslint-disable-next-line symbol-description -- required for testing return Symbol('description detection').description === 'description detection' && Symbol().description === undefined; }, 'es.symbol.async-iterator': function () { return Symbol.asyncIterator; }, 'es.symbol.for': SYMBOL_REGISTRY, 'es.symbol.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance; }], 'es.symbol.is-concat-spreadable': [SYMBOLS_SUPPORT, function () { return Symbol.isConcatSpreadable; }], 'es.symbol.iterator': [SYMBOLS_SUPPORT, function () { return Symbol.iterator; }], 'es.symbol.key-for': SYMBOL_REGISTRY, 'es.symbol.match': [SYMBOLS_SUPPORT, function () { return Symbol.match; }], 'es.symbol.match-all': [SYMBOLS_SUPPORT, function () { return Symbol.matchAll; }], 'es.symbol.replace': [SYMBOLS_SUPPORT, function () { return Symbol.replace; }], 'es.symbol.search': [SYMBOLS_SUPPORT, function () { return Symbol.search; }], 'es.symbol.species': [SYMBOLS_SUPPORT, function () { return Symbol.species; }], 'es.symbol.split': [SYMBOLS_SUPPORT, function () { return Symbol.split; }], 'es.symbol.to-primitive': [SYMBOLS_SUPPORT, function () { return Symbol.toPrimitive && Symbol.prototype[Symbol.toPrimitive]; }], 'es.symbol.to-string-tag': [SYMBOLS_SUPPORT, function () { return Symbol.toStringTag && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.unscopables': [SYMBOLS_SUPPORT, function () { return Symbol.unscopables; }], 'es.error.cause': function () { return Error('e', { cause: 7 }).cause === 7 && !('cause' in Error.prototype); }, 'es.error.to-string': function () { if (DESCRIPTORS_SUPPORT) { // Chrome 32- incorrectly call accessor var object = Object.create(Object.defineProperty({}, 'name', { get: function () { return this === object; } })); if (Error.prototype.toString.call(object) !== 'true') return false; } // FF10- does not properly handle non-strings return Error.prototype.toString.call({ message: 1, name: 2 }) === '2: 1' // IE8 does not properly handle defaults && Error.prototype.toString.call({}) === 'Error'; }, 'es.aggregate-error.constructor': function () { return typeof AggregateError == 'function'; }, 'es.aggregate-error.cause': function () { return AggregateError([1], 'e', { cause: 7 }).cause === 7 && !('cause' in AggregateError.prototype); }, 'es.array.at': function () { return [].at; }, 'es.array.concat': function () { var array1 = []; array1[Symbol.isConcatSpreadable] = false; var array2 = []; var constructor = array2.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array1.concat()[0] === array1 && array2.concat().foo === 1; }, 'es.array.copy-within': function () { return Array.prototype.copyWithin && Array.prototype[Symbol.unscopables].copyWithin; }, 'es.array.every': function () { try { Array.prototype.every.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.every; }, 'es.array.fill': function () { return Array.prototype.fill && Array.prototype[Symbol.unscopables].fill; }, 'es.array.filter': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.filter(Boolean).foo === 1; }, 'es.array.find': function () { var SKIPS_HOLES = true; Array(1).find(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].find; }, 'es.array.find-index': function () { var SKIPS_HOLES = true; Array(1).findIndex(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].findIndex; }, 'es.array.find-last': function () { return [].findLast; }, 'es.array.find-last-index': function () { return [].findLastIndex; }, 'es.array.flat': function () { return Array.prototype.flat; }, 'es.array.flat-map': function () { return Array.prototype.flatMap; }, 'es.array.for-each': function () { try { Array.prototype.forEach.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.forEach; }, 'es.array.from': SAFE_ITERATION_CLOSING_SUPPORT, 'es.array.includes': function () { return Array(1).includes() && Array.prototype[Symbol.unscopables].includes; }, 'es.array.index-of': function () { try { [].indexOf.call(null); } catch (error) { return 1 / [1].indexOf(1, -0) > 0; } }, 'es.array.is-array': function () { return Array.isArray; }, 'es.array.iterator': [SYMBOLS_SUPPORT, function () { return [][Symbol.iterator] === [].values && [][Symbol.iterator].name === 'values' && [].entries()[Symbol.toStringTag] === 'Array Iterator' && [].keys().next() && [][Symbol.unscopables].keys && [][Symbol.unscopables].values && [][Symbol.unscopables].entries; }], 'es.array.join': function () { try { if (!Object.prototype.propertyIsEnumerable.call(Object('z'), 0)) return false; } catch (error) { return false; } try { Array.prototype.join.call(null, ''); return false; } catch (error) { /* empty */ } return true; }, 'es.array.last-index-of': function () { try { [].lastIndexOf.call(null); } catch (error) { return 1 / [1].lastIndexOf(1, -0) > 0; } }, 'es.array.map': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.map(function () { return true; }).foo === 1; }, 'es.array.of': function () { function F() { /* empty */ } return Array.of.call(F) instanceof F; }, 'es.array.push': function () { if ([].push.call({ length: 0x100000000 }, 1) !== 4294967297) return false; try { Object.defineProperty([], 'length', { writable: false }).push(); } catch (error) { return error instanceof TypeError; } }, 'es.array.reduce': function () { try { Array.prototype.reduce.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduce; } }, 'es.array.reduce-right': function () { try { Array.prototype.reduceRight.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduceRight; } }, 'es.array.reverse': function () { var test = [1, 2]; return String(test) !== String(test.reverse()); }, 'es.array.slice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.slice().foo === 1; }, 'es.array.some': function () { try { Array.prototype.some.call(null, function () { /* empty */ }); } catch (error) { return Array.prototype.some; } }, 'es.array.sort': function () { try { Array.prototype.sort.call(null); } catch (error1) { try { [1, 2, 3].sort(null); } catch (error2) { [1, 2, 3].sort(undefined); // stable sort var array = []; var result = ''; var code, chr, value, index; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } array.sort(function (a, b) { return b.v - a.v; }); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result === 'DGBEFHACIJK'; } } }, 'es.array.species': [SYMBOLS_SUPPORT, function () { return Array[Symbol.species]; }], 'es.array.splice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.splice().foo === 1; }, 'es.array.to-reversed': function () { return [].toReversed; }, 'es.array.to-sorted': function () { return [].toSorted; }, 'es.array.to-spliced': function () { return [].toSpliced; }, 'es.array.unscopables.flat': function () { return Array.prototype[Symbol.unscopables].flat; }, 'es.array.unscopables.flat-map': function () { return Array.prototype[Symbol.unscopables].flatMap; }, 'es.array.unshift': function () { if ([].unshift(0) !== 1) return false; try { Object.defineProperty([], 'length', { writable: false }).unshift(); } catch (error) { return error instanceof TypeError; } }, 'es.array.with': function () { return []['with']; }, 'es.array-buffer.constructor': [ARRAY_BUFFER_SUPPORT, function () { try { return !ArrayBuffer(1); } catch (error) { /* empty */ } try { return !new ArrayBuffer(-1); } catch (error) { /* empty */ } new ArrayBuffer(); new ArrayBuffer(1.5); new ArrayBuffer(NaN); return ArrayBuffer.length === 1 && ArrayBuffer.name === 'ArrayBuffer'; }], 'es.array-buffer.is-view': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return ArrayBuffer.isView; }], 'es.array-buffer.slice': [ARRAY_BUFFER_SUPPORT, function () { return new ArrayBuffer(2).slice(1, undefined).byteLength; }], 'es.data-view.constructor': ARRAY_BUFFER_SUPPORT, 'es.date.get-year': function () { return new Date(16e11).getYear() === 120; }, // TODO: Remove from `core-js@4` 'es.date.now': function () { return Date.now; }, 'es.date.set-year': function () { return Date.prototype.setYear; }, 'es.date.to-gmt-string': function () { return Date.prototype.toGMTString; }, 'es.date.to-iso-string': function () { try { new Date(NaN).toISOString(); } catch (error) { return new Date(-5e13 - 1).toISOString() === '0385-07-25T07:06:39.999Z'; } }, 'es.date.to-json': function () { return new Date(NaN).toJSON() === null && Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) === 1; }, 'es.date.to-primitive': [SYMBOLS_SUPPORT, function () { return Date.prototype[Symbol.toPrimitive]; }], // TODO: Remove from `core-js@4` 'es.date.to-string': function () { return new Date(NaN).toString() === 'Invalid Date'; }, 'es.escape': function () { return escape; }, 'es.function.bind': function () { var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test == 'function' && !test.hasOwnProperty('prototype'); }, 'es.function.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance in Function.prototype; }], 'es.function.name': function () { return 'name' in Function.prototype; }, 'es.global-this': function () { return globalThis; }, 'es.json.stringify': [SYMBOLS_SUPPORT, function () { var symbol = Symbol('stringify detection'); return JSON.stringify([symbol]) === '[null]' && JSON.stringify({ a: symbol }) === '{}' && JSON.stringify(Object(symbol)) === '{}' && JSON.stringify('\uDF06\uD834') === '"\\udf06\\ud834"' && JSON.stringify('\uDEAD') === '"\\udead"'; }], 'es.json.to-string-tag': [SYMBOLS_SUPPORT, function () { return JSON[Symbol.toStringTag]; }], 'es.map.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: [1, 2] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new Map(iterable); return map.forEach && map[Symbol.iterator]().next() && map.get(1) === 2 && map.set(-0, 3) === map && map.has(0) && map[Symbol.toStringTag]; }], 'es.math.acosh': function () { // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 return Math.floor(Math.acosh(Number.MAX_VALUE)) === 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && Math.acosh(Infinity) === Infinity; }, 'es.math.asinh': function () { return 1 / Math.asinh(0) > 0; }, 'es.math.atanh': function () { return 1 / Math.atanh(-0) < 0; }, 'es.math.cbrt': function () { return Math.cbrt; }, 'es.math.clz32': function () { return Math.clz32; }, 'es.math.cosh': function () { return Math.cosh(710) !== Infinity; }, 'es.math.expm1': function () { // Old FF bug // eslint-disable-next-line no-loss-of-precision -- required for old engines return Math.expm1(10) <= 22025.465794806719 && Math.expm1(10) >= 22025.4657948067165168 // Tor Browser bug && Math.expm1(-2e-17) === -2e-17; }, 'es.math.fround': function () { return Math.fround; }, 'es.math.hypot': function () { return Math.hypot && Math.hypot(Infinity, NaN) === Infinity; }, 'es.math.imul': function () { return Math.imul(0xFFFFFFFF, 5) === -5 && Math.imul.length === 2; }, 'es.math.log10': function () { return Math.log10; }, 'es.math.log1p': function () { return Math.log1p; }, 'es.math.log2': function () { return Math.log2; }, 'es.math.sign': function () { return Math.sign; }, 'es.math.sinh': function () { return Math.sinh(-2e-17) === -2e-17; }, 'es.math.tanh': function () { return Math.tanh; }, 'es.math.to-string-tag': function () { return Math[Symbol.toStringTag]; }, 'es.math.trunc': function () { return Math.trunc; }, 'es.number.constructor': function () { return Number(' 0o1') && Number('0b1') && !Number('+0x1'); }, 'es.number.epsilon': function () { return Number.EPSILON; }, 'es.number.is-finite': function () { return Number.isFinite; }, 'es.number.is-integer': function () { return Number.isInteger; }, 'es.number.is-nan': function () { return Number.isNaN; }, 'es.number.is-safe-integer': function () { return Number.isSafeInteger; }, 'es.number.max-safe-integer': function () { return Number.MAX_SAFE_INTEGER; }, 'es.number.min-safe-integer': function () { return Number.MIN_SAFE_INTEGER; }, 'es.number.parse-float': function () { try { parseFloat(Object(Symbol.iterator)); } catch (error) { return Number.parseFloat === parseFloat && 1 / parseFloat(WHITESPACES + '-0') === -Infinity; } }, 'es.number.parse-int': function () { try { parseInt(Object(Symbol.iterator)); } catch (error) { return Number.parseInt === parseInt && parseInt(WHITESPACES + '08') === 8 && parseInt(WHITESPACES + '0x16') === 22; } }, 'es.number.to-exponential': function () { try { 1.0.toExponential(Infinity); } catch (error) { try { 1.0.toExponential(-Infinity); } catch (error2) { Infinity.toExponential(Infinity); NaN.toExponential(Infinity); return (-6.9e-11).toExponential(4) === '-6.9000e-11' && 1.255.toExponential(2) === '1.25e+0'; // && 25.0.toExponential(0) === '3e+1'; } } }, 'es.number.to-fixed': function () { try { Number.prototype.toFixed.call({}); } catch (error) { return 0.00008.toFixed(3) === '0.000' && 0.9.toFixed(0) === '1' && 1.255.toFixed(2) === '1.25' && 1000000000000000128.0.toFixed(0) === '1000000000000000128'; } }, 'es.number.to-precision': function () { try { Number.prototype.toPrecision.call({}); } catch (error) { return 1.0.toPrecision(undefined) === '1'; } }, 'es.object.assign': function () { if (DESCRIPTORS_SUPPORT && Object.assign({ b: 1 }, Object.assign(Object.defineProperty({}, 'a', { enumerable: true, get: function () { Object.defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return false; var A = {}; var B = {}; var symbol = Symbol('assign detection'); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return Object.assign({}, A)[symbol] === 7 && Object.keys(Object.assign({}, B)).join('') === alphabet; }, // TODO: Remove from `core-js@4` 'es.object.create': function () { return Object.create; }, 'es.object.define-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.define-properties': [DESCRIPTORS_SUPPORT, V8_PROTOTYPE_DEFINE_BUG, function () { return Object.defineProperties; }], 'es.object.define-property': [DESCRIPTORS_SUPPORT, V8_PROTOTYPE_DEFINE_BUG], 'es.object.define-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.entries': function () { return Object.entries; }, 'es.object.freeze': function () { return Object.freeze(true); }, 'es.object.from-entries': function () { return Object.fromEntries; }, 'es.object.get-own-property-descriptor': [DESCRIPTORS_SUPPORT, function () { return Object.getOwnPropertyDescriptor('qwe', '0'); }], 'es.object.get-own-property-descriptors': function () { return Object.getOwnPropertyDescriptors; }, 'es.object.get-own-property-names': function () { return Object.getOwnPropertyNames('qwe'); }, 'es.object.get-own-property-symbols': [SYMBOLS_SUPPORT, function () { return Object.getOwnPropertySymbols('qwe'); }], 'es.object.get-prototype-of': function () { return Object.getPrototypeOf('qwe'); }, 'es.object.has-own': function () { return Object.hasOwn; }, 'es.object.is': function () { return Object.is; }, 'es.object.is-extensible': function () { return !Object.isExtensible('qwe'); }, 'es.object.is-frozen': function () { return Object.isFrozen('qwe'); }, 'es.object.is-sealed': function () { return Object.isSealed('qwe'); }, 'es.object.keys': function () { return Object.keys('qwe'); }, 'es.object.lookup-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.lookup-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.prevent-extensions': function () { return Object.preventExtensions(true); }, 'es.object.proto': function () { return '__proto__' in Object.prototype; }, 'es.object.seal': function () { return Object.seal(true); }, 'es.object.set-prototype-of': function () { return Object.setPrototypeOf; }, 'es.object.to-string': [SYMBOLS_SUPPORT, function () { var O = {}; O[Symbol.toStringTag] = 'foo'; return String(O) === '[object foo]'; }], 'es.object.values': function () { return Object.values; }, 'es.parse-float': function () { try { parseFloat(Object(Symbol.iterator)); } catch (error) { return 1 / parseFloat(WHITESPACES + '-0') === -Infinity; } }, 'es.parse-int': function () { try { parseInt(Object(Symbol.iterator)); } catch (error) { return parseInt(WHITESPACES + '08') === 8 && parseInt(WHITESPACES + '0x16') === 22; } }, // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.promise': PROMISES_SUPPORT, 'es.promise.constructor': PROMISES_SUPPORT, 'es.promise.all': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.all; }], 'es.promise.all-settled': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.allSettled; }], 'es.promise.any': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.any; }], 'es.promise.catch': PROMISES_SUPPORT, 'es.promise.finally': [PROMISES_SUPPORT, function () { // eslint-disable-next-line unicorn/no-thenable -- required for testing return Promise.prototype['finally'].call({ then: function () { return this; } }, function () { /* empty */ }); }], 'es.promise.race': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.race; }], 'es.promise.reject': PROMISES_SUPPORT, 'es.promise.resolve': PROMISES_SUPPORT, 'es.reflect.apply': function () { try { return Reflect.apply(function () { return false; }); } catch (error) { return Reflect.apply(function () { return true; }, null, []); } }, 'es.reflect.construct': function () { try { return !Reflect.construct(function () { /* empty */ }); } catch (error) { /* empty */ } function F() { /* empty */ } return Reflect.construct(function () { /* empty */ }, [], F) instanceof F; }, 'es.reflect.define-property': function () { return !Reflect.defineProperty(Object.defineProperty({}, 1, { value: 1 }), 1, { value: 2 }); }, 'es.reflect.delete-property': function () { return Reflect.deleteProperty; }, 'es.reflect.get': function () { return Reflect.get; }, 'es.reflect.get-own-property-descriptor': function () { return Reflect.getOwnPropertyDescriptor; }, 'es.reflect.get-prototype-of': function () { return Reflect.getPrototypeOf; }, 'es.reflect.has': function () { return Reflect.has; }, 'es.reflect.is-extensible': function () { return Reflect.isExtensible; }, 'es.reflect.own-keys': function () { return Reflect.ownKeys; }, 'es.reflect.prevent-extensions': function () { return Reflect.preventExtensions; }, 'es.reflect.set': function () { var object = Object.defineProperty({}, 'a', { configurable: true }); return Reflect.set(Object.getPrototypeOf(object), 'a', 1, object) === false; }, 'es.reflect.set-prototype-of': function () { return Reflect.setPrototypeOf; }, 'es.reflect.to-string-tag': function () { return Reflect[Symbol.toStringTag]; }, 'es.regexp.constructor': [NCG_SUPPORT, function () { var re1 = /a/g; var re2 = /a/g; re2[Symbol.match] = false; // eslint-disable-next-line no-constant-binary-expression -- required for testing return new RegExp(re1) !== re1 && RegExp(re1) === re1 && RegExp(re2) !== re2 && String(RegExp(re1, 'i')) === '/a/i' && new RegExp('a', 'y') // just check that it doesn't throw && RegExp('.', 's').exec('\n') && RegExp[Symbol.species]; }], 'es.regexp.dot-all': function () { return RegExp('.', 's').dotAll; }, 'es.regexp.exec': [NCG_SUPPORT, function () { var re1 = /a/; var re2 = /b*/g; var reSticky = new RegExp('a', 'y'); var reStickyAnchored = new RegExp('^a', 'y'); re1.exec('a'); re2.exec('a'); return re1.lastIndex === 0 && re2.lastIndex === 0 // eslint-disable-next-line regexp/no-empty-group -- required for testing && /()??/.exec('')[1] === undefined && reSticky.exec('abc')[0] === 'a' && reSticky.exec('abc') === null && (reSticky.lastIndex = 1) && reSticky.exec('bac')[0] === 'a' && (reStickyAnchored.lastIndex = 2) && reStickyAnchored.exec('cba') === null && RegExp('.', 's').exec('\n'); }], 'es.regexp.flags': function () { var INDICES_SUPPORT = true; try { RegExp('.', 'd'); } catch (error) { INDICES_SUPPORT = false; } var O = {}; // modern V8 bug var calls = ''; var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; var addGetter = function (key, chr) { Object.defineProperty(O, key, { get: function () { calls += chr; return true; } }); }; var pairs = { dotAll: 's', global: 'g', ignoreCase: 'i', multiline: 'm', sticky: 'y' }; if (INDICES_SUPPORT) pairs.hasIndices = 'd'; for (var key in pairs) addGetter(key, pairs[key]); var result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O); return result === expected && calls === expected; }, 'es.regexp.sticky': function () { return new RegExp('a', 'y').sticky === true; }, 'es.regexp.test': function () { var execCalled = false; var re = /[ac]/; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; return re.test('abc') === true && execCalled; }, 'es.regexp.to-string': function () { return RegExp.prototype.toString.call({ source: 'a', flags: 'b' }) === '/a/b' && RegExp.prototype.toString.name === 'toString'; }, 'es.set.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new Set(iterable); return set.forEach && set[Symbol.iterator]().next() && set.has(1) && set.add(-0) === set && set.has(0) && set[Symbol.toStringTag]; }], 'es.string.at-alternative': function () { return '𠮷'.at(-2) === '\uD842'; }, 'es.string.code-point-at': function () { return String.prototype.codePointAt; }, 'es.string.ends-with': createIsRegExpLogicTest('endsWith'), 'es.string.from-code-point': function () { return String.fromCodePoint; }, 'es.string.includes': createIsRegExpLogicTest('includes'), 'es.string.is-well-formed': function () { return String.prototype.isWellFormed; }, 'es.string.iterator': [SYMBOLS_SUPPORT, function () { return ''[Symbol.iterator]; }], 'es.string.match': function () { var O = {}; O[Symbol.match] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.match](''); // eslint-disable-next-line regexp/prefer-regexp-exec -- required for testing return ''.match(O) === 7 && execCalled; }, 'es.string.match-all': function () { try { // eslint-disable-next-line regexp/no-missing-g-flag -- required for testing 'a'.matchAll(/./); } catch (error) { return 'a'.matchAll(/./g); } }, 'es.string.pad-end': function () { return String.prototype.padEnd && !WEBKIT_STRING_PAD_BUG; }, 'es.string.pad-start': function () { return String.prototype.padStart && !WEBKIT_STRING_PAD_BUG; }, 'es.string.raw': function () { return String.raw; }, 'es.string.repeat': function () { return String.prototype.repeat; }, 'es.string.replace': function () { var O = {}; O[Symbol.replace] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.replace](''); var re2 = /./; re2.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(O) === 7 && execCalled // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive && ''.replace(re2, '$') === '7' // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing && 'a'.replace(/./, '$0') === '$0' && /./[Symbol.replace]('a', '$0') === '$0'; }, 'es.string.replace-all': function () { return String.prototype.replaceAll; }, 'es.string.search': function () { var O = {}; O[Symbol.search] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.search](''); return ''.search(O) === 7 && execCalled; }, 'es.string.split': function () { var O = {}; O[Symbol.split] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re.constructor = {}; re.constructor[Symbol.species] = function () { return re; }; re[Symbol.split](''); // eslint-disable-next-line regexp/no-empty-group -- required for testing var re2 = /(?:)/; var originalExec = re2.exec; re2.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re2); return ''.split(O) === 7 && execCalled && result.length === 2 && result[0] === 'a' && result[1] === 'b'; }, 'es.string.starts-with': createIsRegExpLogicTest('startsWith'), 'es.string.substr': function () { return 'ab'.substr(-1) === 'b'; }, 'es.string.to-well-formed': function () { // Safari ToString conversion bug // https://bugs.webkit.org/show_bug.cgi?id=251757 return String.prototype.toWellFormed.call(1) === '1'; }, 'es.string.trim': createStringTrimMethodTest('trim'), 'es.string.trim-end': [createStringTrimMethodTest('trimEnd'), function () { return String.prototype.trimRight === String.prototype.trimEnd; }], 'es.string.trim-left': [createStringTrimMethodTest('trimStart'), function () { return String.prototype.trimLeft === String.prototype.trimStart; }], 'es.string.trim-right': [createStringTrimMethodTest('trimEnd'), function () { return String.prototype.trimRight === String.prototype.trimEnd; }], 'es.string.trim-start': [createStringTrimMethodTest('trimStart'), function () { return String.prototype.trimLeft === String.prototype.trimStart; }], 'es.string.anchor': createStringHTMLMethodTest('anchor'), 'es.string.big': createStringHTMLMethodTest('big'), 'es.string.blink': createStringHTMLMethodTest('blink'), 'es.string.bold': createStringHTMLMethodTest('bold'), 'es.string.fixed': createStringHTMLMethodTest('fixed'), 'es.string.fontcolor': createStringHTMLMethodTest('fontcolor'), 'es.string.fontsize': createStringHTMLMethodTest('fontsize'), 'es.string.italics': createStringHTMLMethodTest('italics'), 'es.string.link': createStringHTMLMethodTest('link'), 'es.string.small': createStringHTMLMethodTest('small'), 'es.string.strike': createStringHTMLMethodTest('strike'), 'es.string.sub': createStringHTMLMethodTest('sub'), 'es.string.sup': createStringHTMLMethodTest('sup'), 'es.typed-array.float32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.float64-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-clamped-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.at': function () { return Int8Array.prototype.at; }, 'es.typed-array.copy-within': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.copyWithin; }], 'es.typed-array.every': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.every; }], 'es.typed-array.fill': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { var count = 0; new Int8Array(2).fill({ valueOf: function () { return count++; } }); return count === 1; }], 'es.typed-array.filter': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.filter; }], 'es.typed-array.find': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.find; }], 'es.typed-array.find-index': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.findIndex; }], 'es.typed-array.find-last': function () { return Int8Array.prototype.findLast; }, 'es.typed-array.find-last-index': function () { return Int8Array.prototype.findLastIndex; }, 'es.typed-array.for-each': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.forEach; }], 'es.typed-array.from': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.from; } ], 'es.typed-array.includes': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.includes; }], 'es.typed-array.index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.indexOf; }], 'es.typed-array.iterator': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { Int8Array.prototype[Symbol.iterator].call([1]); } catch (error) { return Int8Array.prototype[Symbol.iterator].name === 'values' && Int8Array.prototype[Symbol.iterator] === Int8Array.prototype.values && Int8Array.prototype.keys && Int8Array.prototype.entries; } }], 'es.typed-array.join': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.join; }], 'es.typed-array.last-index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.lastIndexOf; }], 'es.typed-array.map': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.map; }], 'es.typed-array.of': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.of; } ], 'es.typed-array.reduce': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduce; }], 'es.typed-array.reduce-right': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduceRight; }], 'es.typed-array.reverse': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reverse; }], 'es.typed-array.set': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { var array = new Uint8ClampedArray(3); array.set(1); array.set('2', 1); Int8Array.prototype.set.call(array, { length: 1, 0: 3 }, 2); return array[0] === 0 && array[1] === 2 && array[2] === 3; }], 'es.typed-array.slice': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return new Int8Array(1).slice(); }], 'es.typed-array.some': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.some; }], 'es.typed-array.sort': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { new Uint16Array(1).sort(null); new Uint16Array(1).sort({}); return false; } catch (error) { /* empty */ } // stable sort var array = new Uint16Array(516); var expected = Array(516); var index, mod; for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } array.sort(function (a, b) { return (a / 4 | 0) - (b / 4 | 0); }); for (index = 0; index < 516; index++) { if (array[index] !== expected[index]) return; } return true; }], 'es.typed-array.subarray': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.subarray; }], 'es.typed-array.to-locale-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { Int8Array.prototype.toLocaleString.call([1, 2]); } catch (error) { return [1, 2].toLocaleString() === new Int8Array([1, 2]).toLocaleString(); } }], 'es.typed-array.to-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.toString === Array.prototype.toString; }], 'es.typed-array.to-reversed': function () { return Int8Array.prototype.toReversed; }, 'es.typed-array.to-sorted': function () { return Int8Array.prototype.toSorted; }, 'es.typed-array.with': function () { try { new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); } catch (error) { return error === 8; } }, 'es.unescape': function () { return unescape; }, 'es.weak-map.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = Object.freeze([]); var called = 0; var iterable = { next: function () { return { done: !!called++, value: [key, 1] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new WeakMap(iterable); // MS IE bug return map.get(key) === 1 && map.get(null) === undefined && map.set({}, 2) === map && map[Symbol.toStringTag] // MS Edge bug && Object.isFrozen(key); }], 'es.weak-set.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = {}; var called = 0; var iterable = { next: function () { return { done: !!called++, value: key }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new WeakSet(iterable); return set.has(key) && !set.has(null) && set.add({}) === set && set[Symbol.toStringTag]; }], 'esnext.suppressed-error.constructor': function () { return typeof SuppressedError == 'function'; }, 'esnext.array.from-async': function () { return Array.fromAsync; }, 'esnext.array.filter-reject': function () { return [].filterReject; }, 'esnext.array.is-template-object': function () { return Array.isTemplateObject; }, 'esnext.array.unique-by': function () { return [].uniqueBy; }, 'esnext.array-buffer.detached': function () { return 'detached' in ArrayBuffer.prototype; }, 'esnext.array-buffer.transfer': function () { return ArrayBuffer.prototype.transfer; }, 'esnext.array-buffer.transfer-to-fixed-length': function () { return ArrayBuffer.prototype.transferToFixedLength; }, 'esnext.async-disposable-stack.constructor': function () { return typeof AsyncDisposableStack == 'function'; }, 'esnext.async-iterator.constructor': function () { return typeof AsyncIterator == 'function'; }, 'esnext.async-iterator.async-dispose': function () { return AsyncIterator.prototype[Symbol.asyncDispose]; }, 'esnext.async-iterator.drop': function () { return AsyncIterator.prototype.drop; }, 'esnext.async-iterator.every': function () { return AsyncIterator.prototype.every; }, 'esnext.async-iterator.filter': function () { return AsyncIterator.prototype.filter; }, 'esnext.async-iterator.find': function () { return AsyncIterator.prototype.find; }, 'esnext.async-iterator.flat-map': function () { return AsyncIterator.prototype.flatMap; }, 'esnext.async-iterator.for-each': function () { return AsyncIterator.prototype.forEach; }, 'esnext.async-iterator.from': function () { return AsyncIterator.from; }, 'esnext.async-iterator.map': function () { return AsyncIterator.prototype.map; }, 'esnext.async-iterator.reduce': function () { return AsyncIterator.prototype.reduce; }, 'esnext.async-iterator.some': function () { return AsyncIterator.prototype.some; }, 'esnext.async-iterator.take': function () { return AsyncIterator.prototype.take; }, 'esnext.async-iterator.to-array': function () { return AsyncIterator.prototype.toArray; }, 'esnext.composite-key': function () { return compositeKey; }, 'esnext.composite-symbol': function () { return compositeSymbol; }, 'esnext.data-view.get-float16': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.getFloat16; }], 'esnext.data-view.get-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.getUint8Clamped; }], 'esnext.data-view.set-float16': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.setFloat16; }], 'esnext.data-view.set-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.setUint8Clamped; }], 'esnext.disposable-stack.constructor': function () { return typeof DisposableStack == 'function'; }, 'esnext.function.demethodize': function () { return Function.prototype.demethodize; }, 'esnext.function.is-callable': function () { return Function.isCallable; }, 'esnext.function.is-constructor': function () { return Function.isConstructor; }, 'esnext.function.metadata': function () { return Function.prototype[Symbol.metadata] === null; }, 'esnext.iterator.constructor': function () { try { Iterator({}); } catch (error) { return typeof Iterator == 'function' && Iterator.prototype === Object.getPrototypeOf(Object.getPrototypeOf([].values())); } }, 'esnext.iterator.dispose': function () { return [].keys()[Symbol.dispose]; }, 'esnext.iterator.drop': function () { return Iterator.prototype.drop; }, 'esnext.iterator.every': function () { return Iterator.prototype.every; }, 'esnext.iterator.filter': function () { return Iterator.prototype.filter; }, 'esnext.iterator.find': function () { return Iterator.prototype.find; }, 'esnext.iterator.flat-map': function () { return Iterator.prototype.flatMap; }, 'esnext.iterator.for-each': function () { return Iterator.prototype.forEach; }, 'esnext.iterator.from': function () { return Iterator.from; }, 'esnext.iterator.map': function () { return Iterator.prototype.map; }, 'esnext.iterator.range': function () { return Iterator.range; }, 'esnext.iterator.reduce': function () { return Iterator.prototype.reduce; }, 'esnext.iterator.some': function () { return Iterator.prototype.some; }, 'esnext.iterator.take': function () { return Iterator.prototype.take; }, 'esnext.iterator.to-array': function () { return Iterator.prototype.toArray; }, 'esnext.iterator.to-async': function () { return Iterator.prototype.toAsync; }, 'esnext.json.is-raw-json': NATIVE_RAW_JSON, 'esnext.json.parse': function () { var unsafeInt = '9007199254740993'; var source; JSON.parse(unsafeInt, function (key, value, context) { source = context.source; }); return source === unsafeInt; }, 'esnext.json.raw-json': NATIVE_RAW_JSON, 'esnext.map.delete-all': function () { return Map.prototype.deleteAll; }, 'esnext.map.emplace': function () { return Map.prototype.emplace; }, 'esnext.map.every': function () { return Map.prototype.every; }, 'esnext.map.filter': function () { return Map.prototype.filter; }, 'esnext.map.find': function () { return Map.prototype.find; }, 'esnext.map.find-key': function () { return Map.prototype.findKey; }, 'esnext.map.from': function () { return Map.from; }, 'esnext.map.group-by': function () { return Map.groupBy; }, 'esnext.map.includes': function () { return Map.prototype.includes; }, 'esnext.map.key-by': function () { return Map.keyBy; }, 'esnext.map.key-of': function () { return Map.prototype.keyOf; }, 'esnext.map.map-keys': function () { return Map.prototype.mapKeys; }, 'esnext.map.map-values': function () { return Map.prototype.mapValues; }, 'esnext.map.merge': function () { return Map.prototype.merge; }, 'esnext.map.of': function () { return Map.of; }, 'esnext.map.reduce': function () { return Map.prototype.reduce; }, 'esnext.map.some': function () { return Map.prototype.some; }, 'esnext.map.update': function () { return Map.prototype.update; }, 'esnext.math.clamp': function () { return Math.clamp; }, 'esnext.math.deg-per-rad': function () { return Math.DEG_PER_RAD; }, 'esnext.math.degrees': function () { return Math.degrees; }, 'esnext.math.fscale': function () { return Math.fscale; }, 'esnext.math.f16round': function () { return Math.f16round; }, 'esnext.math.rad-per-deg': function () { return Math.RAD_PER_DEG; }, 'esnext.math.radians': function () { return Math.radians; }, 'esnext.math.scale': function () { return Math.scale; }, 'esnext.math.signbit': function () { return Math.signbit; }, 'esnext.number.from-string': function () { return Number.fromString; }, 'esnext.object.group-by': function () { return Object.groupBy; }, 'esnext.promise.with-resolvers': [PROMISES_SUPPORT, function () { return Promise.withResolvers; }], 'esnext.regexp.escape': function () { return RegExp.escape; }, 'esnext.set.add-all': function () { return Set.prototype.addAll; }, 'esnext.set.delete-all': function () { return Set.prototype.deleteAll; }, 'esnext.set.difference.v2': createSetMethodTest('difference'), 'esnext.set.every': function () { return Set.prototype.every; }, 'esnext.set.filter': function () { return Set.prototype.filter; }, 'esnext.set.find': function () { return Set.prototype.find; }, 'esnext.set.from': function () { return Set.from; }, 'esnext.set.intersection.v2': [createSetMethodTest('intersection'), function () { return Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2]))) === '3,2'; }], 'esnext.set.is-disjoint-from.v2': createSetMethodTest('isDisjointFrom'), 'esnext.set.is-subset-of.v2': createSetMethodTest('isSubsetOf'), 'esnext.set.is-superset-of.v2': createSetMethodTest('isSupersetOf'), 'esnext.set.join': function () { return Set.prototype.join; }, 'esnext.set.map': function () { return Set.prototype.map; }, 'esnext.set.of': function () { return Set.of; }, 'esnext.set.reduce': function () { return Set.prototype.reduce; }, 'esnext.set.some': function () { return Set.prototype.some; }, 'esnext.set.symmetric-difference.v2': createSetMethodTest('symmetricDifference'), 'esnext.set.union.v2': createSetMethodTest('union'), 'esnext.string.code-points': function () { return String.prototype.codePoints; }, 'esnext.string.cooked': function () { return String.cooked; }, 'esnext.string.dedent': function () { return String.dedent; }, 'esnext.symbol.async-dispose': function () { var descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncDispose'); return descriptor.value && !descriptor.enumerable && !descriptor.configurable && !descriptor.writable; }, 'esnext.symbol.dispose': function () { var descriptor = Object.getOwnPropertyDescriptor(Symbol, 'dispose'); return descriptor.value && !descriptor.enumerable && !descriptor.configurable && !descriptor.writable; }, 'esnext.symbol.is-registered-symbol': function () { return Symbol.isRegisteredSymbol; }, 'esnext.symbol.is-well-known-symbol': function () { return Symbol.isWellKnownSymbol; }, 'esnext.symbol.matcher': function () { return Symbol.matcher; }, 'esnext.symbol.metadata': function () { return Symbol.metadata; }, 'esnext.symbol.observable': function () { return Symbol.observable; }, 'esnext.typed-array.filter-reject': function () { return Int8Array.prototype.filterReject; }, 'esnext.typed-array.unique-by': function () { return Int8Array.prototype.uniqueBy; }, 'esnext.weak-map.delete-all': function () { return WeakMap.prototype.deleteAll; }, 'esnext.weak-map.emplace': function () { return WeakMap.prototype.emplace; }, 'esnext.weak-map.from': function () { return WeakMap.from; }, 'esnext.weak-map.of': function () { return WeakMap.of; }, 'esnext.weak-set.add-all': function () { return WeakSet.prototype.addAll; }, 'esnext.weak-set.delete-all': function () { return WeakSet.prototype.deleteAll; }, 'esnext.weak-set.from': function () { return WeakSet.from; }, 'esnext.weak-set.of': function () { return WeakSet.of; }, 'web.atob': function () { try { atob(); } catch (error1) { try { atob('a'); } catch (error2) { return atob(' ') === ''; } } }, 'web.btoa': function () { try { btoa(); } catch (error) { return typeof btoa == 'function'; } }, 'web.clear-immediate': function () { return setImmediate && clearImmediate; }, 'web.dom-collections.for-each': function () { return (!GLOBAL.NodeList || (NodeList.prototype.forEach && NodeList.prototype.forEach === [].forEach)) && (!GLOBAL.DOMTokenList || (DOMTokenList.prototype.forEach && DOMTokenList.prototype.forEach === [].forEach)); }, 'web.dom-collections.iterator': function () { var DOMIterables = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; for (var collection in DOMIterables) { if (GLOBAL[collection]) { if ( !GLOBAL[collection].prototype[Symbol.iterator] || GLOBAL[collection].prototype[Symbol.iterator] !== [].values ) return false; if (DOMIterables[collection] && ( !GLOBAL[collection].prototype.keys || !GLOBAL[collection].prototype.values || !GLOBAL[collection].prototype.entries )) return false; } } return true; }, 'web.dom-exception.constructor': function () { return new DOMException() instanceof Error && new DOMException(1, 'DataCloneError').code === 25 && String(new DOMException(1, 2)) === '2: 1' && DOMException.DATA_CLONE_ERR === 25 && DOMException.prototype.DATA_CLONE_ERR === 25; }, 'web.dom-exception.stack': function () { return !('stack' in Error('1')) || 'stack' in new DOMException(); }, 'web.dom-exception.to-string-tag': function () { return typeof DOMException == 'function' && DOMException.prototype[Symbol.toStringTag] === 'DOMException'; }, // TODO: Remove this module from `core-js@4` since it's split to submodules 'web.immediate': IMMEDIATE, 'web.queue-microtask': function () { return Object.getOwnPropertyDescriptor(GLOBAL, 'queueMicrotask').value; }, 'web.self': function () { // eslint-disable-next-line no-restricted-globals -- safe if (self !== GLOBAL) return false; if (!DESCRIPTORS_SUPPORT) return true; var descriptor = Object.getOwnPropertyDescriptor(GLOBAL, 'self'); return descriptor.get && descriptor.enumerable; }, 'web.set-immediate': IMMEDIATE, 'web.set-interval': TIMERS, 'web.set-timeout': TIMERS, 'web.structured-clone': function () { function checkErrorsCloning(structuredCloneImplementation, $Error) { var error = new $Error(); var test = structuredCloneImplementation({ a: error, b: error }); return test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack; } function checkNewErrorsCloningSemantic(structuredCloneImplementation) { var test = structuredCloneImplementation(new AggregateError([1], 'message', { cause: 3 })); return test.name === 'AggregateError' && test.errors[0] === 1 && test.message === 'message' && test.cause === 3; } return checkErrorsCloning(structuredClone, Error) && checkErrorsCloning(structuredClone, DOMException) && checkNewErrorsCloningSemantic(structuredClone); }, // TODO: Remove this module from `core-js@4` since it's split to submodules 'web.timers': TIMERS, 'web.url.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT, 'web.url.can-parse': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { try { URL.canParse(); } catch (error) { return URL.canParse; } }], 'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return URL.prototype.toJSON; }], 'web.url-search-params.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT, 'web.url-search-params.delete': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { var params = new URLSearchParams('a=1&a=2&b=3'); params['delete']('a', 1); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params['delete']('b', undefined); return params + '' === 'a=2'; }], 'web.url-search-params.has': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { var params = new URLSearchParams('a=1'); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 return params.has('a', 1) && !params.has('a', 2) && params.has('a', undefined); }], 'web.url-search-params.size': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return 'size' in URLSearchParams.prototype; }] }; core-js-3.33.2/docs/zh_CN/000077500000000000000000000000001451776221300151055ustar00rootroot00000000000000core-js-3.33.2/docs/zh_CN/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md000066400000000000000000001060431451776221300262150ustar00rootroot00000000000000# core-js@3, Babel 展望未来 经过一年半的开发,数十个版本,许多不眠之夜,**[`core-js@3`](https://github.com/zloirock/core-js)** 终于发布了。这是 `core-js` 和 **[babel](https://babeljs.io/)** 补丁相关的功能的最大的一次变化。 什么是 `core-js`? - 它是JavaScript标准库的 polyfill,它支持 - 最新的 [ECMAScript](https://en.wikipedia.org/wiki/ECMAScript) 标准 - ECMAScript 标准库提案 - 一些 [WHATWG](https://en.wikipedia.org/wiki/WHATWG) / [W3C](https://en.wikipedia.org/wiki/World_Wide_Web_Consortium) 标准(跨平台或者 ECMAScript 相关) - 它最大限度的模块化:你能仅仅加载你想要使用的功能 - 它能够不污染全局命名空间 - 它[和babel紧密集成](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#Babel):这能够优化`core-js`的导入 它是最普遍、[最流行](https://npmtrends.com/airbnb-js-shims-vs-core-js-vs-es5-shim-vs-es6-shim-vs-js-polyfills-vs-polyfill-library-vs-polyfill-service) 的给 JavaScript 标准库打补丁的方式,但是有很大一部分开发者并不知道他们间接的使用了`core-js`🙂 ## 贡献 `core-js` 是我自己爱好的项目,没有给我带来任何利润。它花了我很长的时间,真的很昂贵:为了完成 `core-js@3`,我在几个月之前已经离开我的工作。这个项目对许多人和公司起到了促进作用。因为这些,筹集资金去支持 `core-js` 的维护是说得通的。 如果你对 `core-js` 感兴趣或者在你每天的工作中有使用到,你可以在 [Open Collective](https://opencollective.com/core-js#sponsor) 或者 [Patreon](https://www.patreon.com/zloirock) 成为赞助者。 你可以给[我](http://zloirock.ru/)提供一个好的工作,和我现在做的相关的。 或者你可以以另一种方式贡献,你可以帮助去改进代码、测试或者文档(现在,`core-js` 的文档还很糟糕!)。 ## `core-js@3` 有哪些变化? ### JavaScript 标准库中变化的内容 由于以下两个原因,这个版本包含丰富的、新的 JavaScript 补丁: - `core-js` 只在 major(主)版本更新时才有 break changes,即使需要和提案的内容对齐。 - `core-js@2` 在一年半前已经进入功能冻结阶段了;所有新的功能只能够添加到 `core-js@3` 这个分支。 #### 稳定的 ECMAScript 功能 稳定的 ECMAScript 功能在 `core-js` 中已经几乎完全支持有很长一段时间了,除此之外,`core-js@3` 引进了一些新功能: - 增加支持 ECMAScript 2015 引入的两个知名标志 [`@@isConcatSpreadable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/isConcatSpreadable) 和 [`@@species`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/species),给所有使用他们的方法。 - 增加来自 ECMAScript 2018 的 [`Array.prototype.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) 和 [`Array.prototype.flatMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap)( `core-js@2` 针对 `Array.prototype.flatten` 这个老版本的提案提供了补丁)。 - 增加来自 ECMAScript 2019 的 [`Object.fromEntries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries) 方法 - 增加来自 ECMAScript 2019 的 [`Symbol.prototype.description`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/description) 访问器 一些在 ES2016-ES2019 中作为提案被接受且已经使用很长时间的功能,现在被标记为稳定: - [`Array.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) 和 [`TypedArray.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/includes) 方法( ESMAScript 2016 ) - [`Object.values`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values) 和 [`Object.entries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) 方法( ECMAScript 2017 ) - [`Object.getOwnPropertyDescriptors`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors) 方法 ( ECMAScript 2017 ) - [`String.prototype.padStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) 和 [`String.prototype.padEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) 方法( ECMAScript 2017 ) - [`Promise.prototype.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) 方法( ECMAScript 2018 ) - [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator) 知名标志( ECMAScript 2018 ) - [`Object.prototype.__define(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) 和 [`Object.prototype.__lookup(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__) 方法( ECMAScript 2018 ) - [`String.prototype.trim(Start|End|Left|Right)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart) 方法( ECMAScript 2019 ) 修复了针对浏览器的许多问题,例如,[Safari 12.0 `Array.prototype.reverse` bug](https://bugs.webkit.org/show_bug.cgi?id=188794) 已经被修复了。 #### ECMAScript 提案 除了上文提到的支持内容,`core-js@3` 现在还支持下面的 ECMAScript 提案: - [`globalThis`](https://github.com/tc39/proposal-global) stage 3( 现在是 stage 4 )的提案 - 之前,已经有了 `global` 和 `System.global` - [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled) stage 2( 现在是 stage 4 )提案 - [新 `Set` 方法](https://github.com/tc39/proposal-set-methods) stage 2 提案: - Set.prototype.difference - Set.prototype.intersection - Set.prototype.isDisjoinFrom - Set.prototype.isSubsetOf - Set.prototype.isSupersetOf - Set.prototype.symmetricDifference - Set.prototype.union - [新 collections 方法](https://github.com/tc39/proposal-collection-methods) stage 1 提案,包函许多新的有用的方法: - Map.groupBy - Map.keyBy - Map.prototype.deleteAll - Map.prototype.every - Map.prototype.filter - Map.prototype.find - Map.prototype.findKey - Map.prototype.includes - Map.prototype.keyOf - Map.prototype.mapKeys - Map.prototype.mapValues - Map.prototype.merge - Map.prototype.reduce - Map.prototype.some - Map.prototype.update - Set.prototype.addAll - Set.prototype.deleteAll - Set.prototype.every - Set.prototype.filter - Set.prototype.find - Set.prototype.join - Set.prototype.map - Set.prototype.reduce - Set.prototype.some - WeakMap.prototype.deleteAll - WeakSet.prototype.addAll - WeakSet.prototype.deleteAll - [`String.prototype.replaceAll`](https://github.com/tc39/proposal-string-replace-all) stage 1( 现在是 stage 3 ) 提案 - [`String.prototype.codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints) stage 1 提案 - [`Array.prototype.last(Item|Index)`](https://github.com/tc39-transfer/proposal-array-last) stage 1 提案 - [`compositeKey` 和 `compositeSymbol` 方法](https://github.com/bmeck/proposal-richer-keys/tree/master/compositeKey) stage 1 提案 - [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) stage 1 提案 - [`Math.seededPRNG`](https://github.com/tc39/proposal-seeded-random) stage 1 提案 - [`Promise.any` (合并的错误)](https://github.com/tc39/proposal-promise-any) stage 0( 现在是 stage 3 )提案 一些提案的变化很大,`core-js` 也将相应的更新: - [`String.prototype.matchAll`](https://github.com/tc39/proposal-string-matchall) stage 3 提案 - [Observable](https://github.com/tc39/proposal-observable) stage 1 提案 #### web 标准 许多有用的功能被添加到这个类别中。 最重要的一个是 [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) 和 [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)。他是[最受欢迎的功能请求之一](https://github.com/zloirock/core-js/issues/117)。增加 `URL` 和 `URLSearchParams`,并保证他们最大限度的符合规范,保持源代码足够紧凑来支撑任何环境是 `core-js@3` 开发中[最困难的任务之一](https://github.com/zloirock/core-js/pull/454/files)。 `core-js@3` 包函在 JavaScript 中创建微任务( microtask )的标准方法:[`queueMicrotask`](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing) 。`core-js@2` 提供了 `asap` 函数,提供了同样功能的老的提案。`queueMicrotask` 被定义在 HTML 标准中,它已经能够在现代浏览器比如 Chromium 或者 NodeJS 中使用。 另一个受欢迎的功能请求是支持 [DOM 集合的 `.forEach` 方法](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach)。由于 `core-js` 已经针对 DOM 集合迭代器做了 polyfill,为什么不给 `节点列表` 和 [`DOMTokenList`](https://developer.mozilla.org/zh-CN/docs/Web/API/DOMTokenList) 也增加 `.forEach` 呢? #### 移除过时的功能: - `Reflect.enumerate` 因为他已经从标准中移除了 - `System.global` 和 `global` 现在他们已经被 `globalThis` 代替 - `Array.prototype.flatten` 现在被 `Array.prototype.flat` 代替 - `asap` 被 `queueMicrotask` 代替 - `Error.isError` 被撤销很长时间了 - `RegExp.escape` 很久之前被拒绝了 - `Map.prototype.toJSON` 和 `Set.prototype.toJSON` 也是很久前被拒绝了 - 不必要并且被错误添加的迭代器方法:`CSSRuleList`,`MediaList`,`StyleSheetList`。 #### 不再有非标准、非提案的功能 许多年前,我开始写一个库,他是我的 JavaScript 程序的核心:这个库包函 polyfills 和一些我需要的工具函数。一段时间后,这个库以 `core-js` 命名发布。我认为现在大多数 `core-js` 用户不需要非标准的 `core-js` 功能,他们大多已经在早期版本移除了,现在是时候将剩余部分从 `core-js` 中移除。从这个版本开始,`core-js` 可以被称为 polyfill 了。 ### 包、入口和模块名字 一个 issue 里提了 `core-js` 包的很大( ~2MB ),有很多重复文件。因为这个原因,`core-js` 分成了 3 个包: - [`core-js`](https://www.npmjs.com/package/core-js) 定义全局的 polyfills。( ~500KB,[压缩并且 gzipped 处理后 40KB](https://bundlephobia.com/result?p=core-js@3.0.0-beta.20) ) - [`core-js-pure`](https://www.npmjs.com/package/core-js-pure),提供了不污染全局变量的 polyfills。它和 `core-js@2` 中的 `core-js/library` 相当。(~440KB) - [`core-js-bundle`](https://www.npmjs.com/package/core-js-bundle):定义了全局填充的打包版本 `core-js` 的早期版本中,稳定的 ECMAScript 功能和 ECMAScript 提案的 polyfill 模块化需要分别加 `es6.` 和 `es7.` 前缀。这是在 2014 年做的决定,那时将 ES6 之后的所有功能都视为 ES7。在 `core-js@3` 中所有稳定的 ECMAScript 功能都增加 `es.` 前缀,ECMAScript 提案增加 `esnext.` 前缀。 几乎所有的 CommonJS 入口都改变了。`core-js@3` 相比于 `core-js@2` 有更多的入口:这带来的最大限度的灵活性,使你能够仅仅引入你的应用需要的依赖。 这里是一些例子关于如何使用新的入口: ```js // 使用 `core-js` 全部功能打补丁: import "core-js"; // 仅仅使用稳定的 `core-js` 功能 - ES 和 web 标准: import "core-js/stable"; // 仅仅使用稳定的 ES 功能 import "core-js/es"; // 如果你想用 `Set` 的补丁 // 所有 `Set`- ES 提案中,相关的功能: import "core-js/features/set"; // 稳定的 `Set` ES 功能和来自web标准的功能 // (DOM 集合迭代器) import "core-js/stable/set"; // 只有 `Set` 所需的稳定的 ES 功能 import "core-js/es/set"; // 与上面一致,但不会污染全局命名空间 import Set from "core-js-pure/features/set"; import Set from "core-js-pure/stable/set"; import Set from "core-js-pure/es/set"; // 仅仅为需要的方法打补丁 import "core-js/feature/set/intersection"; import "core-js/stable/queque-microtask"; import "core-js/es/array/from"; // 为 reflect metadata 提案打补丁 import "core-js/proposals/reflect-metadata"; // 为所有 stage 2+ 的提案打补丁 import "core-js/stage/2"; ``` ### 其他重要的变化 `core-js` polyfill 能够 [配置侵入等级](https://github.com/zloirock/core-js/blob/master/README.md#configurable-level-of-aggressiveness)。如果你认为有些情境 `core-js` 功能检测侵入性太强,原生实现对你来说已经足够,或者一个错误的实现没有被 `core-js` 检测到,你可以修改 `core-js` 的默认行为。 如果无法安装规范的每个细节实现某个功能,`core-js` 增加了一个 `.sham` 属性,例如,IE11中 `Symbol.sham` 是 `true`。 不再有 LiveScript! 当我开始写 `core-js` 时,我主要使用的是 [LiveScript](http://livescript.net/) ;一段时间后,我用 JavaScript 重写了全部的 polyfills 。在 `core-js@2` 中测试和帮助的工具函数仍然使用 LiveScript :它是非常有趣的像 CoffeeScript 一样的语言,有强大的语法糖使你能够写非常紧凑的代码,但是它几乎已经死了。除此之外,它也是为 `core-js` 贡献的屏障,因为大多数 `core-js` 用户不知道这个语言。`core-js@3` 测试和工具函数使用现代 ES 语法:它将成为为 `core-js` 贡献的好时机🙂。 对于大多数用户,为了优化 `core-js` 导入,我建议使用 [babel](#Babel)。当然,有些情况下 [`core-js-builder`](http://npmjs.com/package/core-js-builder) 仍然有用。现在它支持 `target` 参数,使用带有目标引擎的[`browserslist`](https://github.com/browserslist/browserslist) 查询 - 你能够创建一个 bundle,仅仅包含目标引擎需要的 polyfills。对于这种情况,我做了 [`core-js-compat`](https://www.npmjs.com/package/core-js-compat),更多关于它的信息,你能够从 [这篇文章的 `@babel/preset-env` 部分](#babelpreset-env)了解到。 --- 这仅仅是冰山一角,更多的变化在内部。更多关于 `core-js` 变化可以在 [changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300) 中找到。 ## Babel 正如上文提到的,`babel` 和 `core-js` 是紧密集成的:`babel` 提供了优化 `core-js` 优化导入的可能性。`core-js@3` 开发中很重要的一部分是改进 `core-js` 相关的 `babel` 功能(看[这个PR](https://github.com/babel/babel/pull/7646))。这些变化在 [Babel 7.4.0](https://babeljs.io/blog/2019/03/19/7.4.0) 发布了。 ### babel/polyfill [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) 是一个包裹的包,里面仅仅包含 `core-js` 稳定版的引入(在Babel 6 中也包含提案)和 `regenerator-runtime/runtime`,用来转译 generators 和 async 函数。这个包没有提供从 `core-js@2` 到 `core-js@3` 平滑升级路径:因为这个原因,决定弃用 `@babel/polyfill` 代之以分别引入需要的 `core-js` 和 `regenerator-runtime` 。 原来 ```js import "@babel/polyfill"; ``` 现在使用两行代替: ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` 别忘记直接安装这两个依赖! ```js npm i --save core-js regenerator-runtime ``` ### @babe/preset-env [`@babel/preset-env`](https://babeljs.io/docs/en/next/babel-preset-env#usebuiltins) 有两种不同的模式,通过 `useBuiltIns` 选项:`entry` 和 `usage` 优化 `core-js`的导入。 Babel 7.4.0 引入了两种模式的共同更改,以及每种模式的特定的修改。 由于现在 `@babel/preset-env` 支持 `core-js@2` 和 `core-js@3`,因此 `useBuiltIns` 需要新的选项 -- `corejs`,这个选项用来定义使用 `core-js` 的版本(`corejs: 2` 或者 `corejs: 3`)。如果没有设置,`corejs: 2` 是默认值并且会有警告提示。 为了使 babel 支持将来的次要版本中引入的 `core-js` 的新功能,你可以在项目中定义明确的次要版本号。例如,你想使用 `core-js@3.1` 使用这个版本的新特性,你可以设置 `corejs` 选项为 `3.1`:`corejs: '3.1'` 或者 `corejs: {version: '3.1'}`。 `@babel/preset-env` 最重要的一个功能就是提供不同浏览器支持特性的数据来源,用来确定是否需要 `core-js` 填充某些内容。 [`caniuse`](https://caniuse.com/),[`mdn`](https://developer.mozilla.org/en-US/) 和 [`compat-table`](http://kangax.github.io/compat-table/es6/) 是很好的教育资源,但是并不意味着他们能够作为数据源被开发者使用:只有 `compat-table` 包函好的 ES 相关数据集,它被 `@babel/preset-env` 使用,但是仍有些限制: - 它包含的数据仅仅关于 ECMAScript 特性和提案,和 web 平台特性例如 `setImmediate` 或者 DOM 集合迭代器没有关系。所以直到现在,`@babel/preset-env` 仍然通过 `core-js` 添加全部的 web 平台特性即使他们已经支持了。 - 它不包含任何浏览器(甚至是严重的)bug 信息:例如,上文提到的在 Safari 12 中 `Array#reverse`,但是 `compat-table` 并没有将它标记为不支持。另一方面,`core-js` 已经修复了这个错误实现,但是因为 `compat-table` 关系,并不能使用它。 - 它仅包函一些基础的、简单的测试,没有检查功能在真实环境下是否可以正常工作。例如,老版本 Safari 的破坏的迭代器没有 `.next` 方法,但是 `compat-table` 表明 Safari 支持,因为它用 `typeof` 方法检测迭代器方法返回了 `"function"`。一些像 typed arrays 的功能几乎没有覆盖。 - `compat-table` 不是为了向工具提供数据而设计的。我是 `compat-table` 的维护者之一,但是[其他的维护者反对为维护这个功能](https://github.com/kangax/compat-table/pull/1312)。 因为这个原因,我创建了 [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat):它提供了对于不同浏览器 `core-js` 模块的必要性数据。当使用 `core-js@3` 时,`@babel/preset-env` 将使用新的包取代 `compat-table`。[请帮助我们测试并提供缺少的引擎的数据的映射关系!](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data)😊。 在 Babel 7.3 之前,`@babel/preset-env` 有一些与 polyfills 注入顺序有关的问题。从 7.4.0开始,`@babel/preset-env` 只按推荐顺序增加需要的 polyfills 。 #### `useBuiltIns: entry` with `corejs: 3` 当使用这个选项时,`@babel/preset-env` 代替直接引用 `core-js` 而是引入目标环境特定需要的模块。 在这个变化前,`@babel/preset` 仅替换 `import '@babel/polyfill'` 和 `import 'core-js'`,他们是同义词用来 polyfill 所有稳定的 JavaScript 特性。 现在 `@babel/polyfill` 弃用了,当 `corejs` 设置为 3 时 `@babel/preset-env` 不会转译他。 `core-js@3` 中等价替换 `@babel/polyfill` 是 ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` 当目标浏览器是 `chrome 72` 时,上面的内容将被 `@babel/preset-env` 转换为 ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopaables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; ``` 当目标浏览器是 `chrome 73`(它完全支持 ES2019 标准库),他将变为很少的引入: ```js import "core-js/modules/web.immediate"; ``` 自从 `@babel/polyfill` 被弃用,转而使用分开的 `core-js` 和 `regenerator-runtime`,我们能够优化 `regenerator-runtime` 的导入。因为这个原因,如果目标浏览器原生支持 generators ,那么 `regenerator-runtime` 的导入将从源代码中移除。 现在,设置 `useBuiltIns: entry` 模式的 `@babel/preset-env` 编译所有能够获得的 `core-js` 入口和他们的组合。这意味着你能够自定义,通过使用不同的 `core-js` 入口,它将根据的目标环境优化。 例如,目标环境是 `chrome 72`, ```js import "core-js/es"; import "core-js/proposals/set-methods"; import "core-js/features/set/map"; ``` 将被替换为 ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.set.difference"; import "core-js/modules/esnext.set.intersection"; import "core-js/modules/esnext.set.is-disjoint-from"; import "core-js/modules/esnext.set.is-subset-of"; import "core-js/modules/esnext.set.is-superset-of"; import "core-js/modules/esnext.set.map"; import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; ``` #### `useBuiltIns: usage` with `corejs: 3` 当使用这个选项时,`@babel/preset-env` 在每个文件的开头引入目标环境不支持、仅在当前文件中使用的 polyfills。 例如, ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` 当目标环境是老的浏览器例如 `ie 11`,将转换为 ```js import "core-js/modules/es.array.includes"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.object.to-string"; import "core-js/modules/es.set"; const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` 当目标是 `chrome 72` 时不需要导入,因为这个环境需要 polyfills: ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` Babel 7.3 之前,`useBuiltIns: usage` 不稳定且不是足够可靠:许多 polyfills 不包函,并且添加了许多不是必须依赖的 polyfills。在 Babel 7.4 中,我尝试使它理解每种可能的使用模式。 在属性访问器、对象解构、`in` 操作符、全局对象属性访问方面,我改进了确定使用哪个 polyfills 的技术。 `@babel/preset-env` 现在注入语法特性所需的 polyfills:使用 `for-of` 时的迭代器,解构、扩展运算符和 `yield` 委托;使用动态 `import` 时的 promises,异步函数和 generators,等。 Babel 7.4 支持注入提案 polyfills。默认,`@babel/preset-env` 不会注入他们,但是你能够通过 `proposals` 标志设置:`corejs: { version: 3, proposals: true }`。 ### @babel/runtime 当使用 `core-js@3` 时, [`@babel/transform-runtime`](https://babeljs.io/docs/en/next/babel-plugin-transform-runtime#corejs) 现在通过 `core-js-pure`(`core-js`的一个版本,不会污染全局变量) 注入 polyfills。 通过将 `@babel/transform-runtime` 设置 `corejs: 3` 选项和创建 `@babel/runtime-corejs3` 包,已经将 `core-js@3` 和 `@babel/runtime` 集成在一起。但是这将带来什么好处呢? `@babel/runtime` 的一个受欢迎的 issue 是:不支持实例方法。从 `@babel/runtime-corejs3` 开始,这个问题已经解决。例如, ```js array.includes(something); ``` 将被编译为 ```js import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes"; _includesInstanceProperty(array).call(array, something); ``` 另一个值得关注的变化是支持 ECMAScript 提案。默认情况下的,`@babel/plugin-transform-runtime` 不会为提案注入 polyfills 并使用不包含提案的入口。但是正如你在 `@babel/preset-env` 中做的那样,你可以设置 `proposals` 标志去开启:`corejs: { version: 3, proposals: true }`。 没有 `proposals` 标志, ```js new Set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` 将被编译为: ```js import _Set from "@babel/runtime-corejs/core-js-stable/set"; new _set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` 当设置 `proposals` 后,将变为: ```js import _Set from "@babel/runtime-corejs3/core-js/set"; import _matchAllInstanceProperty from "@babel/runtime-corejs/core-js/instance/match-all"; new _Set([1, 2, 3, 2, 1]); _matchAllInstanceProperty(string).call(string, /something/g); ``` 有些老的问题已经被修复了。例如,下面这种流行的模式在 `@babel/runtime-corejs2` 不工作,但是在 `@babel/runtime-corejs3` 被支持。 ```js myArrayLikeObject[Symbol.iterator] = Array.prototype[Symbol.iterator]; ``` 尽管 `@babel/runtime` 早期版本不支持实例方法,但是使用一些自定义的帮助函数能够支持迭代(`[Symbol.iterator]()` 和他的presence)。之前不支持提取 `[Symbol.iterator]` 方法,但是现在支持了。 作为意外收获,`@babel/runtime` 现在支持IE8-,但是有些限制,例如,IE8- 不支持访问器、模块转换应该用松散的方式,`regenerator-runtime`(内部使用 ES5+ 实现)需要通过这个插件转译。 ## 畅享未来 做了许多工作,但是 `core-js` 距离完美还很远。这个库和工具将来应该如何改进?语言的变化将会如何影响它? ### 老的引擎支持 现在,`core-js` 试图去支持所有可能的引擎或者我们能够测试到的平台:甚至是IE8-,或者例如,早期版本的 Firefox。虽然它对某些用户有用,但是仅有一小部分使用 `core-js` 的开发者需要它。对于大多数用户,它将引起像包体积过大或者执行缓慢的问题。 主要的问题源自于支持 ES3 引擎(首先是 IE8- ):多数现代 ES 特性是基于 ES5,这些功能在老版本浏览器中均不可用。 最大的缺失特性是属性描述符:当它缺失时,一些功能不能 polyfill,因为他们要么是访问器(像 `RegExp.prototype.flags` 或 `URL` 属性的 setters )要么就是基于访问器(像 typed array polyfill)。为了解决这个不足,我们需要使用不同的解决方法(例如,保持 `Set.prototype.size` 更新)。维护这些解决方法有时很痛苦,移除他们将极大的简化许多 polyfills。 然而,描述符仅仅是问题的一部分。ES5 标准库包含了很多其他特性,他们被认为是现代 JavaScript 的基础:`Object.create`,`Object.getPrototypeOf`,`Array.prototype.forEach`,`Function.prototype.bind`,等等。和多数现代特性不同,`core-js` 内部依赖他们并且[为了实现一个简单的现代函数,`core-js` 需要加载其中一些"建筑模块"的实现](https://github.com/babel/babel/pull/7646#discussion_r179333093)。对于想要创建一个足够小的构建包和仅仅想要引入部分 `core-js` 的用户来说,这是个问题。 在一些国家 IE8 仍很流行,但是为了让 web 向前发展,浏览器到了某些时候就应该消失了。 `IE8` 在 2009 年 3 月 19 日发布,到今天已经 10 年了。IE6 已经 18 岁了:几个月前新版的 `core-js` 已经不再测试 IE6 了。 在 `core-js@4` 我们应该舍弃 IE8- 和其他不知道 ES5 的引擎。 ### ECMAScript 模块 `core-js` 使用 `CommonJS` 模块规范。长期以来,他是最受欢迎的 JavaScript 模块规范,但是现在 ECMAScript 提供了他自己的模块规范。许多引擎已经支持它了。一些构建工具(像 rollup )基于它,其他的构建工具提供它作为 `CommonJS` 的替代。这意味提供了一个可选择的使用 ESMAScript 模块规范版本的 `core-js` 行得通。 ### 支持 web 标准扩展? `core-js` 当前专注在 ECMAScript 支持,但是也支持少量的跨平台以及和 ECMAScript 紧密联系的 web 标准功能。为 web 标准添加像 `fetch` 的这种的 polyfill 是受欢迎的功能请求。 `core-js` 没有增加他们的主要原因是,他们将严重的增加构建包大小并且将强制 `core-js` 用户载入他们可能用不到的功能。现在 `core-js` 是最大限度的模块化,用户能够仅选择他们需要的功能,这就像 `@babel/preset-env` 和 `@babel/runtime` 能够帮助用户去减少没用到和不必要的 polyfills。 现在是时候重新审视这个决定了? ### 针对目标环境的 `@babel/runtime` 目前,我们不能像对 `@babel/preset-env` 那样为 `@babel/runtime` 设置目标加环境。这意味即使目标是现代浏览器, `@babel/runtime` 也将注所有可能的 polyfills:这不必要的增加了最终构建包的大小。 现在 `core-js-compat` 包函全部必要数据,将来,可以在 `@babel/runtime` 中添加对目标环境的编译支持,并且在 `@babel/preset-env` 中添加 `useBuiltIns: runtime` 选项。 ### 更好的优化 polyfill 加载 正如上面解释的,Babel 插件给了我们不同的方式去优化 `core-js` 的使用,但是他并不完美:我们可以改进他们。 通过 `useBuiltIns: usage` 选项,`@babe/preset-env` 能够做的比之前更好,但是针对一些不寻常的例子他们仍然会失败:当代码不能被静态分析。针对这个问题,我们需要为库开发者寻找一个方式去确定哪种 polyfill 是他们的库需要的,而不是直接载入他们:某种元数据 -- 将在创建最终构建包时注入 polyfill。 另一个针对 `useBuiltIns: usage` 的问题是重复的 polyfills 导入。`useBuiltIns: usage` 能够在每个文件中注入许多 `core-js` 的导入。但如果我们的项目有数千个文件或者即使十分之一会怎么样呢?这种情况下,与导入 `core-js` 自身相比,导入 `core-js/...` 将有更多代码行:我们需要一种方式去收集所有的导入到一个文件中,这样才能够删除重复的。 几乎每一个需要支持像 `IE11` 浏览器的 `@babel/preset-env` 用户都为每个浏览器使用同一个构建包。这意味着完全支持 ES2019 的现代浏览器将加载不必要的、仅仅是 IE11 需要的 polyfills。当然,我们可以为不同的浏览器创建不同的构建包来使用,例如,`type=module` / `nomodules` 属性:一个构建包给支持模块化的现代浏览器,另一个给传统浏览器。不幸的是,这不是针对这个问题的完整的解决方案:基于用户代理打包目标浏览器需要的 polyfill 的服务非常有用。我们已经有了一个 - [`polyfill-service`](https://github.com/Financial-Times/polyfill-service)。尽管很有趣也很流行,但是 polyfill 的质量还有很多不足。它不像几年前那么差:项目团队积极工作去改变它,但是如果你想用他们匹配原生实现,我不建议你通过这个项目使用 polyfill。许多年前我尝试通过这个项目将 `core-js` 作为 polyfill 的源,但是这不可能。因为 `polyfill-service` 依赖文件嵌套而不是模块化(就像 `core-js` 发布后的前几个月 😊)。 像这样一个集成了一个很棒的 polyfill 源 -- `core-js` 的服务,通过像 Babel 的 `useBuiltIns: usage` 选项,静态分析源代码真的能够引起我们对于 polyfill 思考方式的革命。 ### 来自 TC39 的新功能预案和 `core-js` 可能的问题 TC39 一直在努力工作去改进 ECMAScript:你可以通过查看 `core-js` 中实现所有新提案查看进度。然而,我认为有些新的提案功能在 polyfill 或者转译时可能引起严重的问题。关于这个足够可以写一篇新的文章,但是我将尝试在这总结一下我的想法。 #### 标准库提案,stage 1 现在,TC39 考虑给 ECMAScript 增加[内置模块](https://github.com/tc39/proposal-javascript-standard-library):一个模块化的标准库。它将成为 JavaScript 的最佳补充,而 `core-js` 是它可以被 polyfill 的最佳位置。根据 `@babel/preset-env` 和 `@babel/runtime` 用到的技术,理论上我们可以通过一种简单的方式注入内置模块需要的 polyfill。然而,这个提案的当前版本会导致一些严重问题,这些问题并没有使其简单明了。 内置模块的 polyfill,[根据作者的提案](https://github.com/tc39/proposal-javascript-standard-library/issues/2),仅仅意味着退回到分层 API 或者 导入 maps。这表明如果原生模块缺失,它将能够通过提供的 url 载入一个polyfill。这绝对不是 polyfill 需要的,并且它与 `core-js` 的架构以及其他流行的 polyfill 都不兼容。导入 maps 不应该是 polyfill 内置模块的唯一方式。 我们通过一个特定前缀使用 ES 模块语法就能够得到内置模块。这个语法在语言的早期版本并没有对等的 - 转译模块不可能在现在浏览器中与未转译的交互 - 这会导致包分发的问题。 更进一步讲,他将异步工作。对于功能检测这是个严重的问题 - 当你要检测一个功能并且加载 polyfill 时脚本不会等待 - 功能检测应该同步的做。 [在没有转译和 polyfill 的情况下第一次实现内置模块](https://developers.google.com/web/updates/2019/03/kv-storage)。如果没有修改,在当前的 `core-js` 格式下内置模块将不可能 polyfill。建议的 polyfill 方式将使开发变得严重复杂。 这个标准库的问题能够通过添加一个新的全局变量解决(这将是最后一个吗?):一个内置模块的注册表将允许异步的设置和获取,例如: ```js StandardLibraryRegistry.get(moduleName); StandardLibraryRegistry.set(moduleName, value); ``` 异步回调,比如分层API应该全局注册表之后使用。 值得一提的是,它将简化将本地模块导入到老的语法的转换。 #### 装饰器提案,新的迭代器语法,stage 2 这个提案中的 [新迭代器](https://github.com/tc39/proposal-decorators),他被很认真的重做了。装饰器定义不再是语法糖,就像内置模块,我们不能在老版本的语言中编写装饰器并将其用作原生装饰器。除此之外,装饰器不仅仅是普通的标识符 - 他们生活在平行的词汇范围内:这意味着已经编译的装饰器不能和原生装饰器交互。 提案作者建议使用未编译的装饰器发布包,让包的使用者选择去编译他们的依赖。然而,在不同的情况下是不可能的。当他们被添加到 JS 标准库时,这个方法将阻止 `core-js` polyfill 新的内置装饰器。 装饰器应该是在某些东西上应用功能的一种方法,他们应该仅仅是包裹的语法糖。为什么要复杂化呢? --- 如果引入的一个语言功能不是从根本上是新的,在语言的早期版本什么不应该实现是可以选择的,我们能够转译或者 polyfill 它,被转译或者 polyfill 的代码应该能够和支持这个功能的浏览器原生交互。 我希望根据提案作者和委员会的智慧,这些提案能够被采纳,这样才能够合理的转译或者 polyfill 他们。 --- 如果你对 `core-js` 项目感兴趣,或者你在你日常工作中使用它,你可以成为 [OpenCollective](https://opencollective.com/core-js#sponsor) 或者 [Patreon](https://www.patreon.com/zloirock) 捐赠者。`core-js` 的背后不是一个公司:他的将来要靠你。 --- [这里](https://github.com/zloirock/core-js/discussions/963) 可以评论这篇文章。 [Denis Pushkarev](https://github.com/zloirock),2019年3月19日,感谢 [Nicolò Ribaudo](https://github.com/nicolo-ribaudo) 编辑。 core-js-3.33.2/docs/zh_CN/2023-02-14-so-whats-next.md000066400000000000000000002167701451776221300212120ustar00rootroot00000000000000

core-js

# 那么,接下来是什么?(So, what's next?) ##### 翻译:卫剑钒 (微信公众号:man-mind) 嗨,我是(**[@zloirock](https://github.com/zloirock)**),一个全职开源开发者。我不喜欢写长帖子,但似乎是时候写了。 最初,这篇文章应该是一篇关于开发core-js最新主要版本和关于其路线图的帖子(它被移到了后半部分),然而,由于最近的事件,它变成了一篇关于许多不同事情的长篇帖子......我他妈的累了(I'm fucking tired)。自由和开源软件从根本上被玩坏了。我可以默默地停止做这件事,但我想给开源最后一次机会。
🔻 点击查看如何提供帮助 🔻 如果你或你的公司以这样或那样的方式使用`core-js`,并且你对你的供应链质量感兴趣,请支持这个项目: - [**Open Collective**](https://opencollective.com/core-js) - [**Patreon**](https://patreon.com/zloirock) - [**Boosty**](https://boosty.to/zloirock) - **Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz )** - [**支付宝**](https://user-images.githubusercontent.com/2213682/219464783-c17ad329-17ce-4795-82a7-f609493345ed.png) **如果你能在 Web 标准和开源方面提供一份好工作,请写信给我。**
## 什么是[`core-js`](https://github.com/zloirock/core-js)? - 它是JavaScript标准库中最受欢迎和最通用的polyfill,它支持最新的ECMAScript标准和提案,从古老的ES5功能到[iterator helpers](https://github.com/tc39/proposal-iterator-helpers))等前沿功能,以及与ECMAScript密切相关的Web平台功能,如structuredClone。 - 它是最复杂、最全面的polyfill项目。在发布这篇文章时,core-js包含大约5000个具有不同复杂程度的polyfill模块,从Object.hasOwn或Array.prototype.at到URL、Promise或Symbol,这些模块旨在协同工作。使用不同的架构,它们每个都可以是一个单独的包——虽然,可能有人并不喜欢这样。 - 它做到了最大程度的模块化——你可以轻松(甚至自动)选择仅加载你将使用的功能。它可以在不污染全局命名空间的情况下使用(有人称这种用例为“ponyfill”)。 - 它专为与工具集成而设计,并为此提供了所需的一切。例如,@babel/preset-env,@babel/transform-runtime,以及类似的SWC功能,这些都是基于core-js的。 - 它是开发人员多年来每天在开发过程中使用现代ECMAScript功能的主要原因之一,但大多数开发人员只是不知道他们之所以有这种可能性,是因为core-js,因为他们间接使用core-js,因为它是由他们的transpilers/框架/中间包(如babel-polyfill)提供的。 - 它不是一个框架或库,开发人员需要了解框架和库的API,定期查看文档,或者至少记住他或她正在使用它。而对于core-js而言,即便开发人员直接使用它——也只是一些导入行或配置中的一些行(在大多数情况下——会配置错误,因为几乎没有人阅读文档),之后,他们忘记了core-js,只是使用由core-js提供的Web标准的功能——但有时这是他们使用最多的JS标准库。 ##### 译者注:为了理解本文,读者需要知道`polyfill`的含义。polyfill是填充物的意思,是指在一种材料中填充另一种材料,比如用玻璃胶填充混凝土表面的裂缝,达到光滑平整的效果;再如填充在玩具或沙发中,让被填充物更温暖舒适。在JavaScript 语境中,polyfill意味着用于向旧版浏览器添加其并不支持的JavaScript 新版标准的功能。通常,polyfill 是一种 JavaScript 库或代码,它可以检测当前环境的功能支持,并在缺少的情况下提供相应的实现。 [core-js总共有90亿次NPM下载以及每月2.5亿次NPM下载](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-bundle&from=2014-11-18), GitHub上有1900万个仓库依赖它([global](https://github.com/zloirock/core-js/network/dependents?package_id=UGFja2FnZS00ODk5NjgyNDU%3D)和[pure](https://github.com/zloirock/core-js/network/dependents?package_id=UGFja2FnZS00MjYyOTI0Ng%3D%3D)),这是很大的数字,但并不能直观展示core-js的真正传播。让我们用其他方式查看一下。 我写了个[简单的脚本](https://github.com/zloirock/core-js/blob/master/scripts/usage/usage.mjs),通过Alexa顶级网站列表检查core-js的使用情况。我们可以知道core-js的应用情况(以及各网站所使用的版本)。

usage

在TOP 1000网站上运行这个脚本,**我检测到[52%](https://gist.github.com/zloirock/7ad972bba4b21596a4037ea2d87616f6)的测试网站对core-js的使用情况**。由于每天情况并不太一样(列表、网站等不是常数),结果可能会有百分之几的差异。然而,这只是使用现代浏览器对网站主页的粗略检测,很多使用并没有测出来,**如果手动检查,会发现使用量增加百分之几十**。例如,上面截图中某些网站没有被脚本发现使用了core-js,但去他们主页手工看一下就会发现他们也用了(`请耐心点`,在下面的一系列屏幕截图之后,就没有这么多图片了):

whatsapp

---

linkedin

---

netflix

---

qq

---

ebay

---

apple

---

fandom

---

pornhub

---

paypal

---

binance

---

spotify

**通过这样的手动检查,你可以在前100个网站的75-80%的网站上找到core-js**,而检测脚本只在55-60%的网站上找到它。当然,在较大的样本中,百分比会下降。 [Wappalyzer](https://www.wappalyzer.com/technologies/javascript-libraries/)使用浏览器插件检测一个网站使用的技术(包括core-js),在他们之前的统计数据中,能够看到很有趣的结果,但现在他们的网站上,所有最受欢迎的技术的公开结果,最多也就只显示500万之多。基于Wappalyzer结果的统计[数据](https://almanac.httparchive.org/en/2022/javascript#library-usage),在800万个移动页面和500万个桌面页面中,有41%和44%显示使用了core-js。[Built With显示前10000个网站中有54%使用了core-js](https://trends.builtwith.com/javascript/core-js)(我不确定其检测的完整性)。 无论如何,我们可以自信地说,**大多数热门网站都在使用core-js**。即使core-js没有在大公司的主要网站上使用,肯定也用在了他们的其他项目上。 还有什么JS库在网站更流行?不是[React](https://trends.builtwith.com/javascript/React)、[Lodash](https://trends.builtwith.com/javascript/lodash)或任何其他人们经常谈及的库或框架,我能确定的只有[“又老又好”的jQuery](https://trends.builtwith.com/javascript/jQuery)。 core-js不仅仅是在网站的前端——它几乎在所有使用JavaScript的地方——我认为这从来没有被认真统计过。

github

然而,由于上述原因,**[几乎没有人记得他或她使用了core-js](https://2022.stateofjs.com/en-US/other-tools)**。 我为什么要发表此文?不是为了展示我有多酷,而是为了展示一切有多糟糕。请继续读。 --- ## 让我们从一张流行的xkcd图片开始下一部分 [

xkcd

](https://xkcd.com/2347/) ##### 译者注:图片来自:https://xkcd.com/2347/ ### 缘起 2012年,我把我的开发栈切换到了全栈JavaScript。当时JavaScript仍然太原始——IE仍然比其他任何东西都更受欢迎,ES3时代的浏览器仍然占据了Web的主要部分,最新的NodeJS版本是0.7——它才刚刚开始。JavaScript 仍然不适用于编写严肃的应用程序,开发人员用 CoffeeScript 语言转译器,解决了JavaScript所缺乏的语法糖问题,用 Underscore 等解决了 Javascript 缺乏标准库的问题。 然而,他们并不是标准,随着时间的推移,这些语言和库连同使用它们的项目一起过时了。因此,我满怀希望地期待即将到来的ECMAScript Harmony 6标准。 旧 JavaScript 引擎仍然流行,用户并不着急,还没有什么机会放弃它们,即使新的 ECMAScript 标准有着快速和可靠的优点,想让 JavaScript 引擎支持这个新标准,也要等很多年。但可以使用一些工具尝试使用新标准,让转译器(这个词不像现在这么流行)和标准库来解决语法和 polyfill 的问题。当时,这些工具包才刚刚出现。 那时,ECMAScript 转译器开始流行并发展迅速。而与此同时,polyfill 几乎没有根据用户和实际项目的需求而发展。它们不是模块化的,并可能带来全局命名空间污染——它们不适合做库。它们不是单一复合体——而是需要用多个来自不同作者的不同的 polyfill 库,并以某种方式使它们工作在一起——在某些情况下,这几乎是不可能的。太多必要的基本语言功能都还没有实现。 为了解决这些问题,2012年底,我开始研究一个后来被称为core-js的项目,一开始仅仅是为了我自己的需要。为了让所有JS开发人员的生活更轻松,2014年11月,我开源发布了core-js。**也许这是我一生中最大的错误。** 由于我不是唯一一个面临这些问题的人,几个月后,core-js已经成为JavaScript标准库polyfill的事实标准。core-js被集成到Babel(当时叫`6to5`)中,它在core-js发布前几个月就出现了——上面谈及的一些问题也是该项目所致力解决的。core-js开始作为`6to5/polyfill`分发,后来更名为babel-polyfill。经过几个月的合作、品牌重塑和演化后,babel-runtime出现了,又几个月后,core-js被集成到其关键框架中。 ### 保障整个Web的兼容性 **我没有宣传自己,也没有宣传这个项目。这是第二个错误。** core-js没有网站或社交媒体帐户,只有GitHub。我没有在会议上谈论它。我几乎没有写任何关于它的帖子。我只是在制作一个非常有用的东西,并使之成为现代开发栈的一部分,对此我很高兴。我给了开发人员一个机会,让他们使用最现代和真正必要的JavaScript功能,而不需要等待多年(等它们在所有引擎中实现),并且无需考虑兼容性和错误。人们开始使用它,项目的传播呈指数级增长,很快,它已经在百分之几十的热门网站上使用。 ##### `译者注:注意,上面这段是作者最后悔的部分。` 然而,这只是所需工作的开始,之后跟随的是常年的辛勤工作。我几乎每天都花几个小时在core-js和相关项目(主要是Babel和[compat-table](https://kangax.github.io/compat-table/es2016plus/))的维护上。 ![github](https://user-images.githubusercontent.com/2213682/218516268-6ec765a5-50df-4d45-971f-3c3fc4aba7a1.png) core-js不是一个只有几十行代码的库,这种库你写完就可以忘掉它。与绝大多数库不同,它与Web的状态息息相关。它对JavaScript标准或提案的任何更改、任何JS引擎新发布、任何JS引擎中新的bug要做出反应。ECMAScript ~~6~~ 2015之后跟着的是新提案、新版本的ECMAScript、新的非ECMAScript Web标准、新引擎和新工具等。项目的演变、改进以及对Web当前状态的适配从未停止过——几乎所有这些工作,对普通用户来说,仍然是看不见的。 越来越多的工作需要我做。 长期以来,我试图以不同的方式为core-js找到维护者或至少是持续的贡献者,但所有尝试都失败了。几乎每个JS开发人员都间接使用core-js,他们知道babel-polyfill、babel-runtime,他们知道自己所用的框架里已经polyfill了所必需的功能,但几乎没有人知道core-js。在一些提到core-js的关于polyfill的帖子中,它被称为“`一个小库`”。这不是一个时髦的被广泛讨论的项目,如果它做得很好,为什么要帮助维护它呢?随着时间的推移,我失去了希望,但我觉得我对社区有责任,所以我被迫继续独自工作。 几年后,全职工作和`FOSS`(`译者注:FOSS即自由和开放源码软件`)几乎变得不可能——没有人愿意为你在工作时间致力于FOSS而付钱,仅仅用非工作时间是不够的,有时,core-js需要完全沉浸式的开发,而且是几周的时间。我认为社区需要适当的polyfill,而钱并不是我的第一任务。 我辞去了一份高薪工作,并且拒绝了一些非常好的职位选择,因为在这些职位上,我不能投入足够的时间从事开源。我开始全职从事开源工作,没有人给我付钱。我希望或早或晚,我能找到一份可以完全致力于开源和Web标准的工作。我定期通过短期合同赚取在FOSS上生活和工作所需的钱。我回到了俄罗斯,在那里可以用相对较少的钱获得体面的生活水准。**我又犯了一个错——正如你将在下面看到的,钱其实很重要。** --- 直到2019年4月,大约一年半时间,我没有分心干任何别的,我把所有时间都致力于core-js@3,[并从根本上改进了Babel的polyfill工具](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md),这是工具集(toolkit)生成的基础,现在几乎到处都在使用。 ## 事故 坏事发生在core-js@3发布3周后。一个四月的晚上,凌晨3点,我开车回家。两个穿着深色衣服的醉酒的18岁女孩决定以**爬**的方式穿过一条光线很差的高速公路——其中一个躺在路上,另一个坐着并拽着第一个,她们并不在人行道上——而是直接在我的车轮下。目击者就是这么说的。我绝对没有机会看到他们。还有一名目击者说,在事故发生之前,她们只是在路上开玩笑地打闹。这并没什么不寻常,这是俄罗斯。其中一个女孩死了,另一个女孩进了医院。然而,即使在这种情况下,根据俄罗斯的仲裁惯例,如果司机不是议员或类似什么人的儿子,他几乎总是被判有罪——他必须要看到并预测一切,行人不负任何责任。我可能会在监狱里呆很长时间,如果我没有记错,检察官要求判我7年。 不入狱的唯一方法是与“受害者”和解——这是此类事故后的标准做法——并且还要有一名好律师。在事故发生后的几周内,我收到了“受害者”亲属当时以汇率计算的总额约为8万美元的资金索赔。律师也需要一大笔钱。 对于一个好的软件工程师来说,也许这不是一笔不可思议的钱,但是,正如我上面所写的,我长期全职在core-js@3版本上工作。没有人为这项工作付钱给我,我之前就已经花尽了所有的财务储备,所以,我没有那么多钱,也没有办法找到所需的钱。我的时间不多了。 ## 筹钱 那时,core-js的使用几乎和现在一样广泛。正如我上面所写,我为core-js寻找了很长时间的贡献者,但没有任何成功。然而,core-js是一个应该积极维护的项目,它不能一直冻结。我的长期监禁不仅会给我带来问题——而且也会给core-js带来死亡,给每个使用它的人带来问题——有一半的Web都在用它。考虑一下令人头疼的[公交车因素](https://en.wikipedia.org/wiki/Bus_factor)。 ##### 译者注:`公交车因素`是指这样的问题:一个项目里的关键人员如果突然被公交车撞了,项目会怎么样? 在事件发生几个月前,我开始筹集资金来支持core-js开发(主要发布在GitHub的README中和NPM上)。结果是......57美元/月。这就是全职工作以确保整个Web兼容性的“合理回报”。 于是我决定做一个小实验——向core-js用户寻求帮助——如果没人维护core-js,他们将首先遭受痛苦。我在core-js安装后添加了一条消息: ![postinstall](https://user-images.githubusercontent.com/2213682/153024428-28b8102c-ce08-461c-af99-d0417dc7d2cd.png) ##### 译者注:上面这段提示主要是向用户请求资金捐助,给出了两个捐助网站,并在最后一句说:“core-js的作者正在找一个好工作。” 我知道我无法从捐款中获得所需的钱,但是,每一美元都很重要。我添加了一条求职消息,以便有机会获得捐赠之外的钱。我想,NPM安装日志中的几行帮助请求(如果需要,可以隐藏)是可以接受的。我最初想的是在几周内删除这条消息,但一切都偏离了计划。**我对人的看法是有多错......** ### 恨 当然,我知道有人不希望在他们的控制台中看到帮助请求,但我收到的恨意简直淹没了我的房顶,每天有数百条消息、帖子和评论,都在表达他们的恨意。所有这些都可以简化为:

get-rid

##### 译者注:标题翻译:让这个SB zloirock和他的core-js库去死吧 这远远不是我所见过的最搞笑的事——如果我愿意,我能收集到[大量这种风格的“恨开源”评论](https://github.com/samdark/opensource-hate)——但我不会这样,我的生活中已经足够多负面东西了。 **开发人员喜欢使用免费的开源软件——免费,效果好。他们对背后数千小时的开发不感兴趣,他们对项目背后那个真人的问题和需求不感兴趣。他们认为,提及这些就是对他们个人空间的侵犯,甚至是对他们个人的冒犯。对他们来说,这些开源项目,就是一些齿轮,应该自动耦合,不应该有任何噪音,也不应该要他们参与。** 因此,成千上万的开发人员侮辱我,并声称我无权向他们寻求任何形式的帮助。我的帮助请求如此冒犯了他们,以至于他们开始要求限制我对仓库和包的访问,并要求将它们转移到其他人那里,就像曾经对[left-pad](https://arstechnica.com/information-technology/2016/03/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet/)那样。他们中几乎没有人了解core-js的作用和规模,当然,也没有人想维护它——它应该由“社区”和其他人来维护。我看到所有这些仇恨,为了不被他们影响,我没有删除安装包的请求帮助信息,本来我只想让它存在几周。 **求助于那些用core-js赚大钱的大公司?那可几乎是每家大公司。让我们稍微改一下这条[旧推文](https://twitter.com/AdamRackis/status/931195056479965185):** > 公司:“我们想使用SQL Server 企业版” > MS:“这需要25万美元+2万美元/月” > 公司:“好的!” > ... > 公司:“我们想使用core-js” > core-js:“简单,执行npm i core-js 就可以了” > 公司:“酷!” > core-js:“你想在经济上做出贡献吗?” > 公司:“哈哈,不” ##### 译者注:这条旧推文是@AdamRackis于2017年11月17日发布的,里面原先写的是Babel,在此文中改为core-js 几个月后,厌倦了用户的投诉,NPM推出了[npm fund](https://docs.npmjs.com/cli/v6/commands/npm-fund)——这不是解决问题的办法,这只是摆脱这些投诉的一种方式。你多久会敲一下npm fund?你多久会向npm fund中的人捐款?你会先看到谁并支持他?是core-js还是维护着十几个单行库(并且相互依赖)的人?npm fund为NPM的未来步骤提供了完美的理由(请往下阅读)。 在9个月内,数千名开发人员,包括重度依赖core-js的项目开发人员,了解了我的状况——但没有人提出要维护core-js。几个月内,我与一些依赖core-js的重要项目的维护人员进行了交谈,但没有取得任何成功——他们没有必要的时间资源。因此,我不得不要求一些与FOSS社区无关的朋友(起初是[@slowcheetah](https://github.com/slowcheetah),感谢他的帮助)替代我,至少尝试解决那些比较重大的issue,在我重获自由之前。 --- 有个别用户和小公司支持了core-js——我非常感谢他们。然而,9个月内筹集的资金仅为所需资金的1/4左右,你们知道,我需要8万美元解决困境,而且应该是在几周之内。 就在这段时间,不管怎么样,每天core-js的下载量几乎翻了一番。 2020年1月,我进了监狱。 ### 出狱 我不想说太多关于监狱的事,我也不想记住那些。那是在一家化工厂的奴隶般劳动,在那里我的健康严重受损,我24/7和毒贩、小偷和杀手们在一起,共渡了难忘的时光,而且,还无法访问互联网和计算机。 大约10个月后,我被提前释放了。 --- 我看到了数十篇文章、数百篇帖子和数千条评论,其中许多评论的本质,大概就是这样的:

reddit

##### 译者注:上面这段话的翻译:这家伙是个大混蛋。他绝对是我在 Github 上遇到的最糟糕的维护者,无人能及。不知道他因什么进了监狱,但我很高兴看到他离开这里。 他们到底认为我做错了什么?是的,我犯了上面所说错。我看到一些人支持开发core-js,看到许多issue,问题和消息——但比那些恶评要少。与此同时,core-js变得更受欢迎,已经达到了和现在一样的使用比例。 ### 继续,保障整个Web的兼容性 出狱后,我像以前一样回到了core-js维护。而且,我完全不再被合同和任何其他工作分散注意力,我只是在core-js上工作。core-js在融资平台上有一些钱——虽然不多,比我全职从事core-js之前收到的少很多倍——但对我来说,这足以维持生活。**这是一种降级。我全职开源,为了让世界变得更美好......**我不考虑事故遗留下来的数万美元的诉讼,我也不考虑我的未来,我只是想Web有更美好的未来。当然,我希望一些公司能给我提供一个职位,让我有机会从事Web标准工作,并赞助我在polyfill和FOSS方面的工作。 在接下来的两年里,[我在core-js工作方面取得了很多成就](https://github.com/zloirock/core-js/compare/0943d43e98aca9ea7b23cdd23ab8b7f3901d04f1...master),几乎和前8年一样多。仍然是core-js@3——但要好得多。然而,changelog以及之前的diff只反映了一小部分已完成的工作。**几乎所有的工作都在暗处,普通用户看不到。** 这些工作包括JS标准和建议方面的基本工作,作为它的连带后果,考虑到我的辛勤工作,以及我反馈和建议后的变化,我认为一些ECMAScript提案——许多已成为语言一部分——是我的成就,也是提案拥护者的成就;这些工作包括core-js和引擎及其错误跟踪器的调错工作;这些工作包括在数百乃至数千个环境中持续自动或手动/构建/测试以确保标准库在任何地方的正常运行并收集兼容数据。core-js兼容数据,从一开始仅仅是几天内制作的原型,变成了一个具有外部和内部工具的详尽数据集;这些工作包括对项目中正在开发的许多功能的设计和原型制作;这些工作还有更多,更多。 --- 如上所述,core-js存在于大多数流行的网站中,它提供了一个几乎完整的JavaScript标准库,并修复了不正确的实现。使用core-js打开的网页多于Safari和Firefox打开的网页。因此,从某种角度来看,core-js可以被称为最受欢迎的JavaScript运行时之一。 在开发core-js时,我是几乎所有现代和未来JavaScript标准库功能的第一个实现者,几乎所有功能都有我的反馈,并根据这些功能进行了修复。core-js是实验ECMAScript提案的最佳场地。在非常多的情况下,提案收到的反馈,都是用户在尝试了提案的实验性core-js之后提交的。 JavaScript的最佳前进方式是TC39和core-js的合作。TC39邀请Babel等项目的成员担任专家,却不找我。我经常看到TC39成员忽视我或core-js,甚至故意制造障碍,他们甚至毫不避讳这点: ##### 译者注:TC39则是ECMA为ES专门组织的技术委员会(Technical Committee),39这个数字用来标记旗下的技术委员会。TC39的成员由各个主流浏览器厂商的代表构成。

shu

##### 上图文字翻译:真正的困难是我现在拒绝与core-js的作者接触 ---

lj

##### 上图文字翻译:polyfill从来没有也从来不会决定提案如何运作,所以我不知道为什么这个问题一直被提起。 --- 一段时间后,NPM表达了它的“支持”。在2020年底发布的npm@7中,作为npm fund的逻辑延续,控制台禁用了安装后脚本(post-install scripts)的输出。结果是可以预期的,人们不再能看到资金请求,同时,几乎没有人使用npm fund,所以core-js赞助者的数量开始下降。NPM可真够“支持”我的,它不仅通过分发我的作品来赚钱,而且它自己也在用core-js :-)

npm

##### 译者注:这张图表明了NPM网站也在用core-js 此外,另一个因素也在发挥作用。“`质量越高,支持越少`”,这个库维护得很好吗?几乎没有什么处于打开状态的错误报告吧?当有错误时,会立即得到修复吗?这库给了我们几乎所有想要的东西了吧?是吧?那么,我们为什么要支持这个库的维护呢?支持维护者的成本不会停留在表面——对于大多数开发人员和公司来说,它仍然只是“`一个小库`”。许多以前还赞助core-js的人,后来都停止了。 core-js代码包含我的版权。正如你在这篇文章前面看到的,core-js出现在大约一半的网站上。经常性地,有人在有害网站或应用的源代码中发现它——他们不知道什么是core-js,他们的技术水平甚至不足以发现它。当这种情况发生时,警察会打电话威胁我,甚至有人试图勒索我。大多数时候,这一点都不好笑。 美国和加拿大记者多次联系我,因为他们在美国新闻和政府网站上发现了core-js。当他们弄明白的时候,他们非常失望,失望于我不是一个干涉美国选举的邪恶的俄罗斯黑客。 无休止的仇恨流随着时间的推移略有减少,但仍然有。大部分内容从GitHub issues或Twitter Threads转移到我的邮件或IM。今天,一位开发人员给我写了一条消息,他称我是开发人员社区的寄生虫,说我的core-js到处蔓延传播,没有一点屁用,但却赚了很多钱。他称我和[Hans Reiser](https://en.wikipedia.org/wiki/Hans_Reiser)是同样的杀人犯,买通了法官,逃脱了惩罚。他希望我和我所有的亲戚都死。这没有什么不寻常的,我每个月都会收到几条这样的消息。去年,又补充了一种,说我是一个“俄罗斯法西斯主义者”。 ### 关于战争说几句 **开源应该脱离政治。** 我不想在两种邪恶之间做出选择。我不会对此发表更详细的评论,边境两边都有我身边的人,他们可能会因此而受罪。 让我提醒你我上面写过的内容:我回到了俄罗斯,因为在那里,可以用相对较少的钱获得体面的生活水平,并专注于FOSS,而不是赚钱。现在我不能离开俄罗斯,因为在事故发生后,我有数万美元的未决诉讼,在还清它们之前,我被禁止离开这个国家。 ### 你猜猜core-js每个月能收到多少钱? 当我开始全职维护core-js时,没有被合同和任何其他工作分心,**我每月收到的钱大约为2500美元——比我通常的全职工作少4~5倍。**记住,这是一种降级,为了让Web变得更好,为了让issues和bugs减少到零,为了制作最高质量的产品,这可是几乎每个人都在用的东西......项目将得到足够多的赞助,对吧?对吧? 几个月后,每月收入**下降到约1700美元**(至少我觉得是这么多),通过Tidelift是1000美元,通过Open Collective是600美元,通过Patreon是100美元。除了订阅式的每月捐款,还会有一些一次性捐款(平均每月可能为100美元)。 Crypto?通过加密钱包请求捐款是很流行的。然而,一直以来,加密钱包上只收到了2笔总额约为200美元的转账,最后一次是在一年多前。GitHub赞助商?它在俄罗斯不可用,所以从来没有过。PayPal?这是禁止俄罗斯人使用的,当它可用时,core-js在这段时间里收到了大约60美元。补助金?我申请了很多补助金——所有申请都被忽略了。 **在这些捐赠中,[Bower](https://bower.io/)作为另一个FOSS社区,提供了主要部分:每月400美元。我也非常感谢[所有其他赞助商](https://opencollective.com/core-js#section-contributors):由于您的捐款,我仍在为这个项目工作。** 然而,在这个列表中,没有一家大公司,或者至少没有一家是前1000名网站列表中的公司。老实说,目前支持者名单上主要是个人,少数是小公司,他们每月支付几美元。 如果有人说他们不知道core-js需要资金......拜托,我经常看到[这样的表情包](https://www.reddit.com/r/ProgrammerHumor/comments/fbfb2o/thank_you_for_using_corejs/):

sanders

#####译者注:此图来自reddit网站的r/ programmerHumor版块,用来讽刺作者在core-js安装后请求捐款。 --- 一年前,Tidelift不再给我寄钱了。他们说,由于政治局势,他们使用的Hyperwallet不再供俄罗斯人使用(但上个月我试图更新一些个人数据时,它又可以使用了),为了安全起见,他们会把我的钱存放在他们那边。在过去的几个月里,我试图把这笔钱存入银行或Hyperwallet账户,但收到回复说,他们会尝试做些事情(听起来很棒,不是吗?)。去年年底以来,他们干脆停止回复电子邮件。现在,我只有这个: ![tidelift](https://user-images.githubusercontent.com/2213682/217650273-548d123d-4ee4-4beb-ad5b-631c55e612a6.png) ##### 信件主要内容翻译:Denis你好,对于延误回复深表歉意。不幸的是,如果您在Hyperwallet中的账户被冻结,我们将无法向您付款,因此我们将终止您和我们之间的协议并立即生效。如果您能够解冻您的Hyperwallet帐户,请告诉我们,我们可以重新建立关系。(这是Tidelift给core-js作者Denis的邮件) **Tidelift以如此有趣的方式,让我知道我的收入减少了,今年我的工作收入不是每月1800美元,而是每月800美元。**当然,没有对后续电子邮件的回复。然而,他们的网站显示,我仍然在收到钱。

tidelift

##### 译者注:从截图中可以看出,同样地,Tidelift网站也使用了core-js 我想知道,通过这个网站支持其供应链的公司,对这种骗局将如何反应。 --- 同一天,在OpenCollective上,我看到每月订阅的捐赠从大约600美元减少到大约300美元。显然,Bower的财务储备已经耗尽了。**`这意味着这个月我总共会得到大约400美元。`** 在之前的几个月里,我测量了在core-js上工作需要多少时间。结果大约是......**每月250小时**——远远超过连休息日都没有的全职工作的时长,这使得我不可能有“真正的”全职工作或者为任何合同工作。250小时400美元......**每小时工作的报酬不到2美元,前一年多一点:每小时4美元。**是的,几个月来,我确实花了更少的时间在这个项目上,但没有太大变化。 这就是确保整个Web兼容性的当前价格。加上没有保险或社会保障。 **收入增长和职业发展都很棒,对吧?** ##### 译者注:注意在本文中,denis经常使用反讽手法。 我想你很了解主要IT公司的高级软件工程师的报酬是多少。我收到了许多类似的报价,然而,它们与core-js的正确工作不兼容。 在经常受到的威胁、指责、命令和侮辱中,我经常会得到类似“停止乞讨,去工作,你这个懒惰的人。立即删除你的乞讨信息——我不想看到它们。”有趣的是,至少其中一些人每年获得超过30万美元(我很确信这点,因为我与他们的同事交谈过),而(由于他们的工作性质)core-js每月为他们节省了许多小时的工作。 ### 一切都改变了 当我开始研究core-js时,我独自一人。现在我有一个家庭了。一年多前,我成了我儿子的父亲。现在我必须为他提供体面的生活水平。 ![son](https://user-images.githubusercontent.com/2213682/208297825-7f98a8e2-088e-47d3-95a6-a853077296b3.png) 我有一个妻子,有时她想要一双新鞋,或一个包,或一个新的iPhone,或一个Apple Watch。我的父母已经到了需要我有力支持他们的年龄。 很明显,我不可能用我从core-js维护中获得的钱来正常地支持一个家庭,我的财政状况走到头了。 我越来越经常听到这样的责备:“放弃你的开源,你这是纵容自己,请回到正常的工作。谁谁谁只做了一年程序员,他对开源几乎一无所知,他每天只工作几个小时,已经赚的是你的好几倍。” # 没有了 我他妈的累了(I'm damn tired. )。我喜欢开源和core-js。但我这样做是为了谁,为了什么?让我们总结一下上述内容。 - 自2014年以来,我一直在确保零兼容性问题,我为Web世界提供web平台的前沿功能;我大部分时间都在为此而工作,而我所赚的钱甚至不足以购买食物。 - 我看不到任何感激之情,而是来自开发人员的巨大仇恨,我可简化了他们的生活啊。 - 通过使用core-js而节省并赚取数百万美元的公司,所做的只是忽略core-js的资金请求。 - 即便在我危急的情况下,在面对我的请求时,他们中的大多数,不是帮助,而是忽视或憎恨。 - 那些标准开发人员和浏览器开发人员,不是和我合作以共同致力于JavaScript的美好未来,而是给我设置障碍,逼得我和他们斗争。 --- 恨我的人,我并不在乎。如果我在乎,我早就离开开源了。 我可以容忍与标准开发人员缺乏正常的互动。这意味着用户将来会遇到问题,而且,当 Web 崩溃时,标准开发人员自己也会遇到问题。 **不管怎样,钱很重要。**我已经受够了以牺牲我和家人的福祉为代价而资助公司。我应该有能力确保我的家人、我的儿子有一个光明的未来。 core-js的工作几乎占据了我所有的时间,超过了全职工作日的时间。这项工作确保了大多数热门网站的正常运行,这项工作应该得到适当的报酬。我不会继续免费工作,也不会以每小时2美元的价格工作。我愿意继续以每小时至少80美元的价格为项目工作。[这正是eslint团队成员的收费标准](https://eslint.org/blog/2022/02/paying-contributors-sponsoring-projects/#paying-team-members-per-hour)。如果开源工作需要,我准备还清我的诉讼并离开俄罗斯——虽然,这并不便宜。 --- 我经常看到这样的评论:

core-js approach

##### 图片内容翻译:Zach Leatherman说:“认真想想这个:如果有人试图勒索开源怎么办:‘这个项目需要每月____美元的捐款,否则将停止维护,没有更新,没有bug修复或安全补丁。这是个很好的项目——如果它发生了什么事,那真是太遗憾了。’”Matt Mink说:“听起来core-js就是这么干的。” 好的,伙计们,如果你们想要这个——我就给你这个。 --- **根据你们的反馈,core-js将很快实施以下方式之一:** - **给我适当的资金支持** 我希望,至少在阅读了这篇文章后,大企业、小公司和开发人员会考虑其开发栈的可持续性,并适当地支持core-js开发。在这种情况下,core-js将得到适当的维护,我将能够专注于添加新的功能。 我现在的工作规模已经达到了顶峰,我一个人已经不能支撑了——我在体力上已经不能继续。一些工作,比如改善测试覆盖范围或文档,这不难,但需要很多时间,这不是志愿者想做的那种工作——我不记得有任何PR是关于改进现有功能的测试覆盖范围的。因此,在付费的基础上吸引至少一两个开发人员(至少是学生,当然最好有更高水平)是有意义的。 考虑到其他维护人员的参与和其他费用,我认为目前每月大约3万美元就足够了。更多的钱,就会有更好的产品、更快的开发、更少的时间。我一个全职工作在core-js上当然可以,但不像团队那样有成效。 - **我被一家公司雇用,在那里我将能够从事开源和Web标准的工作** 这将给我继续工作所需的资源。 - **core-js将会成为一个商业项目,如果得不到适当的用户支持** 以当前的core-js包创建商业模式是有问题的,因此新的core-js版本很可能会改变许可证。免费版本的功能将受到限制,所有额外的功能都将付费。core-js将继续发展,在该项目范围内,将创建许多新工具以确保Web兼容性。当然,这将大大减少core-js的传播,并将给许多开发人员带来问题,然而,即使是一些付费客户也足够了,我的家人将有钱支付账单。 - **core-js缓慢的死亡,如果你们并不需要它** 我对商业项目有很多想法,我有很多好的工作机会——所有这些都需要时间,而我把时间都给了core-js维护。这并不意味着我会立即完全停止维护core-js,我只会按捐款金额的多少,来决定我干多少。如果它们处于当前水平,那我每月只会干几个小时,而不是像现在这样数投入百个小时。该项目将停止增长——也许小错误将被修复,兼容性数据将被更新——但不会更多了。一段时间后,core-js将变得毫无用处,并会死亡。 **我仍然希望是第一种结果,因为core-js是现代数字基础设施的关键组成部分之一,但看看现在和过去,我正在为其他选择做准备。** ## 我提前回答一些我经常看到的愤怒的评论,这些评论肯定会在这篇文章之后出现: - **没问题,我们会固定依赖core-js的某个版本(pin the core-js dependency)。** 与大多数项目不同,core-js应该保持跟上最新前沿(bleeding edge),最新的core-js能让你使用最新的JavaScript技术,而不用考虑引擎的兼容性和错误。你可以固定在某个core-js版本,也许头一年或两年,你不会遇到严重的问题。之后,问题就出现了——你用的polyfill会变得过时,但仍然存在于你的捆绑包中,变成一个无用的压舱石。你将无法使用JS语言的新功能,并将在JS引擎中面对新错误。 - **这是开源的,我们将分叉(fork)它,滚开。** 我经常看到这样的评论,有人甚至试图用分叉吓唬我。我已经说过太多次了,**如果有人能分叉并正确维护core-js,我会很高兴**——在没有人维护的情况下,分叉有什么意义呢。现在我根本没有看到任何人试图为core-js添加一些重要的东西,或者至少定期做出贡献。项目应该跟进每个新的JavaScript引擎版本,更新兼容性数据,修复或至少考虑每个引擎的每个新错误(无论多大的错误),查看并实现每个可能的新的JavaScript功能,最大限度地正确执行,测试并考虑每个现代引擎或老引擎的每个版本的具体细节。这是一项艰苦的工作,你准备好了吗,并且有所需的知识和时间吗?举个例子,当我在监狱里时,Babel说他们搞不定:

babel

##### 图片文字翻译:nicolo-ribaudo在2020年3月15日说:“我是Babel的维护者,我们大概率不会fork core-js,因为我们没有足够的资源维护它。” - **我们不需要core-js,有许多替代项目可用。** 我没有抱着你不放。你说的替代品在哪里?当然,core-js不是JavaScript标准库的唯一polyfill,但所有其他项目的使用率都比core-js少[几十](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=es6-shim&from=2014-11-18)[倍](https://user-images.githubusercontent.com/2213682/205467964-2dfcce78-5cdf-4f4f-b0d6-e37c02e1bf01.png),这并不奇怪——所有这些项目都只提供了core-js功能的一小部分,它们不够合适和复杂,它们可使用的场景非常有限,它们不能以如此简单的方式正确集成到你的项目中,并且还存在很多严重问题。如果真的有合适的替代品,我早就停止在core-js上工作了。 - **我们可以放弃IE支持,所以我们不再需要polyfill。** 正如我在上面写的那样,我没有抱着你。在某些情况下,真的不需要polyfill,你可以不用它们,但IE只是一小部分问题——即便在IE时代也是这样。当然,你不用IE的话,polyfill不会给你带来在IE8中支持ES6这样的功能。但即使是最现代的引擎,也没有实现最现代的JavaScript功能。即使是最现代的引擎,也有错误。你确定你和你的团队完全了解你们应用所支持的所有引擎的所有限制,并且可以绕过它们吗?我有时都会忘记一些很怪的地方和缺失的特性。 - **你是个混蛋,我们会把你从FOSS社区中开除。** 是的,你是对的。我真是个混蛋,让你有机会在现实生活中使用现代JavaScript功能,我这个混蛋多年来一直在解决你的跨引擎兼容性问题,并且比任何人都为此做出了更多的牺牲。我真是个混蛋,只想让他的儿子吃饱,只希望他的家人有足够的钱来支付账单,我这个混蛋的家人不应该需要任何东西。上面我说的,可能真的会让我离开FOSS而拥抱商业,让我们拭目以待吧。 --- 现在,让我们从负面因素转到这篇文章的后半部分,我们将讨论如何让core-js做的更好以及polyfill的一般性问题。 # 路线图 JavaScript、浏览器和Web开发正在以惊人的速度发展。所有浏览器需要所有core-js模块的时代已经一去不复返了。最新的浏览器具有良好的标准支持,在常见的用例中,它们只需要一定比例的core-js模块来提供最新的语言功能和错误修复。一些公司已经放弃了对最近再次“埋葬”的IE11的支持。然而,即使没有IE,旧浏览器也会一直存在,现代浏览器中也会发生错误,新的语言功能将定期出现,无论如何,它们都会延迟出现在浏览器中;因此,如果我们想在开发中使用现代JS并尽量减少可能的问题,polyfill会长期留在我们身边,它们应该继续发展。 在这里,我将(几乎)不写任何关于添加新的或改进现有特定polyfill的内容(当然,这是core-js开发的主要部分之一),让我们谈谈其他一些关键事情,而不关注小事。如果决定将core-js做成商业项目,路线图是应该讨论的。 我正试图保持core-js尽可能紧凑,它应该遵循的主要原则是在现代Web中发挥最大作用——客户端不应加载任何不必要的polyfill,polyfill应该最大限度地紧凑和优化。当前,最大的core-js(针对早期提案)捆绑大小[约为220KB缩小,压缩后70KB](https://bundlephobia.com/package/core-js)——它不是一个小包,它挺大——它就像jQuery、LoDash、Axios加起来一样大——原因是该包几乎涵盖了该语言的整个标准库。core-js每个组件的大小比同类可用替代品的大小少若干倍。你可以只加载所使用的core-js功能,在最小情况下,捆绑大小可以减少到几K;正确使用时,通常是几十K——然而,还有一些东西需要考虑,[大多数页面包含比整个core-js捆绑包更大的图片](https://almanac.httparchive.org/en/2022/media#bytesizes),大多数用户的互联网速度为几十Mbps,那么为什么还要这么关注core-js的大小? 我不想详细重复关于[“JavaScript的成本”](https://medium.com/dev-channel/the-cost-of-javascript-84009f51e99e)这种旧帖子,在那里你可以阅读为什么添加JS会增加用户开始与页面交互的时间,而不是添加类似大小的图片——它不仅是下载,它还解析、编译、评估脚本,它阻止了页面渲染。 在太多地方,移动互联网并不完美,它们还停留3G甚至2G。在3G的情况下,下载一个完整的core-js可能需要几秒钟。然而,页面经常包含多个core-js和许多其他重复的polyfill。一些(主要是移动互联网)互联网提供商的“无限”数据套餐非常有限,用户用了几G字节之后,网速就会降到几Kbps。连接速度还受很多其他因素受限。 页面加载速度就等于收入。

conversion

> 插图来自谷歌[随机搜索的一个帖子](https://medium.com/@vikigreen/impact-of-slow-page-load-time-on-website-performance-40d5c9ce568a) 由于polyfill的新增或改进,core-js的大小不断增长。这也是一些大型polyfill所遇到的问题,在core-js中添加Intl、Temporal和其他一些功能,捆绑的大小将增加十几倍,达到几兆字节。 core-js的杀手级功能之一是,它可以通过使用Babel、SWC或手动方式进行优化,虽然,现在的方法只能解决部分问题。为了正确解决这些问题,现代Web需要新一代的工具包,该工具包可以简单地集成到当前的开发堆栈中。在某些情况下,正如你将在下面看到的,这个工具包可以帮助使你的网页变得甚至比没有core-js更小。 我已经在[“**关于core-js@3、Babel和对未来的展望**”](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#look-into-the-future)中写了其中一些内容,但这些只是原始的想法。现在他们正处于实验甚至实施阶段。 由于该项目的未来不确定,在这里写下任何具体日期是没有意义的,我不保证所有这些都会很快完成,但这值得我们努力去做。 --- ### 新的主版本(major version) core-js@3大约4年前发布——已经很久了。对我来说,添加一些突破性更改并将新版本标记为major版本并不是一个大问题(相比之下,确保向后兼容则是一个挑战)——但这对用户来说是个大问题。 目前,大约25%的core-js下载是严重过时的core-js@2。许多用户想将其更新到core-js@3,但由于他们的依赖项使用core-js@2,他们仍然使用过时的版本来避免多个副本(我在GitHub上看到了太多项目有此类问题)。太频繁的重大更新将使此类情况更加恶化。 然而,最好不要痴迷于与旧版本的兼容性。core-js包含太多没有删掉的东西,仅仅是出于保持兼容性。**而缺乏一些长期需要的突破性变化将对未来产生负面影响。**从标准、生态系统和Web的变化以及遗留物(legacy)的积累情况来看,最好每2-3年发布一个新的major版本。 如果需要好几年的开发,才能出来一个新版本让大家看到他们想要的一切,这对用户是不可接受的。core-js遵循[SemVer](https://semver.org/),首先发布一个新的major版本,内含一些突破性变化(部分叙述如下),大多数新功能在minor版本中添加。在这种情况下,新版本可能需要大约2-3个月的全职工作,它会比上一个版本小,这将是core-js第一次变小 :-) ### 关于core-js包 ### 放弃严重过时的引擎支持 IE死了。然而,还有人用——出于许多不同的原因,有人仍然被迫制作或维护在IE中工作的网站,core.js是让他们生活更轻松的主要工具之一。 现在,core-js试图支持所有可能的引擎和平台,甚至ES3和IE8-(译者注:IE8-代表IE8及更早的版本)。但只有一小部分使用core-js的开发人员需要这个,IE8-浏览器的占有率约为0.1%。对于更多其他用户来说,继续支持IE8-就意味着——更大的捆绑和更慢的执行。 主要问题来自对ES3引擎的支持:大多数现代ES功能都基于ES5,而ES5在旧引擎中不可用。一些功能(如getter/setter)不能被polyfill,因此一些polyfill(如类型数组)根本无法在IE8-中工作。另一些功能需要很复杂的变通办法。真正可以polyfill的只是一些简单的功能,捆绑包中core-js大小的主要部分是ES5方法的实现(在polyfill的大量功能中,它只占百分之几,所以这个问题与精简捆绑包有关)。 即便简单地将ES5功能的fallback替换为直接使用原生功能,也会将core-js捆绑的大小减少2倍以上。重新设计架构后,它将进一步减少。 IE9-10浏览器的占比也很小了——目前,同样的0.1%。但是,如果core-js还在支持其他一些过时的浏览器,考虑放弃对IE9-10的支持是没有意义的,他们的问题和限制是类似的,甚至前者还更多。例如Android 4.4.4——总共占比约为1%。将标准提高到ES5之上是一个困难的决定,因为还要对一些非浏览器引擎提供支持。然而,即使将来放弃对IE11支持,也不会像现在放弃IE8-带来那么多好处。 ### ECMAScript模块和现代语法 目前,core-js使用CommonJS模块。长期以来,这是最受欢迎的JavaScript模块格式,但现在ECMAScript提供了自己的模块格式,它已经非常受欢迎,几乎在任何地方都支持。例如,Deno,像浏览器一样,它不支持CommonJS,但支持ES。core-js应该在不久的将来有一个ECMAScript模块版本。但是,ECMAScript模块仅在NodeJS的现代版本中受支持,core-js 应该可以在较老的NodeJS版本中工作,而无需转译或打包。[Electron仍然不支持它](https://github.com/electron/electron/issues/21457),因此现在立刻干掉core-js的CommonJS版本是有问题的。 现代语法的其他方面并不那么明显。目前,core-js使用ES3语法。最初,这是为了最大程度优化,因为它无论如何都应该预先转译为旧语法。但这只是最初的情况,现在,core-js 库无法在用户环境中正确转译,并且在转译器配置中应该被忽略。为什么?让我们以Babel转换为例看看: - 转换的很大一部分依赖于现代的内置,例如,使用@@iterator协议的转换——但Symbol.iterator、迭代器和所有其他相关内置都是在core-js中实现的,在core-js加载之前不存在。 - 另一个问题是使用注入core-js polyfill的方式转译core-js。显然,我们无法将polyfill注入到它们实现的地方,因为这会导致循环依赖。 - 对core-js的一些其他转换会破坏其内部结构 - 例如,[typeof的转换](https://babeljs.io/docs/en/babel-plugin-transform-typeof-symbol)(将有助于支持polyfill后的symbol)会破坏Symbol的polyfill。 然而,在polyfill代码中使用现代语法可以显著提高源代码的可读性,并且有助于减少大小,在某些情况下还可以提高性能(如果在现代引擎中捆绑polyfill)。所以,现在是时候考虑将core-js重写为现代语法了,为了让它能够正常转译,需要使用变通手法,并为不同用例发布不同语法的版本,以解决上述问题。 ### Web标准的polyfill 我已经考虑很长时间了,想为 core-js 添加尽可能多的 Web 标准支持(不仅仅是 ECMAScript 以及与其密切相关的特性)。首先,是关于[最小通用 Web 平台 API](https://common-min-api.proposal.wintercg.org/#index) ([它是什么?](https://blog.cloudflare.com/introducing-the-wintercg/))的尚未实现功能,但不仅限于此。最好是有一个牢靠的polyfill项目,可以用于尽可能多的开发案例,而不仅仅是ECMAScript。目前,浏览器中支持 Web 标准的情况比支持现代 ECMAScript 特性的情况要糟糕得多。 将Web标准polyfill添加到core-js的主要障碍之一,是捆绑包的大小显著增加,但我认为,使用目前仅加载所需polyfill的技术,以及下面我将描述的技术,我们可以将Web标准的polyfill添加到core-js中。 但主要问题是它不应该是一个幼稚的polyfill,如我之前所述,现在,在绝大多数情况下,ECMAScript 功能的正确性并不算太差,但对于Web 平台的功能就没有这么好了。例如,最近添加的[structuredClone polyfill](https://github.com/zloirock/core-js#structuredclone)。在实现它时,考虑到依赖关系,我遇到了数百种不同的JavaScript引擎错误,但我不记得在添加新的ECMAScript功能时看到过这种情况。 因为这个原因,为了一个简单的方法,本应该可以在几个小时内完成的工作(包括解决所有issue和添加所需功能),却持续了几个月。对于polyfill,如果做得不好,还不如不做。适当的测试、polyfill填充和确保跨平台兼容性的 Web 平台功能,比我在 ECMAScript polyfill 上花费的资源更多。因此,仅在我有这样的资源时,才会开始向 core-js 添加尽可能多的 Web 标准支持。 --- ### 更有趣的新方法 有人会问它为什么处于这个位置。像转译器这样的工具与core-js项目有什么关系?core-js只是一个polyfill,转译器那些工具由其他人编写和维护的。有一次我也认为,用一个好的API编写一个伟大的项目,解释它的可能性就足够了,当它流行起来时,它将获得一个生态,并有着适当的第三方工具。然而,多年来,我意识到,如果你不这样做,或者不控制你自己,这种情况就不会发生。 例如,多年来,实例方法无法通过Babel runtime进行polyfill,我解释了太多次如何操作。在实际的项目中,通过preset-env来polyfill是不可行的,因为所需的polyfill的检测不完整,以及兼容性数据来源不够好,我从一开始就解释了这一点。由于这些问题,我被迫[在2018-2019年几乎完全重写这些工具,并发布在core-js@3版本中](https://github.com/babel/babel/pull/7646),之后我们获得了现在这种基于静态分析的polyfill注入工具。 我相信,如果没有在core-js范围内使用如下的方法,它根本无法正常工作。 --- 为了避免与以下文本相关的一些问题:core-js的工具将挪动(move)到作用域包——像core-js-builder和core-js-compat等工具将分别成为@core-js/builder和@core-js/compat。 ### 不仅仅是Babel:转译器和模块捆绑器的插件 目前,一些用户被迫使用Babel,只是因为需要自动注入及优化所需的polyfill。Babel的[preset-env](https://babeljs.io/docs/en/babel-preset-env#usebuiltins)和[runtime](https://babeljs.io/docs/en/babel-plugin-transform-runtime#core-js-aliasing)通过静态分析优化core-js的使用,这是唯一足够好且众所周知的方法。从历史上看,它之所以能这样,是因为我帮助Babel进行polyfill。但这并不意味着Babel是唯一或最好的干这事的地方。 Babel只是众多转译器之一。TypeScript是另一个流行的选项。其他转译器现在越来越受欢迎,例如[SWC](https://swc.rs/)(它已经包含[一个自动polyfill/core-js优化的工具](https://swc.rs/docs/configuration/supported-browsers),但仍然不够完美)。然而,我们为什么要谈论转译器?捆绑器和webpack或[esbuild](https://esbuild.github.io/)(也包含集成的转译器)等工具对polyfill的优化更有兴趣。[rome](https://rome.tools/)已经发展了几年,还没有准备好,但它的概念看起来很有希望。 位于转译层的基于静态分析的自动polyfill有这么一个主要问题:不是捆绑包中的所有文件都会被转译——例如,依赖项。如果你的一些依赖项需要现代内置功能的polyfill,但你没有在用户空间代码中使用此内置功能,则polyfill不会被添加到捆绑包中。不必要的polyfill导入也不会从你的依赖项中删除(见下文)。将自动polyfill从转译层移动到捆绑器层,可以解决这个问题。 当然,与Babel相比,编写或使用此类插件在很多地方是比较困难的。例如,[如果没有一些额外的工具,你无法在TypeScript中使用插件进行自定义转换](https://github.com/microsoft/TypeScript/issues/14419)。然而,有意愿的地方就有办法(where there's a will there's a way)。 core-js的自动polyfill/优化不应该仅在Babel中可用。虽然core-js项目也不可能为所有转译器和捆绑器编写和维护插件,但可以做这些事情: - 改进core-js(@core-js/compat)提供的数据以及用于第三方项目集成的工具,它们应该是全面的。例如,“内置定义”仍然在Babel一侧,导致它们在其他项目中的重用存在问题。 - 由于一些工具已经提供了core-js集成,因此帮助他们也是有意义的,而不仅仅是Babel。 - 为core-js项目范围内的一些重要工具编写和维护插件是有意义的。哪个?我们拭目以待。 ### polyfill收集器 上面解释了文件层上基于静态分析的自动polyfill(usage polyfilling mode of Babel preset-env)的问题,但这不是唯一的问题。让我们谈谈其他的。 你的依赖项可能有自己的core-js依赖,它们可能与你在项目根部使用的core-js版本不兼容,直接将core-js导入到你的依赖项可能会导致损坏。 项目通常包含多个入口点、多个捆绑包,在某些情况下,将所有core-js模块移动到一个块(chunk)可能会有问题,并可能导致每个捆绑包中core-js重复。 我已经在前面发布了[core-js使用统计数据](https://gist.github.com/zloirock/7331cec2a1ba74feae09e64584ec5d0e)。在许多情况下,你可以看到core-js的重复——而且它只在应用程序的第一个加载页面上。有时它甚至像我们在彭博网站上看到的那样:

bloomberg

[前段时间,这个数字甚至更高](https://user-images.githubusercontent.com/2213682/115339234-87e1f700-a1ce-11eb-853c-8b93b7fc5657.png)。当然,通常的网站不会拥有这么多不同版本的core-js,但有多个core-js确实很常见,大约一半的用了core-js的网站都这样。为了防止这种情况,**需要一个新的解决方案,在一个地方从项目的所有入口点、捆绑包和依赖项收集所有的polyfill。** 让我们称这个工具为 @core-js/collector。这个工具应该接收一个入口点或入口点列表,并使用 preset-env 中所使用的静态分析技术,但是,该工具不应该转换代码或注入任何内容,而是检查完整的依赖树,并返回所需的core-js模块的完整列表。作为一项需求,它应该可以很简单地集成到当前开发栈中。一种可能的方式是在插件中创建一个新的polyfill模式,称为“collected” - 它将允许在一个地方加载应用程序的所有收集的polyfill,并删除不必要的polyfill(见下文)。 ### 删除不必要的第三方polyfill 作为一个例子,一个很典型的情况是:在一个网站上看到多个具有相同功能的Promise polyfill副本,例如你只加载了一个来自core-js的Promise polyfill,但是一些依赖项会自己加载Promise polyfill,例如来自另一个core-js副本,或是来自es6-promise、promise-polyfill、es6-promise-polyfill、native-promise-only等等。然而,对于这些ES6 Promise,core-js已经完全实现了,而且大多数浏览器都不需要对Promise进行polyfill。由于这种重复,使得捆绑包中所有polyfill的大小会膨胀到几兆字节。 ##### 译者注:Promise是一种用于处理异步操作的对象,它可以让异步的代码变得更加易于阅读和维护。 这可能不是一个很好的例证,其他例子可能会更好,但既然上面我们开始谈论彭博网站,让我们再看看这个网站。我们无法访问源代码,但是我们有像[bundlescanner.com](https://bundlescanner.com/website/bloomberg.com/europe/all)这样很棒的工具(我希望彭博团队能尽快修复它,那时数据就不会是这样了)。

bundlescanner

从实践上讲,这种分析不是一件简单的工作,该工具只能检测到大约一半的库代码。然而,除了450K字节的core-js外,我们还看到数百K字节的其他polyfill——许多es6-promise、promise-polyfill、whatwg-fetch的副本(由于前面所述的原因,core-js仍然没有polyfill它)、string.prototype.codepointat、object-assign(这是ponyfill,下一节会讲到它们)、array-find-index等。 但是有多少polyfill没有检测到?这个网站加载的所有polyfill的大小是多少?看起来有几兆字节。然而,即使是非常旧的浏览器,最多一百K字节就足够了......这种情况并不特别——这太常见了。 由于许多polyfill仅包含core-js功能的子集,在@core-js/compat的范围内,我们能通过收集数据,判断一个第三方polyfill模块是否必要,如果此功能包含在core-js中,转译器(transpiler)或捆绑器(bundler)插件将删除此模块的导入或将其替换为适当core-js模块的导入。 同样的方法可以应用于摆脱对旧core-js版本的依赖。 ### 纯版本polyfill/ponyfill的全球化 另一个更常见的问题是来自全局(global)和纯(pure)core-js版本的polyfill的重复。纯core-js / babel-runtime旨在用于库的代码中,因此如果你使用全局版本的core-js而且你的依赖项也加载了一些不带全局命名空间污染的core-js副本,那么这是一种正常情况。它们使用不同的内部结构,但它们之间共享类似的代码是有问题的。 我正考虑在转译器或捆绑器插件中解决这个问题,与前一个类似(但当然,更复杂一点)——我们可以将纯版本的导入替换为全局版本导入,并删除目标引擎中不必要的 polyfill。 这也可以应用于那些第三方 ponyfills或过时库,他们所实现的功能在JS标准库中已经可用了。例如,has包的使用可以替换为Object.hasOwn,left-pad替换为String.prototype.padStart,somelodash方法替换为相关的现代内置JS方法等。 ### 服务 在IE11、iOS Safari 14.8以及最新的Firefox中加载相同的polyfill是错误的——在现代浏览器中加载了太多的死代码。一个流行的模式是使用2个捆绑包:为“现代”浏览器加载支持本地模块的 \ core-js-3.33.2/tests/compat/metadata.json000066400000000000000000000002161451776221300202530ustar00rootroot00000000000000{ "segments": { "0": [ "./hermes-runner.js", "./tests.js", "./compat-data.js", "./common-runner.js" ] } } core-js-3.33.2/tests/compat/node-runner.js000066400000000000000000000005121451776221300203710ustar00rootroot00000000000000'use strict'; /* eslint-disable no-console -- output */ require('./tests'); require('./compat-data'); require('./common-runner'); if (process.argv.indexOf('json') !== -1) { // eslint-disable-next-line es/no-json -- safe console.log(JSON.stringify(global.results, null, ' ')); } else global.showResults('node', console.log); core-js-3.33.2/tests/compat/rhino-adapter.mjs000066400000000000000000000005541451776221300210550ustar00rootroot00000000000000const { version } = argv; const rhino = await fetch( `https://github.com/mozilla/rhino/releases/download/Rhino${ version.replace(/\./g, '_') }_Release/rhino-${ version }.jar`, ); await fs.writeFile('tests/compat/rhino.jar', Buffer.from(await rhino.arrayBuffer())); await $`java -jar tests/compat/rhino.jar -version 200 -require tests/compat/rhino-runner.js`; core-js-3.33.2/tests/compat/rhino-runner.js000066400000000000000000000002741451776221300205700ustar00rootroot00000000000000'use strict'; require('./tests'); require('./compat-data'); require('./common-runner'); /* eslint-disable-next-line no-restricted-globals -- output */ global.showResults('rhino', print); core-js-3.33.2/tests/compat/tests.js000066400000000000000000001722631451776221300173140ustar00rootroot00000000000000'use strict'; /* eslint-disable prefer-regex-literals, radix -- required for testing */ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-lazy-ends, regexp/no-useless-quantifier -- required for testing */ var GLOBAL = typeof global != 'undefined' ? global : Function('return this')(); var WHITESPACES = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; var NOT_WHITESPACES = '\u200B\u0085\u180E'; var USERAGENT = GLOBAL.navigator && GLOBAL.navigator.userAgent || ''; var process = GLOBAL.process; var Bun = GLOBAL.Bun; var Deno = GLOBAL.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, V8_VERSION; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us V8_VERSION = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!V8_VERSION && USERAGENT) { match = USERAGENT.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = USERAGENT.match(/Chrome\/(\d+)/); if (match) V8_VERSION = +match[1]; } } var IS_BROWSER = typeof window == 'object' && typeof Deno != 'object'; var IS_BUN = typeof Bun == 'function' && Bun && typeof Bun.version == 'string'; var IS_DENO = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; // var IS_NODE = Object.prototype.toString.call(process) == '[object process]'; var WEBKIT_STRING_PAD_BUG = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(USERAGENT); var DESCRIPTORS_SUPPORT = function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a === 7; }; var V8_PROTOTYPE_DEFINE_BUG = function () { return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype === 42; }; var PROMISES_SUPPORT = function () { var promise = new Promise(function (resolve) { resolve(1); }); var empty = function () { /* empty */ }; var FakePromise = (promise.constructor = {})[Symbol.species] = function (exec) { exec(empty, empty); }; return promise.then(empty) instanceof FakePromise && V8_VERSION !== 66 && (!(IS_BROWSER || IS_DENO) || typeof PromiseRejectionEvent == 'function'); }; var PROMISE_STATICS_ITERATION = function () { var ITERATION_SUPPORT = false; try { var object = {}; object[Symbol.iterator] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; Promise.all(object).then(undefined, function () { /* empty */ }); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; var SYMBOLS_SUPPORT = function () { return Object.getOwnPropertySymbols && String(Symbol('symbol detection')) && !(V8_VERSION && V8_VERSION < 41); }; var SYMBOL_REGISTRY = [SYMBOLS_SUPPORT, function () { return Symbol['for'] && Symbol.keyFor; }]; var URL_AND_URL_SEARCH_PARAMS_SUPPORT = function () { // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return searchParams.sort && url.href === 'http://a/c%20d?a=1&c=3' && searchParams.get('c') === '3' && String(new URLSearchParams('?a=1')) === 'a=1' && searchParams[Symbol.iterator] && new URL('https://a@b').username === 'a' && new URLSearchParams(new URLSearchParams('a=b')).get('a') === 'b' && new URL('http://тест').host === 'xn--e1aybc' && new URL('http://a#б').hash === '#%D0%B1' && result === 'a1c3' && new URL('http://x', undefined).host === 'x'; }; var OBJECT_PROTOTYPE_ACCESSORS_SUPPORT = function () { try { Object.prototype.__defineSetter__.call(null, Math.random(), function () { /* empty */ }); } catch (error) { return Object.prototype.__defineSetter__; } }; var SAFE_ITERATION_CLOSING_SUPPORT = function () { var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[Symbol.iterator] = function () { return this; }; Array.from(iteratorWithReturn, function () { throw new Error('close'); }); } catch (error) { return SAFE_CLOSING; } }; var ARRAY_BUFFER_SUPPORT = function () { return ArrayBuffer && DataView; }; var TYPED_ARRAY_CONSTRUCTORS_LIST = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var ARRAY_BUFFER_VIEWS_SUPPORT = function () { for (var constructor in TYPED_ARRAY_CONSTRUCTORS_LIST) if (!GLOBAL[constructor]) return false; return ARRAY_BUFFER_SUPPORT(); }; var TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS = function () { try { return !Int8Array(1); } catch (error) { /* empty */ } try { return !new Int8Array(-1); } catch (error) { /* empty */ } new Int8Array(); new Int8Array(null); new Int8Array(1.5); var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; return new Int8Array(iterable)[0] === 1 && new Int8Array(new ArrayBuffer(2), 1, undefined).length === 1; }; function NCG_SUPPORT() { var re = RegExp('(?
b)'); return re.exec('b').groups.a === 'b' && 'b'.replace(re, '$c') === 'bc'; } function createIsRegExpLogicTest(name) { return function () { var regexp = /./; try { '/./'[name](regexp); } catch (error1) { try { regexp[Symbol.match] = false; return '/./'[name](regexp); } catch (error2) { /* empty */ } } return false; }; } function createStringHTMLMethodTest(METHOD_NAME) { return function () { var test = ''[METHOD_NAME]('"'); return test === test.toLowerCase() && test.split('"').length <= 3; }; } function createStringTrimMethodTest(METHOD_NAME) { return function () { return !WHITESPACES[METHOD_NAME]() && NOT_WHITESPACES[METHOD_NAME]() === NOT_WHITESPACES && WHITESPACES[METHOD_NAME].name === METHOD_NAME; }; } function createSetLike(size) { return { size: size, has: function () { return false; }, keys: function () { return { next: function () { return { done: true }; } }; } }; } function createSetMethodTest(METHOD_NAME) { return function () { try { new Set()[METHOD_NAME](createSetLike(0)); try { // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it // https://github.com/tc39/proposal-set-methods/pull/88 new Set()[METHOD_NAME](createSetLike(-1)); return false; } catch (error2) { return true; } } catch (error) { return false; } }; } function NATIVE_RAW_JSON() { var unsafeInt = '9007199254740993'; var raw = JSON.rawJSON(unsafeInt); return JSON.isRawJSON(raw) && JSON.stringify(raw) === unsafeInt; } function IMMEDIATE() { return setImmediate && clearImmediate && !(IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })()); } function TIMERS() { return !(/MSIE .\./.test(USERAGENT) || IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })()); } GLOBAL.tests = { // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.symbol': [SYMBOLS_SUPPORT, function () { var symbol = Symbol('stringify detection'); return Object.getOwnPropertySymbols('qwe') && Symbol['for'] && Symbol.keyFor && JSON.stringify([symbol]) === '[null]' && JSON.stringify({ a: symbol }) === '{}' && JSON.stringify(Object(symbol)) === '{}' && Symbol.prototype[Symbol.toPrimitive] && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.constructor': SYMBOLS_SUPPORT, 'es.symbol.description': function () { // eslint-disable-next-line symbol-description -- required for testing return Symbol('description detection').description === 'description detection' && Symbol().description === undefined; }, 'es.symbol.async-iterator': function () { return Symbol.asyncIterator; }, 'es.symbol.for': SYMBOL_REGISTRY, 'es.symbol.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance; }], 'es.symbol.is-concat-spreadable': [SYMBOLS_SUPPORT, function () { return Symbol.isConcatSpreadable; }], 'es.symbol.iterator': [SYMBOLS_SUPPORT, function () { return Symbol.iterator; }], 'es.symbol.key-for': SYMBOL_REGISTRY, 'es.symbol.match': [SYMBOLS_SUPPORT, function () { return Symbol.match; }], 'es.symbol.match-all': [SYMBOLS_SUPPORT, function () { return Symbol.matchAll; }], 'es.symbol.replace': [SYMBOLS_SUPPORT, function () { return Symbol.replace; }], 'es.symbol.search': [SYMBOLS_SUPPORT, function () { return Symbol.search; }], 'es.symbol.species': [SYMBOLS_SUPPORT, function () { return Symbol.species; }], 'es.symbol.split': [SYMBOLS_SUPPORT, function () { return Symbol.split; }], 'es.symbol.to-primitive': [SYMBOLS_SUPPORT, function () { return Symbol.toPrimitive && Symbol.prototype[Symbol.toPrimitive]; }], 'es.symbol.to-string-tag': [SYMBOLS_SUPPORT, function () { return Symbol.toStringTag && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.unscopables': [SYMBOLS_SUPPORT, function () { return Symbol.unscopables; }], 'es.error.cause': function () { return Error('e', { cause: 7 }).cause === 7 && !('cause' in Error.prototype); }, 'es.error.to-string': function () { if (DESCRIPTORS_SUPPORT) { // Chrome 32- incorrectly call accessor var object = Object.create(Object.defineProperty({}, 'name', { get: function () { return this === object; } })); if (Error.prototype.toString.call(object) !== 'true') return false; } // FF10- does not properly handle non-strings return Error.prototype.toString.call({ message: 1, name: 2 }) === '2: 1' // IE8 does not properly handle defaults && Error.prototype.toString.call({}) === 'Error'; }, 'es.aggregate-error.constructor': function () { return typeof AggregateError == 'function'; }, 'es.aggregate-error.cause': function () { return AggregateError([1], 'e', { cause: 7 }).cause === 7 && !('cause' in AggregateError.prototype); }, 'es.array.at': function () { return [].at; }, 'es.array.concat': function () { var array1 = []; array1[Symbol.isConcatSpreadable] = false; var array2 = []; var constructor = array2.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array1.concat()[0] === array1 && array2.concat().foo === 1; }, 'es.array.copy-within': function () { return Array.prototype.copyWithin && Array.prototype[Symbol.unscopables].copyWithin; }, 'es.array.every': function () { try { Array.prototype.every.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.every; }, 'es.array.fill': function () { return Array.prototype.fill && Array.prototype[Symbol.unscopables].fill; }, 'es.array.filter': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.filter(Boolean).foo === 1; }, 'es.array.find': function () { var SKIPS_HOLES = true; Array(1).find(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].find; }, 'es.array.find-index': function () { var SKIPS_HOLES = true; Array(1).findIndex(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].findIndex; }, 'es.array.find-last': function () { return [].findLast; }, 'es.array.find-last-index': function () { return [].findLastIndex; }, 'es.array.flat': function () { return Array.prototype.flat; }, 'es.array.flat-map': function () { return Array.prototype.flatMap; }, 'es.array.for-each': function () { try { Array.prototype.forEach.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.forEach; }, 'es.array.from': SAFE_ITERATION_CLOSING_SUPPORT, 'es.array.includes': function () { return Array(1).includes() && Array.prototype[Symbol.unscopables].includes; }, 'es.array.index-of': function () { try { [].indexOf.call(null); } catch (error) { return 1 / [1].indexOf(1, -0) > 0; } }, 'es.array.is-array': function () { return Array.isArray; }, 'es.array.iterator': [SYMBOLS_SUPPORT, function () { return [][Symbol.iterator] === [].values && [][Symbol.iterator].name === 'values' && [].entries()[Symbol.toStringTag] === 'Array Iterator' && [].keys().next() && [][Symbol.unscopables].keys && [][Symbol.unscopables].values && [][Symbol.unscopables].entries; }], 'es.array.join': function () { try { if (!Object.prototype.propertyIsEnumerable.call(Object('z'), 0)) return false; } catch (error) { return false; } try { Array.prototype.join.call(null, ''); return false; } catch (error) { /* empty */ } return true; }, 'es.array.last-index-of': function () { try { [].lastIndexOf.call(null); } catch (error) { return 1 / [1].lastIndexOf(1, -0) > 0; } }, 'es.array.map': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.map(function () { return true; }).foo === 1; }, 'es.array.of': function () { function F() { /* empty */ } return Array.of.call(F) instanceof F; }, 'es.array.push': function () { if ([].push.call({ length: 0x100000000 }, 1) !== 4294967297) return false; try { Object.defineProperty([], 'length', { writable: false }).push(); } catch (error) { return error instanceof TypeError; } }, 'es.array.reduce': function () { try { Array.prototype.reduce.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduce; } }, 'es.array.reduce-right': function () { try { Array.prototype.reduceRight.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduceRight; } }, 'es.array.reverse': function () { var test = [1, 2]; return String(test) !== String(test.reverse()); }, 'es.array.slice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.slice().foo === 1; }, 'es.array.some': function () { try { Array.prototype.some.call(null, function () { /* empty */ }); } catch (error) { return Array.prototype.some; } }, 'es.array.sort': function () { try { Array.prototype.sort.call(null); } catch (error1) { try { [1, 2, 3].sort(null); } catch (error2) { [1, 2, 3].sort(undefined); // stable sort var array = []; var result = ''; var code, chr, value, index; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } array.sort(function (a, b) { return b.v - a.v; }); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result === 'DGBEFHACIJK'; } } }, 'es.array.species': [SYMBOLS_SUPPORT, function () { return Array[Symbol.species]; }], 'es.array.splice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.splice().foo === 1; }, 'es.array.to-reversed': function () { return [].toReversed; }, 'es.array.to-sorted': function () { return [].toSorted; }, 'es.array.to-spliced': function () { return [].toSpliced; }, 'es.array.unscopables.flat': function () { return Array.prototype[Symbol.unscopables].flat; }, 'es.array.unscopables.flat-map': function () { return Array.prototype[Symbol.unscopables].flatMap; }, 'es.array.unshift': function () { if ([].unshift(0) !== 1) return false; try { Object.defineProperty([], 'length', { writable: false }).unshift(); } catch (error) { return error instanceof TypeError; } }, 'es.array.with': function () { return []['with']; }, 'es.array-buffer.constructor': [ARRAY_BUFFER_SUPPORT, function () { try { return !ArrayBuffer(1); } catch (error) { /* empty */ } try { return !new ArrayBuffer(-1); } catch (error) { /* empty */ } new ArrayBuffer(); new ArrayBuffer(1.5); new ArrayBuffer(NaN); return ArrayBuffer.length === 1 && ArrayBuffer.name === 'ArrayBuffer'; }], 'es.array-buffer.is-view': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return ArrayBuffer.isView; }], 'es.array-buffer.slice': [ARRAY_BUFFER_SUPPORT, function () { return new ArrayBuffer(2).slice(1, undefined).byteLength; }], 'es.data-view.constructor': ARRAY_BUFFER_SUPPORT, 'es.date.get-year': function () { return new Date(16e11).getYear() === 120; }, // TODO: Remove from `core-js@4` 'es.date.now': function () { return Date.now; }, 'es.date.set-year': function () { return Date.prototype.setYear; }, 'es.date.to-gmt-string': function () { return Date.prototype.toGMTString; }, 'es.date.to-iso-string': function () { try { new Date(NaN).toISOString(); } catch (error) { return new Date(-5e13 - 1).toISOString() === '0385-07-25T07:06:39.999Z'; } }, 'es.date.to-json': function () { return new Date(NaN).toJSON() === null && Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) === 1; }, 'es.date.to-primitive': [SYMBOLS_SUPPORT, function () { return Date.prototype[Symbol.toPrimitive]; }], // TODO: Remove from `core-js@4` 'es.date.to-string': function () { return new Date(NaN).toString() === 'Invalid Date'; }, 'es.escape': function () { return escape; }, 'es.function.bind': function () { var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test == 'function' && !test.hasOwnProperty('prototype'); }, 'es.function.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance in Function.prototype; }], 'es.function.name': function () { return 'name' in Function.prototype; }, 'es.global-this': function () { return globalThis; }, 'es.json.stringify': [SYMBOLS_SUPPORT, function () { var symbol = Symbol('stringify detection'); return JSON.stringify([symbol]) === '[null]' && JSON.stringify({ a: symbol }) === '{}' && JSON.stringify(Object(symbol)) === '{}' && JSON.stringify('\uDF06\uD834') === '"\\udf06\\ud834"' && JSON.stringify('\uDEAD') === '"\\udead"'; }], 'es.json.to-string-tag': [SYMBOLS_SUPPORT, function () { return JSON[Symbol.toStringTag]; }], 'es.map.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: [1, 2] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new Map(iterable); return map.forEach && map[Symbol.iterator]().next() && map.get(1) === 2 && map.set(-0, 3) === map && map.has(0) && map[Symbol.toStringTag]; }], 'es.math.acosh': function () { // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 return Math.floor(Math.acosh(Number.MAX_VALUE)) === 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && Math.acosh(Infinity) === Infinity; }, 'es.math.asinh': function () { return 1 / Math.asinh(0) > 0; }, 'es.math.atanh': function () { return 1 / Math.atanh(-0) < 0; }, 'es.math.cbrt': function () { return Math.cbrt; }, 'es.math.clz32': function () { return Math.clz32; }, 'es.math.cosh': function () { return Math.cosh(710) !== Infinity; }, 'es.math.expm1': function () { // Old FF bug // eslint-disable-next-line no-loss-of-precision -- required for old engines return Math.expm1(10) <= 22025.465794806719 && Math.expm1(10) >= 22025.4657948067165168 // Tor Browser bug && Math.expm1(-2e-17) === -2e-17; }, 'es.math.fround': function () { return Math.fround; }, 'es.math.hypot': function () { return Math.hypot && Math.hypot(Infinity, NaN) === Infinity; }, 'es.math.imul': function () { return Math.imul(0xFFFFFFFF, 5) === -5 && Math.imul.length === 2; }, 'es.math.log10': function () { return Math.log10; }, 'es.math.log1p': function () { return Math.log1p; }, 'es.math.log2': function () { return Math.log2; }, 'es.math.sign': function () { return Math.sign; }, 'es.math.sinh': function () { return Math.sinh(-2e-17) === -2e-17; }, 'es.math.tanh': function () { return Math.tanh; }, 'es.math.to-string-tag': function () { return Math[Symbol.toStringTag]; }, 'es.math.trunc': function () { return Math.trunc; }, 'es.number.constructor': function () { return Number(' 0o1') && Number('0b1') && !Number('+0x1'); }, 'es.number.epsilon': function () { return Number.EPSILON; }, 'es.number.is-finite': function () { return Number.isFinite; }, 'es.number.is-integer': function () { return Number.isInteger; }, 'es.number.is-nan': function () { return Number.isNaN; }, 'es.number.is-safe-integer': function () { return Number.isSafeInteger; }, 'es.number.max-safe-integer': function () { return Number.MAX_SAFE_INTEGER; }, 'es.number.min-safe-integer': function () { return Number.MIN_SAFE_INTEGER; }, 'es.number.parse-float': function () { try { parseFloat(Object(Symbol.iterator)); } catch (error) { return Number.parseFloat === parseFloat && 1 / parseFloat(WHITESPACES + '-0') === -Infinity; } }, 'es.number.parse-int': function () { try { parseInt(Object(Symbol.iterator)); } catch (error) { return Number.parseInt === parseInt && parseInt(WHITESPACES + '08') === 8 && parseInt(WHITESPACES + '0x16') === 22; } }, 'es.number.to-exponential': function () { try { 1.0.toExponential(Infinity); } catch (error) { try { 1.0.toExponential(-Infinity); } catch (error2) { Infinity.toExponential(Infinity); NaN.toExponential(Infinity); return (-6.9e-11).toExponential(4) === '-6.9000e-11' && 1.255.toExponential(2) === '1.25e+0'; // && 25.0.toExponential(0) === '3e+1'; } } }, 'es.number.to-fixed': function () { try { Number.prototype.toFixed.call({}); } catch (error) { return 0.00008.toFixed(3) === '0.000' && 0.9.toFixed(0) === '1' && 1.255.toFixed(2) === '1.25' && 1000000000000000128.0.toFixed(0) === '1000000000000000128'; } }, 'es.number.to-precision': function () { try { Number.prototype.toPrecision.call({}); } catch (error) { return 1.0.toPrecision(undefined) === '1'; } }, 'es.object.assign': function () { if (DESCRIPTORS_SUPPORT && Object.assign({ b: 1 }, Object.assign(Object.defineProperty({}, 'a', { enumerable: true, get: function () { Object.defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return false; var A = {}; var B = {}; var symbol = Symbol('assign detection'); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return Object.assign({}, A)[symbol] === 7 && Object.keys(Object.assign({}, B)).join('') === alphabet; }, // TODO: Remove from `core-js@4` 'es.object.create': function () { return Object.create; }, 'es.object.define-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.define-properties': [DESCRIPTORS_SUPPORT, V8_PROTOTYPE_DEFINE_BUG, function () { return Object.defineProperties; }], 'es.object.define-property': [DESCRIPTORS_SUPPORT, V8_PROTOTYPE_DEFINE_BUG], 'es.object.define-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.entries': function () { return Object.entries; }, 'es.object.freeze': function () { return Object.freeze(true); }, 'es.object.from-entries': function () { return Object.fromEntries; }, 'es.object.get-own-property-descriptor': [DESCRIPTORS_SUPPORT, function () { return Object.getOwnPropertyDescriptor('qwe', '0'); }], 'es.object.get-own-property-descriptors': function () { return Object.getOwnPropertyDescriptors; }, 'es.object.get-own-property-names': function () { return Object.getOwnPropertyNames('qwe'); }, 'es.object.get-own-property-symbols': [SYMBOLS_SUPPORT, function () { return Object.getOwnPropertySymbols('qwe'); }], 'es.object.get-prototype-of': function () { return Object.getPrototypeOf('qwe'); }, 'es.object.has-own': function () { return Object.hasOwn; }, 'es.object.is': function () { return Object.is; }, 'es.object.is-extensible': function () { return !Object.isExtensible('qwe'); }, 'es.object.is-frozen': function () { return Object.isFrozen('qwe'); }, 'es.object.is-sealed': function () { return Object.isSealed('qwe'); }, 'es.object.keys': function () { return Object.keys('qwe'); }, 'es.object.lookup-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.lookup-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.prevent-extensions': function () { return Object.preventExtensions(true); }, 'es.object.proto': function () { return '__proto__' in Object.prototype; }, 'es.object.seal': function () { return Object.seal(true); }, 'es.object.set-prototype-of': function () { return Object.setPrototypeOf; }, 'es.object.to-string': [SYMBOLS_SUPPORT, function () { var O = {}; O[Symbol.toStringTag] = 'foo'; return String(O) === '[object foo]'; }], 'es.object.values': function () { return Object.values; }, 'es.parse-float': function () { try { parseFloat(Object(Symbol.iterator)); } catch (error) { return 1 / parseFloat(WHITESPACES + '-0') === -Infinity; } }, 'es.parse-int': function () { try { parseInt(Object(Symbol.iterator)); } catch (error) { return parseInt(WHITESPACES + '08') === 8 && parseInt(WHITESPACES + '0x16') === 22; } }, // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.promise': PROMISES_SUPPORT, 'es.promise.constructor': PROMISES_SUPPORT, 'es.promise.all': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.all; }], 'es.promise.all-settled': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.allSettled; }], 'es.promise.any': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.any; }], 'es.promise.catch': PROMISES_SUPPORT, 'es.promise.finally': [PROMISES_SUPPORT, function () { // eslint-disable-next-line unicorn/no-thenable -- required for testing return Promise.prototype['finally'].call({ then: function () { return this; } }, function () { /* empty */ }); }], 'es.promise.race': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { return Promise.race; }], 'es.promise.reject': PROMISES_SUPPORT, 'es.promise.resolve': PROMISES_SUPPORT, 'es.reflect.apply': function () { try { return Reflect.apply(function () { return false; }); } catch (error) { return Reflect.apply(function () { return true; }, null, []); } }, 'es.reflect.construct': function () { try { return !Reflect.construct(function () { /* empty */ }); } catch (error) { /* empty */ } function F() { /* empty */ } return Reflect.construct(function () { /* empty */ }, [], F) instanceof F; }, 'es.reflect.define-property': function () { return !Reflect.defineProperty(Object.defineProperty({}, 1, { value: 1 }), 1, { value: 2 }); }, 'es.reflect.delete-property': function () { return Reflect.deleteProperty; }, 'es.reflect.get': function () { return Reflect.get; }, 'es.reflect.get-own-property-descriptor': function () { return Reflect.getOwnPropertyDescriptor; }, 'es.reflect.get-prototype-of': function () { return Reflect.getPrototypeOf; }, 'es.reflect.has': function () { return Reflect.has; }, 'es.reflect.is-extensible': function () { return Reflect.isExtensible; }, 'es.reflect.own-keys': function () { return Reflect.ownKeys; }, 'es.reflect.prevent-extensions': function () { return Reflect.preventExtensions; }, 'es.reflect.set': function () { var object = Object.defineProperty({}, 'a', { configurable: true }); return Reflect.set(Object.getPrototypeOf(object), 'a', 1, object) === false; }, 'es.reflect.set-prototype-of': function () { return Reflect.setPrototypeOf; }, 'es.reflect.to-string-tag': function () { return Reflect[Symbol.toStringTag]; }, 'es.regexp.constructor': [NCG_SUPPORT, function () { var re1 = /a/g; var re2 = /a/g; re2[Symbol.match] = false; // eslint-disable-next-line no-constant-binary-expression -- required for testing return new RegExp(re1) !== re1 && RegExp(re1) === re1 && RegExp(re2) !== re2 && String(RegExp(re1, 'i')) === '/a/i' && new RegExp('a', 'y') // just check that it doesn't throw && RegExp('.', 's').exec('\n') && RegExp[Symbol.species]; }], 'es.regexp.dot-all': function () { return RegExp('.', 's').dotAll; }, 'es.regexp.exec': [NCG_SUPPORT, function () { var re1 = /a/; var re2 = /b*/g; var reSticky = new RegExp('a', 'y'); var reStickyAnchored = new RegExp('^a', 'y'); re1.exec('a'); re2.exec('a'); return re1.lastIndex === 0 && re2.lastIndex === 0 // eslint-disable-next-line regexp/no-empty-group -- required for testing && /()??/.exec('')[1] === undefined && reSticky.exec('abc')[0] === 'a' && reSticky.exec('abc') === null && (reSticky.lastIndex = 1) && reSticky.exec('bac')[0] === 'a' && (reStickyAnchored.lastIndex = 2) && reStickyAnchored.exec('cba') === null && RegExp('.', 's').exec('\n'); }], 'es.regexp.flags': function () { var INDICES_SUPPORT = true; try { RegExp('.', 'd'); } catch (error) { INDICES_SUPPORT = false; } var O = {}; // modern V8 bug var calls = ''; var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; var addGetter = function (key, chr) { Object.defineProperty(O, key, { get: function () { calls += chr; return true; } }); }; var pairs = { dotAll: 's', global: 'g', ignoreCase: 'i', multiline: 'm', sticky: 'y' }; if (INDICES_SUPPORT) pairs.hasIndices = 'd'; for (var key in pairs) addGetter(key, pairs[key]); var result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O); return result === expected && calls === expected; }, 'es.regexp.sticky': function () { return new RegExp('a', 'y').sticky === true; }, 'es.regexp.test': function () { var execCalled = false; var re = /[ac]/; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; return re.test('abc') === true && execCalled; }, 'es.regexp.to-string': function () { return RegExp.prototype.toString.call({ source: 'a', flags: 'b' }) === '/a/b' && RegExp.prototype.toString.name === 'toString'; }, 'es.set.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new Set(iterable); return set.forEach && set[Symbol.iterator]().next() && set.has(1) && set.add(-0) === set && set.has(0) && set[Symbol.toStringTag]; }], 'es.string.at-alternative': function () { return '𠮷'.at(-2) === '\uD842'; }, 'es.string.code-point-at': function () { return String.prototype.codePointAt; }, 'es.string.ends-with': createIsRegExpLogicTest('endsWith'), 'es.string.from-code-point': function () { return String.fromCodePoint; }, 'es.string.includes': createIsRegExpLogicTest('includes'), 'es.string.is-well-formed': function () { return String.prototype.isWellFormed; }, 'es.string.iterator': [SYMBOLS_SUPPORT, function () { return ''[Symbol.iterator]; }], 'es.string.match': function () { var O = {}; O[Symbol.match] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.match](''); // eslint-disable-next-line regexp/prefer-regexp-exec -- required for testing return ''.match(O) === 7 && execCalled; }, 'es.string.match-all': function () { try { // eslint-disable-next-line regexp/no-missing-g-flag -- required for testing 'a'.matchAll(/./); } catch (error) { return 'a'.matchAll(/./g); } }, 'es.string.pad-end': function () { return String.prototype.padEnd && !WEBKIT_STRING_PAD_BUG; }, 'es.string.pad-start': function () { return String.prototype.padStart && !WEBKIT_STRING_PAD_BUG; }, 'es.string.raw': function () { return String.raw; }, 'es.string.repeat': function () { return String.prototype.repeat; }, 'es.string.replace': function () { var O = {}; O[Symbol.replace] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.replace](''); var re2 = /./; re2.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(O) === 7 && execCalled // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive && ''.replace(re2, '$') === '7' // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing && 'a'.replace(/./, '$0') === '$0' && /./[Symbol.replace]('a', '$0') === '$0'; }, 'es.string.replace-all': function () { return String.prototype.replaceAll; }, 'es.string.search': function () { var O = {}; O[Symbol.search] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.search](''); return ''.search(O) === 7 && execCalled; }, 'es.string.split': function () { var O = {}; O[Symbol.split] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re.constructor = {}; re.constructor[Symbol.species] = function () { return re; }; re[Symbol.split](''); // eslint-disable-next-line regexp/no-empty-group -- required for testing var re2 = /(?:)/; var originalExec = re2.exec; re2.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re2); return ''.split(O) === 7 && execCalled && result.length === 2 && result[0] === 'a' && result[1] === 'b'; }, 'es.string.starts-with': createIsRegExpLogicTest('startsWith'), 'es.string.substr': function () { return 'ab'.substr(-1) === 'b'; }, 'es.string.to-well-formed': function () { // Safari ToString conversion bug // https://bugs.webkit.org/show_bug.cgi?id=251757 return String.prototype.toWellFormed.call(1) === '1'; }, 'es.string.trim': createStringTrimMethodTest('trim'), 'es.string.trim-end': [createStringTrimMethodTest('trimEnd'), function () { return String.prototype.trimRight === String.prototype.trimEnd; }], 'es.string.trim-left': [createStringTrimMethodTest('trimStart'), function () { return String.prototype.trimLeft === String.prototype.trimStart; }], 'es.string.trim-right': [createStringTrimMethodTest('trimEnd'), function () { return String.prototype.trimRight === String.prototype.trimEnd; }], 'es.string.trim-start': [createStringTrimMethodTest('trimStart'), function () { return String.prototype.trimLeft === String.prototype.trimStart; }], 'es.string.anchor': createStringHTMLMethodTest('anchor'), 'es.string.big': createStringHTMLMethodTest('big'), 'es.string.blink': createStringHTMLMethodTest('blink'), 'es.string.bold': createStringHTMLMethodTest('bold'), 'es.string.fixed': createStringHTMLMethodTest('fixed'), 'es.string.fontcolor': createStringHTMLMethodTest('fontcolor'), 'es.string.fontsize': createStringHTMLMethodTest('fontsize'), 'es.string.italics': createStringHTMLMethodTest('italics'), 'es.string.link': createStringHTMLMethodTest('link'), 'es.string.small': createStringHTMLMethodTest('small'), 'es.string.strike': createStringHTMLMethodTest('strike'), 'es.string.sub': createStringHTMLMethodTest('sub'), 'es.string.sup': createStringHTMLMethodTest('sup'), 'es.typed-array.float32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.float64-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-clamped-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.at': function () { return Int8Array.prototype.at; }, 'es.typed-array.copy-within': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.copyWithin; }], 'es.typed-array.every': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.every; }], 'es.typed-array.fill': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { var count = 0; new Int8Array(2).fill({ valueOf: function () { return count++; } }); return count === 1; }], 'es.typed-array.filter': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.filter; }], 'es.typed-array.find': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.find; }], 'es.typed-array.find-index': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.findIndex; }], 'es.typed-array.find-last': function () { return Int8Array.prototype.findLast; }, 'es.typed-array.find-last-index': function () { return Int8Array.prototype.findLastIndex; }, 'es.typed-array.for-each': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.forEach; }], 'es.typed-array.from': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.from; } ], 'es.typed-array.includes': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.includes; }], 'es.typed-array.index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.indexOf; }], 'es.typed-array.iterator': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { Int8Array.prototype[Symbol.iterator].call([1]); } catch (error) { return Int8Array.prototype[Symbol.iterator].name === 'values' && Int8Array.prototype[Symbol.iterator] === Int8Array.prototype.values && Int8Array.prototype.keys && Int8Array.prototype.entries; } }], 'es.typed-array.join': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.join; }], 'es.typed-array.last-index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.lastIndexOf; }], 'es.typed-array.map': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.map; }], 'es.typed-array.of': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.of; } ], 'es.typed-array.reduce': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduce; }], 'es.typed-array.reduce-right': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduceRight; }], 'es.typed-array.reverse': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reverse; }], 'es.typed-array.set': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { var array = new Uint8ClampedArray(3); array.set(1); array.set('2', 1); Int8Array.prototype.set.call(array, { length: 1, 0: 3 }, 2); return array[0] === 0 && array[1] === 2 && array[2] === 3; }], 'es.typed-array.slice': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return new Int8Array(1).slice(); }], 'es.typed-array.some': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.some; }], 'es.typed-array.sort': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { new Uint16Array(1).sort(null); new Uint16Array(1).sort({}); return false; } catch (error) { /* empty */ } // stable sort var array = new Uint16Array(516); var expected = Array(516); var index, mod; for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } array.sort(function (a, b) { return (a / 4 | 0) - (b / 4 | 0); }); for (index = 0; index < 516; index++) { if (array[index] !== expected[index]) return; } return true; }], 'es.typed-array.subarray': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.subarray; }], 'es.typed-array.to-locale-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { Int8Array.prototype.toLocaleString.call([1, 2]); } catch (error) { return [1, 2].toLocaleString() === new Int8Array([1, 2]).toLocaleString(); } }], 'es.typed-array.to-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.toString === Array.prototype.toString; }], 'es.typed-array.to-reversed': function () { return Int8Array.prototype.toReversed; }, 'es.typed-array.to-sorted': function () { return Int8Array.prototype.toSorted; }, 'es.typed-array.with': function () { try { new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); } catch (error) { return error === 8; } }, 'es.unescape': function () { return unescape; }, 'es.weak-map.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = Object.freeze([]); var called = 0; var iterable = { next: function () { return { done: !!called++, value: [key, 1] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new WeakMap(iterable); // MS IE bug return map.get(key) === 1 && map.get(null) === undefined && map.set({}, 2) === map && map[Symbol.toStringTag] // MS Edge bug && Object.isFrozen(key); }], 'es.weak-set.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = {}; var called = 0; var iterable = { next: function () { return { done: !!called++, value: key }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new WeakSet(iterable); return set.has(key) && !set.has(null) && set.add({}) === set && set[Symbol.toStringTag]; }], 'esnext.suppressed-error.constructor': function () { return typeof SuppressedError == 'function'; }, 'esnext.array.from-async': function () { return Array.fromAsync; }, 'esnext.array.filter-reject': function () { return [].filterReject; }, 'esnext.array.is-template-object': function () { return Array.isTemplateObject; }, 'esnext.array.unique-by': function () { return [].uniqueBy; }, 'esnext.array-buffer.detached': function () { return 'detached' in ArrayBuffer.prototype; }, 'esnext.array-buffer.transfer': function () { return ArrayBuffer.prototype.transfer; }, 'esnext.array-buffer.transfer-to-fixed-length': function () { return ArrayBuffer.prototype.transferToFixedLength; }, 'esnext.async-disposable-stack.constructor': function () { return typeof AsyncDisposableStack == 'function'; }, 'esnext.async-iterator.constructor': function () { return typeof AsyncIterator == 'function'; }, 'esnext.async-iterator.async-dispose': function () { return AsyncIterator.prototype[Symbol.asyncDispose]; }, 'esnext.async-iterator.drop': function () { return AsyncIterator.prototype.drop; }, 'esnext.async-iterator.every': function () { return AsyncIterator.prototype.every; }, 'esnext.async-iterator.filter': function () { return AsyncIterator.prototype.filter; }, 'esnext.async-iterator.find': function () { return AsyncIterator.prototype.find; }, 'esnext.async-iterator.flat-map': function () { return AsyncIterator.prototype.flatMap; }, 'esnext.async-iterator.for-each': function () { return AsyncIterator.prototype.forEach; }, 'esnext.async-iterator.from': function () { return AsyncIterator.from; }, 'esnext.async-iterator.map': function () { return AsyncIterator.prototype.map; }, 'esnext.async-iterator.reduce': function () { return AsyncIterator.prototype.reduce; }, 'esnext.async-iterator.some': function () { return AsyncIterator.prototype.some; }, 'esnext.async-iterator.take': function () { return AsyncIterator.prototype.take; }, 'esnext.async-iterator.to-array': function () { return AsyncIterator.prototype.toArray; }, 'esnext.composite-key': function () { return compositeKey; }, 'esnext.composite-symbol': function () { return compositeSymbol; }, 'esnext.data-view.get-float16': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.getFloat16; }], 'esnext.data-view.get-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.getUint8Clamped; }], 'esnext.data-view.set-float16': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.setFloat16; }], 'esnext.data-view.set-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () { return DataView.prototype.setUint8Clamped; }], 'esnext.disposable-stack.constructor': function () { return typeof DisposableStack == 'function'; }, 'esnext.function.demethodize': function () { return Function.prototype.demethodize; }, 'esnext.function.is-callable': function () { return Function.isCallable; }, 'esnext.function.is-constructor': function () { return Function.isConstructor; }, 'esnext.function.metadata': function () { return Function.prototype[Symbol.metadata] === null; }, 'esnext.iterator.constructor': function () { try { Iterator({}); } catch (error) { return typeof Iterator == 'function' && Iterator.prototype === Object.getPrototypeOf(Object.getPrototypeOf([].values())); } }, 'esnext.iterator.dispose': function () { return [].keys()[Symbol.dispose]; }, 'esnext.iterator.drop': function () { return Iterator.prototype.drop; }, 'esnext.iterator.every': function () { return Iterator.prototype.every; }, 'esnext.iterator.filter': function () { return Iterator.prototype.filter; }, 'esnext.iterator.find': function () { return Iterator.prototype.find; }, 'esnext.iterator.flat-map': function () { return Iterator.prototype.flatMap; }, 'esnext.iterator.for-each': function () { return Iterator.prototype.forEach; }, 'esnext.iterator.from': function () { return Iterator.from; }, 'esnext.iterator.map': function () { return Iterator.prototype.map; }, 'esnext.iterator.range': function () { return Iterator.range; }, 'esnext.iterator.reduce': function () { return Iterator.prototype.reduce; }, 'esnext.iterator.some': function () { return Iterator.prototype.some; }, 'esnext.iterator.take': function () { return Iterator.prototype.take; }, 'esnext.iterator.to-array': function () { return Iterator.prototype.toArray; }, 'esnext.iterator.to-async': function () { return Iterator.prototype.toAsync; }, 'esnext.json.is-raw-json': NATIVE_RAW_JSON, 'esnext.json.parse': function () { var unsafeInt = '9007199254740993'; var source; JSON.parse(unsafeInt, function (key, value, context) { source = context.source; }); return source === unsafeInt; }, 'esnext.json.raw-json': NATIVE_RAW_JSON, 'esnext.map.delete-all': function () { return Map.prototype.deleteAll; }, 'esnext.map.emplace': function () { return Map.prototype.emplace; }, 'esnext.map.every': function () { return Map.prototype.every; }, 'esnext.map.filter': function () { return Map.prototype.filter; }, 'esnext.map.find': function () { return Map.prototype.find; }, 'esnext.map.find-key': function () { return Map.prototype.findKey; }, 'esnext.map.from': function () { return Map.from; }, 'esnext.map.group-by': function () { return Map.groupBy; }, 'esnext.map.includes': function () { return Map.prototype.includes; }, 'esnext.map.key-by': function () { return Map.keyBy; }, 'esnext.map.key-of': function () { return Map.prototype.keyOf; }, 'esnext.map.map-keys': function () { return Map.prototype.mapKeys; }, 'esnext.map.map-values': function () { return Map.prototype.mapValues; }, 'esnext.map.merge': function () { return Map.prototype.merge; }, 'esnext.map.of': function () { return Map.of; }, 'esnext.map.reduce': function () { return Map.prototype.reduce; }, 'esnext.map.some': function () { return Map.prototype.some; }, 'esnext.map.update': function () { return Map.prototype.update; }, 'esnext.math.clamp': function () { return Math.clamp; }, 'esnext.math.deg-per-rad': function () { return Math.DEG_PER_RAD; }, 'esnext.math.degrees': function () { return Math.degrees; }, 'esnext.math.fscale': function () { return Math.fscale; }, 'esnext.math.f16round': function () { return Math.f16round; }, 'esnext.math.rad-per-deg': function () { return Math.RAD_PER_DEG; }, 'esnext.math.radians': function () { return Math.radians; }, 'esnext.math.scale': function () { return Math.scale; }, 'esnext.math.signbit': function () { return Math.signbit; }, 'esnext.number.from-string': function () { return Number.fromString; }, 'esnext.object.group-by': function () { return Object.groupBy; }, 'esnext.promise.with-resolvers': [PROMISES_SUPPORT, function () { return Promise.withResolvers; }], 'esnext.regexp.escape': function () { return RegExp.escape; }, 'esnext.set.add-all': function () { return Set.prototype.addAll; }, 'esnext.set.delete-all': function () { return Set.prototype.deleteAll; }, 'esnext.set.difference.v2': createSetMethodTest('difference'), 'esnext.set.every': function () { return Set.prototype.every; }, 'esnext.set.filter': function () { return Set.prototype.filter; }, 'esnext.set.find': function () { return Set.prototype.find; }, 'esnext.set.from': function () { return Set.from; }, 'esnext.set.intersection.v2': [createSetMethodTest('intersection'), function () { return Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2]))) === '3,2'; }], 'esnext.set.is-disjoint-from.v2': createSetMethodTest('isDisjointFrom'), 'esnext.set.is-subset-of.v2': createSetMethodTest('isSubsetOf'), 'esnext.set.is-superset-of.v2': createSetMethodTest('isSupersetOf'), 'esnext.set.join': function () { return Set.prototype.join; }, 'esnext.set.map': function () { return Set.prototype.map; }, 'esnext.set.of': function () { return Set.of; }, 'esnext.set.reduce': function () { return Set.prototype.reduce; }, 'esnext.set.some': function () { return Set.prototype.some; }, 'esnext.set.symmetric-difference.v2': createSetMethodTest('symmetricDifference'), 'esnext.set.union.v2': createSetMethodTest('union'), 'esnext.string.code-points': function () { return String.prototype.codePoints; }, 'esnext.string.cooked': function () { return String.cooked; }, 'esnext.string.dedent': function () { return String.dedent; }, 'esnext.symbol.async-dispose': function () { var descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncDispose'); return descriptor.value && !descriptor.enumerable && !descriptor.configurable && !descriptor.writable; }, 'esnext.symbol.dispose': function () { var descriptor = Object.getOwnPropertyDescriptor(Symbol, 'dispose'); return descriptor.value && !descriptor.enumerable && !descriptor.configurable && !descriptor.writable; }, 'esnext.symbol.is-registered-symbol': function () { return Symbol.isRegisteredSymbol; }, 'esnext.symbol.is-well-known-symbol': function () { return Symbol.isWellKnownSymbol; }, 'esnext.symbol.matcher': function () { return Symbol.matcher; }, 'esnext.symbol.metadata': function () { return Symbol.metadata; }, 'esnext.symbol.observable': function () { return Symbol.observable; }, 'esnext.typed-array.filter-reject': function () { return Int8Array.prototype.filterReject; }, 'esnext.typed-array.unique-by': function () { return Int8Array.prototype.uniqueBy; }, 'esnext.weak-map.delete-all': function () { return WeakMap.prototype.deleteAll; }, 'esnext.weak-map.emplace': function () { return WeakMap.prototype.emplace; }, 'esnext.weak-map.from': function () { return WeakMap.from; }, 'esnext.weak-map.of': function () { return WeakMap.of; }, 'esnext.weak-set.add-all': function () { return WeakSet.prototype.addAll; }, 'esnext.weak-set.delete-all': function () { return WeakSet.prototype.deleteAll; }, 'esnext.weak-set.from': function () { return WeakSet.from; }, 'esnext.weak-set.of': function () { return WeakSet.of; }, 'web.atob': function () { try { atob(); } catch (error1) { try { atob('a'); } catch (error2) { return atob(' ') === ''; } } }, 'web.btoa': function () { try { btoa(); } catch (error) { return typeof btoa == 'function'; } }, 'web.clear-immediate': function () { return setImmediate && clearImmediate; }, 'web.dom-collections.for-each': function () { return (!GLOBAL.NodeList || (NodeList.prototype.forEach && NodeList.prototype.forEach === [].forEach)) && (!GLOBAL.DOMTokenList || (DOMTokenList.prototype.forEach && DOMTokenList.prototype.forEach === [].forEach)); }, 'web.dom-collections.iterator': function () { var DOMIterables = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; for (var collection in DOMIterables) { if (GLOBAL[collection]) { if ( !GLOBAL[collection].prototype[Symbol.iterator] || GLOBAL[collection].prototype[Symbol.iterator] !== [].values ) return false; if (DOMIterables[collection] && ( !GLOBAL[collection].prototype.keys || !GLOBAL[collection].prototype.values || !GLOBAL[collection].prototype.entries )) return false; } } return true; }, 'web.dom-exception.constructor': function () { return new DOMException() instanceof Error && new DOMException(1, 'DataCloneError').code === 25 && String(new DOMException(1, 2)) === '2: 1' && DOMException.DATA_CLONE_ERR === 25 && DOMException.prototype.DATA_CLONE_ERR === 25; }, 'web.dom-exception.stack': function () { return !('stack' in Error('1')) || 'stack' in new DOMException(); }, 'web.dom-exception.to-string-tag': function () { return typeof DOMException == 'function' && DOMException.prototype[Symbol.toStringTag] === 'DOMException'; }, // TODO: Remove this module from `core-js@4` since it's split to submodules 'web.immediate': IMMEDIATE, 'web.queue-microtask': function () { return Object.getOwnPropertyDescriptor(GLOBAL, 'queueMicrotask').value; }, 'web.self': function () { // eslint-disable-next-line no-restricted-globals -- safe if (self !== GLOBAL) return false; if (!DESCRIPTORS_SUPPORT) return true; var descriptor = Object.getOwnPropertyDescriptor(GLOBAL, 'self'); return descriptor.get && descriptor.enumerable; }, 'web.set-immediate': IMMEDIATE, 'web.set-interval': TIMERS, 'web.set-timeout': TIMERS, 'web.structured-clone': function () { function checkErrorsCloning(structuredCloneImplementation, $Error) { var error = new $Error(); var test = structuredCloneImplementation({ a: error, b: error }); return test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack; } function checkNewErrorsCloningSemantic(structuredCloneImplementation) { var test = structuredCloneImplementation(new AggregateError([1], 'message', { cause: 3 })); return test.name === 'AggregateError' && test.errors[0] === 1 && test.message === 'message' && test.cause === 3; } return checkErrorsCloning(structuredClone, Error) && checkErrorsCloning(structuredClone, DOMException) && checkNewErrorsCloningSemantic(structuredClone); }, // TODO: Remove this module from `core-js@4` since it's split to submodules 'web.timers': TIMERS, 'web.url.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT, 'web.url.can-parse': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { try { URL.canParse(); } catch (error) { return URL.canParse; } }], 'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return URL.prototype.toJSON; }], 'web.url-search-params.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT, 'web.url-search-params.delete': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { var params = new URLSearchParams('a=1&a=2&b=3'); params['delete']('a', 1); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params['delete']('b', undefined); return params + '' === 'a=2'; }], 'web.url-search-params.has': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { var params = new URLSearchParams('a=1'); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 return params.has('a', 1) && !params.has('a', 2) && params.has('a', undefined); }], 'web.url-search-params.size': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return 'size' in URLSearchParams.prototype; }] }; core-js-3.33.2/tests/entries/000077500000000000000000000000001451776221300157675ustar00rootroot00000000000000core-js-3.33.2/tests/entries/content.mjs000066400000000000000000000166341451776221300201660ustar00rootroot00000000000000import { deepEqual, ok } from 'node:assert/strict'; import konan from 'konan'; const allModules = await fs.readJson('packages/core-js-compat/modules.json'); const entries = await fs.readJson('packages/core-js-compat/entries.json'); function filter(regexp) { return allModules.filter(it => regexp.test(it)); } function equal(name, required) { const contains = new Set(entries[name]); const shouldContain = new Set(Array.isArray(required) ? required : filter(required)); deepEqual(contains, shouldContain); } function superset(name, required) { const contains = new Set(entries[name]); const shouldContain = Array.isArray(required) ? required : filter(required); for (const module of shouldContain) { ok(contains.has(module), module); } } function subset(name, required) { const contains = entries[name]; const shouldContain = new Set(Array.isArray(required) ? required : filter(required)); for (const module of contains) { ok(shouldContain.has(module), module); } } equal('core-js', allModules); equal('core-js/es', /^es\./); superset('core-js/es/array', /^es\.array\./); superset('core-js/es/array-buffer', /^es\.array-buffer\./); superset('core-js/es/data-view', /^es\.data-view\./); superset('core-js/es/date', /^es\.date\./); superset('core-js/es/error', /^es\.error\./); superset('core-js/es/function', /^es\.function\./); superset('core-js/es/json', /^es\.json\./); superset('core-js/es/map', /^es\.map/); superset('core-js/es/math', /^es\.math\./); superset('core-js/es/number', /^es\.number\./); superset('core-js/es/object', /^es\.object\./); superset('core-js/es/promise', /^es\.promise/); superset('core-js/es/reflect', /^es\.reflect\./); superset('core-js/es/regexp', /^es\.regexp\./); superset('core-js/es/set', /^es\.set/); superset('core-js/es/string', /^es\.string\./); superset('core-js/es/symbol', /^es\.symbol/); superset('core-js/es/typed-array', /^es\.typed-array\./); superset('core-js/es/weak-map', /^es\.weak-map/); superset('core-js/es/weak-set', /^es\.weak-set/); equal('core-js/web', /^web\./); equal('core-js/stable', /^(?:es|web)\./); superset('core-js/stable/array', /^es\.array\./); superset('core-js/stable/array-buffer', /^es\.array-buffer\./); superset('core-js/stable/data-view', /^es\.data-view\./); superset('core-js/stable/date', /^es\.date\./); superset('core-js/stable/dom-collections', /^web\.dom-collections\./); superset('core-js/stable/error', /^es\.error\./); superset('core-js/stable/function', /^es\.function\./); superset('core-js/stable/json', /^es\.json\./); superset('core-js/stable/map', /^es\.map/); superset('core-js/stable/math', /^es\.math\./); superset('core-js/stable/number', /^es\.number\./); superset('core-js/stable/object', /^es\.object\./); superset('core-js/stable/promise', /^es\.promise/); superset('core-js/stable/reflect', /^es\.reflect\./); superset('core-js/stable/regexp', /^es\.regexp\./); superset('core-js/stable/set', /^es\.set/); superset('core-js/stable/string', /^es\.string\./); superset('core-js/stable/symbol', /^es\.symbol/); superset('core-js/stable/typed-array', /^es\.typed-array\./); superset('core-js/stable/url', /^web\.url(?:\.|$)/); superset('core-js/stable/url-search-params', /^web\.url-search-params/); superset('core-js/stable/weak-map', /^es\.weak-map/); superset('core-js/stable/weak-set', /^es\.weak-set/); superset('core-js/actual', /^(?:es|web)\./); superset('core-js/actual/array', /^es\.array\./); superset('core-js/actual/array-buffer', /^es\.array-buffer\./); superset('core-js/actual/data-view', /^es\.data-view\./); superset('core-js/actual/date', /^es\.date\./); superset('core-js/actual/dom-collections', /^web\.dom-collections\./); superset('core-js/actual/function', /^es\.function\./); superset('core-js/actual/json', /^es\.json\./); superset('core-js/actual/map', /^es\.map/); superset('core-js/actual/math', /^es\.math\./); superset('core-js/actual/number', /^es\.number\./); superset('core-js/actual/object', /^es\.object\./); superset('core-js/actual/promise', /^es\.promise/); superset('core-js/actual/reflect', /^es\.reflect\./); superset('core-js/actual/regexp', /^es\.regexp\./); superset('core-js/actual/set', /^es\.set/); superset('core-js/actual/string', /^es\.string\./); superset('core-js/actual/symbol', /^es\.symbol/); superset('core-js/actual/typed-array', /^es\.typed-array\./); superset('core-js/actual/url', /^web\.url(?:\.|$)/); superset('core-js/actual/url-search-params', /^web\.url-search-params/); superset('core-js/actual/weak-map', /^es\.weak-map/); superset('core-js/actual/weak-set', /^es\.weak-set/); equal('core-js/full', allModules); superset('core-js/full/array', /^(?:es|esnext)\.array\./); superset('core-js/full/array-buffer', /^(?:es|esnext)\.array-buffer\./); superset('core-js/full/async-iterator', /^(?:es|esnext)\.async-iterator\./); superset('core-js/full/bigint', /^(?:es|esnext)\.bigint\./); superset('core-js/full/data-view', /^(?:es|esnext)\.data-view\./); superset('core-js/full/date', /^(?:es|esnext)\.date\./); superset('core-js/full/dom-collections', /^web\.dom-collections\./); superset('core-js/full/error', /^es\.error\./); superset('core-js/full/function', /^(?:es|esnext)\.function\./); superset('core-js/full/iterator', /^(?:es|esnext)\.iterator\./); superset('core-js/full/json', /^(?:es|esnext)\.json\./); superset('core-js/full/map', /^(?:es|esnext)\.map/); superset('core-js/full/math', /^(?:es|esnext)\.math\./); superset('core-js/full/number', /^(?:es|esnext)\.number\./); superset('core-js/full/object', /^(?:es|esnext)\.object\./); superset('core-js/full/observable', /^(?:es|esnext)\.observable/); superset('core-js/full/promise', /^(?:es|esnext)\.promise/); superset('core-js/full/reflect', /^(?:es|esnext)\.reflect\./); superset('core-js/full/regexp', /^(?:es|esnext)\.regexp\./); superset('core-js/full/set', /^(?:es|esnext)\.set/); superset('core-js/full/string', /^(?:es|esnext)\.string\./); superset('core-js/full/symbol', /^(?:es|esnext)\.symbol/); superset('core-js/full/typed-array', /^(?:es|esnext)\.typed-array\./); superset('core-js/full/url', /^web\.url(?:\.|$)/); superset('core-js/full/url-search-params', /^web\.url-search-params/); superset('core-js/full/weak-map', /^(?:es|esnext)\.weak-map/); superset('core-js/full/weak-set', /^(?:es|esnext)\.weak-set/); equal('core-js/proposals', /^(?:es\.(?:map|string\.at)|esnext\.|web\.url)/); equal('core-js/stage', /^(?:es\.(?:map|string\.at)|esnext\.|web\.url)/); equal('core-js/stage/pre', /^(?:es\.(?:map|string\.at)|esnext\.|web\.url)/); subset('core-js/stage/0', /^(?:es\.(?:map|string\.at)|esnext\.|web\.url)/); subset('core-js/stage/1', /^(?:es\.(?:map|string\.at)|esnext\.|web\.url)/); subset('core-js/stage/2', /^es\.string\.at|esnext\./); subset('core-js/stage/3', /^es\.string\.at|esnext\./); subset('core-js/stage/4', /^es\.string\.at|esnext\./); async function unexpectedInnerNamespace(namespace, unexpected) { const paths = await glob(`packages/core-js/${ namespace }/**/*.js`); await Promise.all(paths.map(async path => { for (const dependency of konan(String(await fs.readFile(path))).strings) { if (unexpected.test(dependency)) { echo(chalk.red(`${ chalk.cyan(path) }: found unexpected dependency: ${ chalk.cyan(dependency) }`)); } } })); } await Promise.all([ unexpectedInnerNamespace('es', /\/(?:actual|full|stable)\//), unexpectedInnerNamespace('stable', /\/(?:actual|full)\//), unexpectedInnerNamespace('actual', /\/(?:es|full)\//), unexpectedInnerNamespace('full', /\/(?:es|stable)\//), ]); echo(chalk.green('entry points content tested')); core-js-3.33.2/tests/entries/index.mjs000066400000000000000000000000731451776221300176110ustar00rootroot00000000000000await import('./content.mjs'); await import('./unit.mjs'); core-js-3.33.2/tests/entries/unit.mjs000066400000000000000000001471351451776221300174740ustar00rootroot00000000000000/* eslint-disable import/no-dynamic-require, node/global-require -- required */ import { ok } from 'node:assert/strict'; const entries = await fs.readJson('packages/core-js-compat/entries.json'); const expected = new Set(Object.keys(entries)); const tested = new Set(); let PATH; function load(...components) { const path = [PATH, ...components].join('/'); tested.add(path); expected.delete(path); return require(path); } for (PATH of ['core-js-pure', 'core-js']) { for (const NS of ['es', 'stable', 'actual', 'full', 'features']) { let O; ok(load(NS, 'global-this').Math === Math); ok(new (load(NS, 'aggregate-error'))([42]).errors[0] === 42); ok(load(NS, 'object/assign')({ q: 1 }, { w: 2 }).w === 2); ok(load(NS, 'object/create')(Array.prototype) instanceof Array); ok(load(NS, 'object/define-property')({}, 'a', { value: 42 }).a === 42); ok(load(NS, 'object/define-properties')({}, { a: { value: 42 } }).a === 42); ok(load(NS, 'object/freeze')({})); ok(load(NS, 'object/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load(NS, 'object/get-own-property-names')({ q: 42 })[0] === 'q'); ok(load(NS, 'object/get-own-property-symbols')({ [Symbol('getOwnPropertySymbols test')]: 42 }).length === 1); ok(load(NS, 'object/get-prototype-of')([]) === Array.prototype); ok(load(NS, 'object/has-own')({ foo: 42 }, 'foo')); ok(load(NS, 'object/is')(NaN, NaN)); ok(load(NS, 'object/is-extensible')({})); ok(!load(NS, 'object/is-frozen')({})); ok(!load(NS, 'object/is-sealed')({})); ok(load(NS, 'object/keys')({ q: 0 })[0] === 'q'); ok(load(NS, 'object/prevent-extensions')({})); load(NS, 'object/proto'); ok(load(NS, 'object/seal')({})); ok(load(NS, 'object/set-prototype-of')({}, []) instanceof Array); ok(load(NS, 'object/to-string')([]) === '[object Array]'); ok(load(NS, 'object/entries')({ q: 2 })[0][0] === 'q'); ok(load(NS, 'object/from-entries')([['a', 42]]).a === 42); ok(load(NS, 'object/values')({ q: 2 })[0] === 2); ok(load(NS, 'object/get-own-property-descriptors')({ q: 1 }).q.enumerable); ok(typeof load(NS, 'object/define-getter') == 'function'); ok(typeof load(NS, 'object/define-setter') == 'function'); ok(typeof load(NS, 'object/lookup-getter') == 'function'); ok(typeof load(NS, 'object/lookup-setter') == 'function'); ok('values' in load(NS, 'object')); ok(load(NS, 'function/bind')(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load(NS, 'function/virtual/bind').call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load(NS, 'function/virtual').bind.call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); load(NS, 'function/name'); load(NS, 'function/has-instance'); load(NS, 'function'); ok(Array.isArray(load(NS, 'array/from')('qwe'))); ok(load(NS, 'array/is-array')([])); ok(Array.isArray(load(NS, 'array/of')('q', 'w', 'e'))); ok(load(NS, 'array/at')([1, 2, 3], -2) === 2); ok(load(NS, 'array/join')('qwe', 1) === 'q1w1e'); ok(load(NS, 'array/slice')('qwe', 1)[1] === 'e'); ok(load(NS, 'array/sort')([1, 3, 2])[1] === 2); ok(typeof load(NS, 'array/for-each') == 'function'); ok(typeof load(NS, 'array/map') == 'function'); ok(typeof load(NS, 'array/filter') == 'function'); ok(typeof load(NS, 'array/flat') == 'function'); ok(typeof load(NS, 'array/flat-map') == 'function'); ok(typeof load(NS, 'array/some') == 'function'); ok(typeof load(NS, 'array/every') == 'function'); ok(typeof load(NS, 'array/push') == 'function'); ok(typeof load(NS, 'array/reduce') == 'function'); ok(typeof load(NS, 'array/reduce-right') == 'function'); ok(typeof load(NS, 'array/reverse') == 'function'); ok(typeof load(NS, 'array/index-of') == 'function'); ok(typeof load(NS, 'array/last-index-of') == 'function'); ok(typeof load(NS, 'array/unshift') == 'function'); ok(load(NS, 'array/concat')([1, 2, 3], [4, 5, 6]).length === 6); ok(load(NS, 'array/copy-within')([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load(NS, 'array/entries')([])); ok(load(NS, 'array/fill')(Array(5), 2)[0] === 2); ok(load(NS, 'array/find')([2, 3, 4], it => it % 2) === 3); ok(load(NS, 'array/find-index')([2, 3, 4], it => it % 2) === 1); ok(load(NS, 'array/find-last')([1, 2, 3], it => it % 2) === 3); ok(load(NS, 'array/find-last-index')([1, 2, 3], it => it % 2) === 2); ok('next' in load(NS, 'array/keys')([])); ok('next' in load(NS, 'array/values')([])); ok(load(NS, 'array/includes')([1, 2, 3], 2)); ok('next' in load(NS, 'array/iterator')([])); ok(load(NS, 'array/with')([1, 2, 3], 1, 4)); ok(load(NS, 'array/to-reversed')([1, 2, 3])[0] === 3); ok(load(NS, 'array/to-sorted')([3, 2, 1])[0] === 1); ok(load(NS, 'array/to-spliced')([3, 2, 1], 1, 1, 4, 5).length === 4); ok(load(NS, 'array/virtual/at').call([1, 2, 3], -2) === 2); ok(load(NS, 'array/virtual/join').call('qwe', 1) === 'q1w1e'); ok(load(NS, 'array/virtual/slice').call('qwe', 1)[1] === 'e'); ok(load(NS, 'array/virtual/splice').call([1, 2, 3], 1, 2)[0] === 2); ok(load(NS, 'array/virtual/sort').call([1, 3, 2])[1] === 2); ok(typeof load(NS, 'array/virtual/for-each') == 'function'); ok(typeof load(NS, 'array/virtual/map') == 'function'); ok(typeof load(NS, 'array/virtual/filter') == 'function'); ok(typeof load(NS, 'array/virtual/flat') == 'function'); ok(typeof load(NS, 'array/virtual/flat-map') == 'function'); ok(typeof load(NS, 'array/virtual/some') == 'function'); ok(typeof load(NS, 'array/virtual/every') == 'function'); ok(typeof load(NS, 'array/virtual/push') == 'function'); ok(typeof load(NS, 'array/virtual/reduce') == 'function'); ok(typeof load(NS, 'array/virtual/reduce-right') == 'function'); ok(typeof load(NS, 'array/virtual/reverse') == 'function'); ok(typeof load(NS, 'array/virtual/index-of') == 'function'); ok(typeof load(NS, 'array/virtual/last-index-of') == 'function'); ok(typeof load(NS, 'array/virtual/unshift') == 'function'); ok(load(NS, 'array/virtual/concat').call([1, 2, 3], [4, 5, 6]).length === 6); ok(load(NS, 'array/virtual/copy-within').call([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load(NS, 'array/virtual/entries').call([])); ok(load(NS, 'array/virtual/fill').call(Array(5), 2)[0] === 2); ok(load(NS, 'array/virtual/find').call([2, 3, 4], it => it % 2) === 3); ok(load(NS, 'array/virtual/find-index').call([2, 3, 4], it => it % 2) === 1); ok(load(NS, 'array/virtual/find-last').call([1, 2, 3], it => it % 2) === 3); ok(load(NS, 'array/virtual/find-last-index').call([1, 2, 3], it => it % 2) === 2); ok('next' in load(NS, 'array/virtual/keys').call([])); ok('next' in load(NS, 'array/virtual/values').call([])); ok(load(NS, 'array/virtual/includes').call([1, 2, 3], 2)); ok('next' in load(NS, 'array/virtual/iterator').call([])); ok(load(NS, 'array/virtual/with').call([1, 2, 3], 1, 4)); ok(load(NS, 'array/virtual/to-reversed').call([1, 2, 3])[0] === 3); ok(load(NS, 'array/virtual/to-sorted').call([3, 2, 1])[0] === 1); ok(load(NS, 'array/virtual/to-spliced').call([3, 2, 1], 1, 1, 4, 5).length === 4); ok('map' in load(NS, 'array/virtual')); ok('from' in load(NS, 'array')); ok(load(NS, 'array/splice')([1, 2, 3], 1, 2)[0] === 2); ok(load(NS, 'error/constructor').Error(1, { cause: 7 }).cause === 7); ok(typeof load(NS, 'error/to-string') == 'function'); ok(load(NS, 'error').Error(1, { cause: 7 }).cause === 7); ok(load(NS, 'math/acosh')(1) === 0); ok(Object.is(load(NS, 'math/asinh')(-0), -0)); ok(load(NS, 'math/atanh')(1) === Infinity); ok(load(NS, 'math/cbrt')(-8) === -2); ok(load(NS, 'math/clz32')(0) === 32); ok(load(NS, 'math/cosh')(0) === 1); ok(load(NS, 'math/expm1')(-Infinity) === -1); ok(load(NS, 'math/fround')(0) === 0); ok(load(NS, 'math/hypot')(3, 4) === 5); ok(load(NS, 'math/imul')(2, 2) === 4); ok(load(NS, 'math/log10')(-0) === -Infinity); ok(load(NS, 'math/log1p')(-1) === -Infinity); ok(load(NS, 'math/log2')(1) === 0); ok(load(NS, 'math/sign')(-2) === -1); ok(Object.is(load(NS, 'math/sinh')(-0), -0)); ok(load(NS, 'math/tanh')(Infinity) === 1); ok(load(NS, 'math/to-string-tag') === 'Math'); ok(load(NS, 'math/trunc')(1.5) === 1); ok('cbrt' in load(NS, 'math')); ok(load(NS, 'number/constructor')('5') === 5); ok(load(NS, 'number/epsilon') === 2 ** -52); ok(load(NS, 'number/is-finite')(42.5)); ok(load(NS, 'number/is-integer')(42.5) === false); ok(load(NS, 'number/is-nan')(NaN)); ok(load(NS, 'number/is-safe-integer')(42)); ok(load(NS, 'number/max-safe-integer') === 0x1FFFFFFFFFFFFF); ok(load(NS, 'number/min-safe-integer') === -0x1FFFFFFFFFFFFF); ok(load(NS, 'number/parse-float')('1.5') === 1.5); ok(load(NS, 'number/parse-int')('2.1') === 2); ok(load(NS, 'number/to-exponential')(1, 1) === '1.0e+0'); ok(load(NS, 'number/to-fixed')(1, 1) === '1.0'); ok(load(NS, 'number/to-precision')(1) === '1'); ok(load(NS, 'parse-float')('1.5') === 1.5); ok(load(NS, 'parse-int')('2.1') === 2); ok(load(NS, 'number/virtual/to-exponential').call(1, 1) === '1.0e+0'); ok(load(NS, 'number/virtual/to-fixed').call(1, 1) === '1.0'); ok(load(NS, 'number/virtual/to-precision').call(1) === '1'); ok('toPrecision' in load(NS, 'number/virtual')); ok('isNaN' in load(NS, 'number')); ok(load(NS, 'reflect/apply')((a, b) => a + b, null, [1, 2]) === 3); ok(load(NS, 'reflect/construct')(function () { return this.a = 2; }, []).a === 2); load(NS, 'reflect/define-property')(O = {}, 'a', { value: 42 }); ok(O.a === 42); ok(load(NS, 'reflect/delete-property')({ q: 1 }, 'q')); ok(load(NS, 'reflect/get')({ q: 1 }, 'q') === 1); ok(load(NS, 'reflect/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load(NS, 'reflect/get-prototype-of')([]) === Array.prototype); ok(load(NS, 'reflect/has')({ q: 1 }, 'q')); ok(load(NS, 'reflect/is-extensible')({})); ok(load(NS, 'reflect/own-keys')({ q: 1 })[0] === 'q'); ok(load(NS, 'reflect/prevent-extensions')({})); ok(load(NS, 'reflect/set')({}, 'a', 42)); load(NS, 'reflect/set-prototype-of')(O = {}, []); ok(load(NS, 'reflect/to-string-tag') === 'Reflect'); ok(O instanceof Array); ok('has' in load(NS, 'reflect')); ok(load(NS, 'string/from-code-point')(97) === 'a'); ok(load(NS, 'string/raw')({ raw: 'test' }, 0, 1, 2) === 't0e1s2t'); ok(load(NS, 'string/at')('a', 0) === 'a'); ok(load(NS, 'string/trim')(' ab ') === 'ab'); ok(load(NS, 'string/trim-start')(' a ') === 'a '); ok(load(NS, 'string/trim-end')(' a ') === ' a'); ok(load(NS, 'string/trim-left')(' a ') === 'a '); ok(load(NS, 'string/trim-right')(' a ') === ' a'); ok(load(NS, 'string/code-point-at')('a', 0) === 97); ok(load(NS, 'string/ends-with')('qwe', 'we')); ok(load(NS, 'string/includes')('qwe', 'w')); ok(load(NS, 'string/repeat')('q', 3) === 'qqq'); ok(load(NS, 'string/starts-with')('qwe', 'qw')); ok(typeof load(NS, 'string/anchor') == 'function'); ok(typeof load(NS, 'string/big') == 'function'); ok(typeof load(NS, 'string/blink') == 'function'); ok(typeof load(NS, 'string/bold') == 'function'); ok(typeof load(NS, 'string/fixed') == 'function'); ok(typeof load(NS, 'string/fontcolor') == 'function'); ok(typeof load(NS, 'string/fontsize') == 'function'); ok(typeof load(NS, 'string/italics') == 'function'); ok(typeof load(NS, 'string/link') == 'function'); ok(typeof load(NS, 'string/small') == 'function'); ok(typeof load(NS, 'string/strike') == 'function'); ok(typeof load(NS, 'string/sub') == 'function'); ok(load(NS, 'string/substr')('12345', 1, 3) === '234'); ok(typeof load(NS, 'string/sup') == 'function'); ok(typeof load(NS, 'string/replace-all') == 'function'); ok(load(NS, 'string/pad-start')('a', 3) === ' a'); ok(load(NS, 'string/pad-end')('a', 3) === 'a '); ok(load(NS, 'string/is-well-formed')('a')); ok(load(NS, 'string/to-well-formed')('a') === 'a'); ok('next' in load(NS, 'string/iterator')('qwe')); ok(load(NS, 'string/virtual/at').call('a', 0) === 'a'); ok(load(NS, 'string/virtual/code-point-at').call('a', 0) === 97); ok(load(NS, 'string/virtual/ends-with').call('qwe', 'we')); ok(load(NS, 'string/virtual/includes').call('qwe', 'w')); ok(typeof load(NS, 'string/virtual/match-all') == 'function'); ok(typeof load(NS, 'string/virtual/replace-all') == 'function'); ok(load(NS, 'string/virtual/repeat').call('q', 3) === 'qqq'); ok(load(NS, 'string/virtual/starts-with').call('qwe', 'qw')); ok(load(NS, 'string/virtual/trim').call(' ab ') === 'ab'); ok(load(NS, 'string/virtual/trim-start').call(' a ') === 'a '); ok(load(NS, 'string/virtual/trim-end').call(' a ') === ' a'); ok(load(NS, 'string/virtual/trim-left').call(' a ') === 'a '); ok(load(NS, 'string/virtual/trim-right').call(' a ') === ' a'); ok(typeof load(NS, 'string/virtual/anchor') == 'function'); ok(typeof load(NS, 'string/virtual/big') == 'function'); ok(typeof load(NS, 'string/virtual/blink') == 'function'); ok(typeof load(NS, 'string/virtual/bold') == 'function'); ok(typeof load(NS, 'string/virtual/fixed') == 'function'); ok(typeof load(NS, 'string/virtual/fontcolor') == 'function'); ok(typeof load(NS, 'string/virtual/fontsize') == 'function'); ok(typeof load(NS, 'string/virtual/italics') == 'function'); ok(typeof load(NS, 'string/virtual/link') == 'function'); ok(typeof load(NS, 'string/virtual/small') == 'function'); ok(typeof load(NS, 'string/virtual/strike') == 'function'); ok(typeof load(NS, 'string/virtual/sub') == 'function'); ok(load(NS, 'string/virtual/substr').call('12345', 1, 3) === '234'); ok(typeof load(NS, 'string/virtual/sup') == 'function'); ok(load(NS, 'string/virtual/pad-start').call('a', 3) === ' a'); ok(load(NS, 'string/virtual/pad-end').call('a', 3) === 'a '); ok(load(NS, 'string/virtual/is-well-formed').call('a')); ok(load(NS, 'string/virtual/to-well-formed').call('a') === 'a'); ok('next' in load(NS, 'string/virtual/iterator').call('qwe')); ok('padEnd' in load(NS, 'string/virtual')); ok('raw' in load(NS, 'string')); ok(String(load(NS, 'regexp/constructor')('a', 'g')) === '/a/g'); ok(load(NS, 'regexp/to-string')(/./g) === '/./g'); ok(load(NS, 'regexp/flags')(/./g) === 'g'); ok(typeof load(NS, 'regexp/match') == 'function'); ok(typeof load(NS, 'regexp/replace') == 'function'); ok(typeof load(NS, 'regexp/search') == 'function'); ok(typeof load(NS, 'regexp/split') == 'function'); ok(typeof load(NS, 'regexp/dot-all') == 'function'); ok(typeof load(NS, 'regexp/sticky') == 'function'); ok(typeof load(NS, 'regexp/test') == 'function'); load(NS, 'regexp'); ok(load(NS, 'escape')('!q2ф') === '%21q2%u0444'); ok(load(NS, 'unescape')('%21q2%u0444') === '!q2ф'); ok(load(NS, 'json').stringify([1]) === '[1]'); ok(load(NS, 'json/stringify')([1]) === '[1]'); ok(load(NS, 'json/to-string-tag') === 'JSON'); ok(typeof load(NS, 'date/now')(new Date()) === 'number'); const date = new Date(); ok(load(NS, 'date/get-year')(date) === date.getFullYear() - 1900); load(NS, 'date/set-year')(date, 1); ok(date.getFullYear() === 1901); ok(typeof load(NS, 'date/to-string')(date) === 'string'); ok(load(NS, 'date/to-gmt-string')(date) === date.toUTCString()); ok(typeof load(NS, 'date/to-primitive')(new Date(), 'number') === 'number'); ok(typeof load(NS, 'date/to-iso-string')(new Date()) === 'string'); ok(load(NS, 'date/to-json')(Infinity) === null); ok(load(NS, 'date')); ok(typeof load(NS, 'symbol') == 'function'); ok(typeof load(NS, 'symbol/for') == 'function'); ok(typeof load(NS, 'symbol/key-for') == 'function'); ok(Function[load(NS, 'symbol/has-instance')](it => it)); ok(load(NS, 'symbol/is-concat-spreadable')); ok(load(NS, 'symbol/iterator')); ok(load(NS, 'symbol/match')); ok(load(NS, 'symbol/match-all')); ok(load(NS, 'symbol/replace')); ok(load(NS, 'symbol/search')); ok(load(NS, 'symbol/species')); ok(load(NS, 'symbol/split')); ok(load(NS, 'symbol/to-primitive')); ok(load(NS, 'symbol/to-string-tag')); ok(load(NS, 'symbol/unscopables')); ok(load(NS, 'symbol/async-iterator')); load(NS, 'symbol/description'); const Map = load(NS, 'map'); const Set = load(NS, 'set'); const WeakMap = load(NS, 'weak-map'); const WeakSet = load(NS, 'weak-set'); ok(new Map([[1, 2], [3, 4]]).size === 2); ok(new Set([1, 2, 3, 2, 1]).size === 3); ok(new WeakMap([[O = {}, 42]]).get(O) === 42); ok(new WeakSet([O = {}]).has(O)); const Promise = load(NS, 'promise'); ok('then' in Promise.prototype); ok(load(NS, 'promise/all-settled')([1, 2, 3]) instanceof Promise); ok(load(NS, 'promise/any')([1, 2, 3]) instanceof Promise); ok(load(NS, 'promise/finally')(new Promise(resolve => resolve), it => it) instanceof Promise); ok(load(NS, 'is-iterable')([])); ok(typeof load(NS, 'get-iterator-method')([]) == 'function'); ok('next' in load(NS, 'get-iterator')([])); ok('Map' in load(NS)); const instanceAt = load(NS, 'instance/at'); ok(typeof instanceAt == 'function'); ok(instanceAt({}) === undefined); ok(typeof instanceAt([]) == 'function'); ok(typeof instanceAt('') == 'function'); ok(instanceAt([]).call([1, 2, 3], 2) === 3); ok(instanceAt('').call('123', 2) === '3'); const instanceBind = load(NS, 'instance/bind'); ok(typeof instanceBind == 'function'); ok(instanceBind({}) === undefined); ok(typeof instanceBind(it => it) == 'function'); ok(instanceBind(it => it).call(it => it, 1, 2)() === 2); const instanceCodePointAt = load(NS, 'instance/code-point-at'); ok(typeof instanceCodePointAt == 'function'); ok(instanceCodePointAt({}) === undefined); ok(typeof instanceCodePointAt('') == 'function'); ok(instanceCodePointAt('').call('a', 0) === 97); const instanceConcat = load(NS, 'instance/concat'); ok(typeof instanceConcat == 'function'); ok(instanceConcat({}) === undefined); ok(typeof instanceConcat([]) == 'function'); ok(instanceConcat([]).call([1, 2, 3], [4, 5, 6]).length === 6); const instanceCopyWithin = load(NS, 'instance/copy-within'); ok(typeof instanceCopyWithin == 'function'); ok(instanceCopyWithin({}) === undefined); ok(typeof instanceCopyWithin([]) == 'function'); ok(instanceCopyWithin([]).call([1, 2, 3, 4, 5], 0, 3)[0] === 4); const instanceEndsWith = load(NS, 'instance/ends-with'); ok(typeof instanceEndsWith == 'function'); ok(instanceEndsWith({}) === undefined); ok(typeof instanceEndsWith('') == 'function'); ok(instanceEndsWith('').call('qwe', 'we')); const instanceEntries = load(NS, 'instance/entries'); ok(typeof instanceEntries == 'function'); ok(instanceEntries({}) === undefined); ok(typeof instanceEntries([]) == 'function'); ok(instanceEntries([]).call([1, 2, 3]).next().value[1] === 1); const instanceEvery = load(NS, 'instance/every'); ok(typeof instanceEvery == 'function'); ok(instanceEvery({}) === undefined); ok(typeof instanceEvery([]) == 'function'); ok(instanceEvery([]).call([1, 2, 3], it => typeof it == 'number')); const instanceFill = load(NS, 'instance/fill'); ok(typeof instanceFill == 'function'); ok(instanceFill({}) === undefined); ok(typeof instanceFill([]) == 'function'); ok(instanceFill([]).call(Array(5), 42)[3] === 42); const instanceFilter = load(NS, 'instance/filter'); ok(typeof instanceFilter == 'function'); ok(instanceFilter({}) === undefined); ok(typeof instanceFilter([]) == 'function'); ok(instanceFilter([]).call([1, 2, 3], it => it % 2).length === 2); const instanceFind = load(NS, 'instance/find'); ok(typeof instanceFind == 'function'); ok(instanceFind({}) === undefined); ok(typeof instanceFind([]) == 'function'); ok(instanceFind([]).call([1, 2, 3], it => it % 2) === 1); const instanceFindIndex = load(NS, 'instance/find-index'); ok(typeof instanceFindIndex == 'function'); ok(instanceFindIndex({}) === undefined); ok(typeof instanceFindIndex([]) == 'function'); ok(instanceFindIndex([]).call([1, 2, 3], it => it % 2) === 0); const instanceFindLast = load(NS, 'instance/find-last'); ok(typeof instanceFindLast == 'function'); ok(instanceFindLast({}) === undefined); ok(typeof instanceFindLast([]) == 'function'); ok(instanceFindLast([]).call([1, 2, 3], it => it % 2) === 3); const instanceFindLastIndex = load(NS, 'instance/find-last-index'); ok(typeof instanceFindLastIndex == 'function'); ok(instanceFindLastIndex({}) === undefined); ok(typeof instanceFindLastIndex([]) == 'function'); ok(instanceFindLastIndex([]).call([1, 2, 3], it => it % 2) === 2); const instanceFlags = load(NS, 'instance/flags'); ok(typeof instanceFlags == 'function'); ok(instanceFlags({}) === undefined); ok(instanceFlags(/./g) === 'g'); const instanceFlatMap = load(NS, 'instance/flat-map'); ok(typeof instanceFlatMap == 'function'); ok(instanceFlatMap({}) === undefined); ok(typeof instanceFlatMap([]) == 'function'); ok(instanceFlatMap([]).call([1, 2, 3], (v, i) => [v, i]).length === 6); const instanceFlat = load(NS, 'instance/flat'); ok(typeof instanceFlat == 'function'); ok(instanceFlat({}) === undefined); ok(typeof instanceFlat([]) == 'function'); ok(instanceFlat([]).call([1, [2, 3], [4, [5, [6]]]]).length === 5); const instanceForEach = load(NS, 'instance/for-each'); ok(typeof instanceForEach == 'function'); ok(instanceForEach({}) === undefined); ok(typeof instanceForEach([]) == 'function'); const instanceIncludes = load(NS, 'instance/includes'); ok(typeof instanceIncludes == 'function'); ok(instanceIncludes({}) === undefined); ok(typeof instanceIncludes([]) == 'function'); ok(typeof instanceIncludes('') == 'function'); ok(instanceIncludes([]).call([1, 2, 3], 2)); ok(instanceIncludes('').call('123', '2')); const instanceIndexOf = load(NS, 'instance/index-of'); ok(typeof instanceIndexOf == 'function'); ok(instanceIndexOf({}) === undefined); ok(typeof instanceIndexOf([]) == 'function'); ok(instanceIndexOf([]).call([1, 2, 3], 2) === 1); const instanceKeys = load(NS, 'instance/keys'); ok(typeof instanceKeys == 'function'); ok(instanceKeys({}) === undefined); ok(typeof instanceKeys([]) == 'function'); ok(instanceKeys([]).call([1, 2, 3]).next().value === 0); const instanceIsWellFormed = load(NS, 'instance/is-well-formed'); ok(typeof instanceIsWellFormed == 'function'); ok(instanceIsWellFormed({}) === undefined); ok(typeof instanceIsWellFormed('') == 'function'); ok(instanceIsWellFormed('').call('a')); const instanceLastIndexOf = load(NS, 'instance/last-index-of'); ok(typeof instanceLastIndexOf == 'function'); ok(instanceLastIndexOf({}) === undefined); ok(typeof instanceLastIndexOf([]) == 'function'); ok(instanceLastIndexOf([]).call([1, 2, 3], 2) === 1); const instanceMap = load(NS, 'instance/map'); ok(typeof instanceMap == 'function'); ok(instanceMap({}) === undefined); ok(typeof instanceMap([]) == 'function'); ok(instanceMap([]).call([1, 2, 3], it => it % 2)[1] === 0); const instanceMatchAll = load(NS, 'instance/match-all'); ok(typeof instanceMatchAll == 'function'); ok(instanceMatchAll({}) === undefined); ok(typeof instanceMatchAll('') == 'function'); ok(instanceMatchAll('').call('test1test2', /(?test\d)/g).next().value.groups.test === 'test1'); const instancePadEnd = load(NS, 'instance/pad-end'); ok(typeof instancePadEnd == 'function'); ok(instancePadEnd({}) === undefined); ok(typeof instancePadEnd('') == 'function'); ok(instancePadEnd('').call('a', 3, 'b') === 'abb'); const instancePadStart = load(NS, 'instance/pad-start'); ok(typeof instancePadStart == 'function'); ok(instancePadStart({}) === undefined); ok(typeof instancePadStart('') == 'function'); ok(instancePadStart('').call('a', 3, 'b') === 'bba'); const instancePush = load(NS, 'instance/push'); ok(typeof instancePush == 'function'); ok(instancePush({}) === undefined); ok(typeof instancePush([]) == 'function'); ok(instancePush([]).call([1], 8) === 2); const instanceReduceRight = load(NS, 'instance/reduce-right'); ok(typeof instanceReduceRight == 'function'); ok(instanceReduceRight({}) === undefined); ok(typeof instanceReduceRight([]) == 'function'); ok(instanceReduceRight([]).call([1, 2, 3], (memo, it) => it + memo, '') === '123'); const instanceReduce = load(NS, 'instance/reduce'); ok(typeof instanceReduce == 'function'); ok(instanceReduce({}) === undefined); ok(typeof instanceReduce([]) == 'function'); ok(instanceReduce([]).call([1, 2, 3], (memo, it) => it + memo, '') === '321'); const instanceRepeat = load(NS, 'instance/repeat'); ok(typeof instanceRepeat == 'function'); ok(instanceRepeat({}) === undefined); ok(typeof instanceRepeat('') == 'function'); ok(instanceRepeat('').call('a', 3) === 'aaa'); const instanceReplaceAll = load(NS, 'instance/replace-all'); ok(typeof instanceReplaceAll == 'function'); ok(instanceReplaceAll({}) === undefined); ok(typeof instanceReplaceAll('') == 'function'); ok(instanceReplaceAll('').call('aba', 'a', 'c') === 'cbc'); const instanceReverse = load(NS, 'instance/reverse'); ok(typeof instanceReverse == 'function'); ok(instanceReverse({}) === undefined); ok(typeof instanceReverse([]) == 'function'); const instanceSlice = load(NS, 'instance/slice'); ok(typeof instanceSlice == 'function'); ok(instanceSlice({}) === undefined); ok(typeof instanceSlice([]) == 'function'); const instanceSome = load(NS, 'instance/some'); ok(typeof instanceSome == 'function'); ok(instanceSome({}) === undefined); ok(typeof instanceSome([]) == 'function'); ok(instanceSome([]).call([1, 2, 3], it => typeof it == 'number')); const instanceSort = load(NS, 'instance/sort'); ok(typeof instanceSort == 'function'); ok(instanceSort({}) === undefined); ok(typeof instanceSort([]) == 'function'); const instanceSplice = load(NS, 'instance/splice'); ok(typeof instanceSplice == 'function'); ok(instanceSplice({}) === undefined); ok(typeof instanceSplice([]) == 'function'); const instanceStartsWith = load(NS, 'instance/starts-with'); ok(typeof instanceStartsWith == 'function'); ok(instanceStartsWith({}) === undefined); ok(typeof instanceStartsWith('') == 'function'); ok(instanceStartsWith('').call('qwe', 'qw')); const instanceToReversed = load(NS, 'instance/to-reversed'); ok(typeof instanceToReversed == 'function'); ok(instanceToReversed({}) === undefined); ok(typeof instanceToReversed([]) == 'function'); ok(instanceToReversed([]).call([1, 2, 3])[0] === 3); const instanceToSorted = load(NS, 'instance/to-sorted'); ok(typeof instanceToSorted == 'function'); ok(instanceToSorted({}) === undefined); ok(typeof instanceToSorted([]) == 'function'); ok(instanceToSorted([]).call([3, 2, 1])[0] === 1); const instanceToSpliced = load(NS, 'instance/to-spliced'); ok(typeof instanceToSpliced == 'function'); ok(instanceToSpliced({}) === undefined); ok(typeof instanceToSpliced([]) == 'function'); ok(instanceToSpliced([]).call([3, 2, 1], 1, 1, 4, 5).length === 4); const instanceToWellFormed = load(NS, 'instance/to-well-formed'); ok(typeof instanceToWellFormed == 'function'); ok(instanceToWellFormed({}) === undefined); ok(typeof instanceToWellFormed('') == 'function'); ok(instanceToWellFormed('').call('a') === 'a'); const instanceTrimEnd = load(NS, 'instance/trim-end'); ok(typeof instanceTrimEnd == 'function'); ok(instanceTrimEnd({}) === undefined); ok(typeof instanceTrimEnd('') == 'function'); ok(instanceTrimEnd('').call(' 1 ') === ' 1'); const instanceTrimLeft = load(NS, 'instance/trim-left'); ok(typeof instanceTrimLeft == 'function'); ok(instanceTrimLeft({}) === undefined); ok(typeof instanceTrimLeft('') == 'function'); ok(instanceTrimLeft('').call(' 1 ') === '1 '); const instanceTrimRight = load(NS, 'instance/trim-right'); ok(typeof instanceTrimRight == 'function'); ok(instanceTrimRight({}) === undefined); ok(typeof instanceTrimRight('') == 'function'); ok(instanceTrimRight('').call(' 1 ') === ' 1'); const instanceTrimStart = load(NS, 'instance/trim-start'); ok(typeof instanceTrimStart == 'function'); ok(instanceTrimStart({}) === undefined); ok(typeof instanceTrimStart('') == 'function'); ok(instanceTrimStart('').call(' 1 ') === '1 '); const instanceTrim = load(NS, 'instance/trim'); ok(typeof instanceTrim == 'function'); ok(instanceTrim({}) === undefined); ok(typeof instanceTrim('') == 'function'); ok(instanceTrim('').call(' 1 ') === '1'); const instanceUnshift = load(NS, 'instance/unshift'); ok(typeof instanceUnshift == 'function'); ok(instanceUnshift({}) === undefined); ok(typeof instanceUnshift([]) == 'function'); const instanceUnshiftTestArray = [1]; ok(instanceUnshift([]).call(instanceUnshiftTestArray, 8)); ok(instanceUnshiftTestArray[0] === 8); const instanceValues = load(NS, 'instance/values'); ok(typeof instanceValues == 'function'); ok(instanceValues({}) === undefined); ok(typeof instanceValues([]) == 'function'); ok(instanceValues([]).call([1, 2, 3]).next().value === 1); const instanceWith = load(NS, 'instance/with'); ok(typeof instanceWith == 'function'); ok(instanceWith({}) === undefined); ok(typeof instanceWith([]) == 'function'); ok(instanceWith([]).call([1, 2, 3], 1, 4)[1] === 4); } for (const NS of ['stable', 'actual', 'full', 'features']) { ok(load(NS, 'atob')('Zg==') === 'f'); ok(load(NS, 'btoa')('f') === 'Zg=='); ok(typeof load(NS, 'dom-exception/constructor') == 'function'); ok(load(NS, 'dom-exception/to-string-tag') === 'DOMException'); ok(typeof load(NS, 'dom-exception') == 'function'); ok(typeof load(NS, 'dom-collections').iterator == 'function'); ok(typeof load(NS, 'dom-collections/for-each') == 'function'); ok(typeof load(NS, 'dom-collections/iterator') == 'function'); ok(load(NS, 'self').Math === Math); ok(typeof load(NS, 'set-timeout') == 'function'); ok(typeof load(NS, 'set-interval') == 'function'); ok(typeof load(NS, 'set-immediate') == 'function'); ok(load(NS, 'structured-clone')(42) === 42); ok(typeof load(NS, 'clear-immediate') == 'function'); ok(typeof load(NS, 'queue-microtask') == 'function'); ok(typeof load(NS, 'url') == 'function'); ok(load(NS, 'url/can-parse')('a:b')); load(NS, 'url/to-json'); ok(typeof load(NS, 'url-search-params') == 'function'); } for (const NS of ['actual', 'full', 'features']) { ok(typeof load(NS, 'array/from-async') == 'function'); ok(typeof load(NS, 'array/group') == 'function'); ok(typeof load(NS, 'array/group-to-map') == 'function'); ok(typeof load(NS, 'array/group-by') == 'function'); ok(typeof load(NS, 'array/group-by-to-map') == 'function'); ok(typeof load(NS, 'array/virtual/group') == 'function'); ok(typeof load(NS, 'array/virtual/group-to-map') == 'function'); ok(typeof load(NS, 'array/virtual/group-by') == 'function'); ok(typeof load(NS, 'array/virtual/group-by-to-map') == 'function'); load(NS, 'array-buffer/detached'); load(NS, 'array-buffer/transfer'); load(NS, 'array-buffer/transfer-to-fixed-length'); ok(typeof load(NS, 'async-iterator') == 'function'); ok(typeof load(NS, 'async-iterator/drop') == 'function'); ok(typeof load(NS, 'async-iterator/every') == 'function'); ok(typeof load(NS, 'async-iterator/filter') == 'function'); ok(typeof load(NS, 'async-iterator/find') == 'function'); ok(typeof load(NS, 'async-iterator/flat-map') == 'function'); ok(typeof load(NS, 'async-iterator/for-each') == 'function'); ok(typeof load(NS, 'async-iterator/from') == 'function'); ok(typeof load(NS, 'async-iterator/map') == 'function'); ok(typeof load(NS, 'async-iterator/reduce') == 'function'); ok(typeof load(NS, 'async-iterator/some') == 'function'); ok(typeof load(NS, 'async-iterator/take') == 'function'); ok(typeof load(NS, 'async-iterator/to-array') == 'function'); load(NS, 'data-view/get-float16'); load(NS, 'data-view/set-float16'); ok(load(NS, 'function/metadata') === null); ok(typeof load(NS, 'iterator') == 'function'); ok(typeof load(NS, 'iterator/drop') == 'function'); ok(typeof load(NS, 'iterator/every') == 'function'); ok(typeof load(NS, 'iterator/filter') == 'function'); ok(typeof load(NS, 'iterator/find') == 'function'); ok(typeof load(NS, 'iterator/flat-map') == 'function'); ok(typeof load(NS, 'iterator/for-each') == 'function'); ok(typeof load(NS, 'iterator/from') == 'function'); ok(typeof load(NS, 'iterator/map') == 'function'); ok(typeof load(NS, 'iterator/reduce') == 'function'); ok(typeof load(NS, 'iterator/some') == 'function'); ok(typeof load(NS, 'iterator/take') == 'function'); ok(typeof load(NS, 'iterator/to-array') == 'function'); ok(typeof load(NS, 'iterator/to-async') == 'function'); ok(load(NS, 'json/is-raw-json')({}) === false); ok(load(NS, 'json/parse')('[42]', (key, value, { source }) => typeof value == 'number' ? source + source : value)[0] === '4242'); ok(typeof load(NS, 'json/raw-json')(42) == 'object'); ok(load(NS, 'map/group-by')([], it => it) instanceof load(NS, 'map')); ok(load(NS, 'math/f16round')(1.337) === 1.3369140625); ok(load(NS, 'promise/with-resolvers')().promise instanceof load(NS, 'promise')); ok(load(NS, 'object/group-by')([1, 2, 3, 4, 5], it => it % 2 === 0 ? 'even' : 'odd').odd.length === 3); ok(load(NS, 'set/difference')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 2); ok(load(NS, 'set/intersection')(new Set([1, 2, 3]), new Set([1, 3, 4])).size === 2); ok(load(NS, 'set/is-disjoint-from')(new Set([1, 2, 3]), new Set([4, 5, 6]))); ok(load(NS, 'set/is-subset-of')(new Set([1, 2, 3]), new Set([1, 2, 3, 4]))); ok(load(NS, 'set/is-superset-of')(new Set([1, 2, 3, 4]), new Set([1, 2, 3]))); ok(load(NS, 'set/symmetric-difference')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 4); ok(load(NS, 'set/union')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 5); ok(load(NS, 'symbol/dispose')); ok(load(NS, 'symbol/metadata')); ok(new (load(NS, 'suppressed-error'))(1, 2).suppressed === 2); ok(typeof load(NS, 'disposable-stack') == 'function'); ok(typeof load(NS, 'disposable-stack/constructor') == 'function'); load(NS, 'iterator/dispose'); ok(load(NS, 'symbol/async-dispose')); load(NS, 'async-iterator/async-dispose'); ok(typeof load(NS, 'async-disposable-stack') == 'function'); ok(typeof load(NS, 'async-disposable-stack/constructor') == 'function'); const instanceGroup = load(NS, 'instance/group'); ok(typeof instanceGroup == 'function'); ok(instanceGroup({}) === undefined); ok(typeof instanceGroup([]) == 'function'); ok(instanceGroup([]).call([1, 2, 3], it => it % 2)[1].length === 2); const instanceGroupToMap = load(NS, 'instance/group-to-map'); ok(typeof instanceGroupToMap == 'function'); ok(instanceGroupToMap({}) === undefined); ok(typeof instanceGroupToMap([]) == 'function'); ok(instanceGroupToMap([]).call([1, 2, 3], it => it % 2).get(1).length === 2); const instanceGroupBy = load(NS, 'instance/group-by'); ok(typeof instanceGroupBy == 'function'); ok(instanceGroupBy({}) === undefined); ok(typeof instanceGroupBy([]) == 'function'); ok(instanceGroupBy([]).call([1, 2, 3], it => it % 2)[1].length === 2); const instanceGroupByToMap = load(NS, 'instance/group-by-to-map'); ok(typeof instanceGroupByToMap == 'function'); ok(instanceGroupByToMap({}) === undefined); ok(typeof instanceGroupByToMap([]) == 'function'); ok(instanceGroupByToMap([]).call([1, 2, 3], it => it % 2).get(1).length === 2); } for (const NS of ['full', 'features']) { const Map = load(NS, 'map'); const Set = load(NS, 'set'); const WeakMap = load(NS, 'weak-map'); const WeakSet = load(NS, 'weak-set'); ok(typeof load(NS, 'array/filter-out') == 'function'); ok(typeof load(NS, 'array/filter-reject') == 'function'); ok(typeof load(NS, 'array/is-template-object') == 'function'); load(NS, 'array/last-item'); load(NS, 'array/last-index'); ok(typeof load(NS, 'array/unique-by') == 'function'); ok(typeof load(NS, 'array/virtual/filter-out') == 'function'); ok(typeof load(NS, 'array/virtual/filter-reject') == 'function'); ok(typeof load(NS, 'array/virtual/unique-by') == 'function'); ok(typeof load(NS, 'async-iterator/as-indexed-pairs') == 'function'); ok(typeof load(NS, 'async-iterator/indexed') == 'function'); load(NS, 'bigint/range'); load(NS, 'bigint'); load(NS, 'data-view/get-uint8-clamped'); load(NS, 'data-view/set-uint8-clamped'); ok(typeof load(NS, 'composite-key')({}, 1, {}) === 'object'); ok(typeof load(NS, 'composite-symbol')({}, 1, {}) === 'symbol'); ok(load(NS, 'function/demethodize')([].slice)([1, 2, 3], 1)[0] === 2); ok(load(NS, 'function/virtual/demethodize').call([].slice)([1, 2, 3], 1)[0] === 2); ok(!load(NS, 'function/is-callable')(class { /* empty */ })); ok(!load(NS, 'function/is-constructor')(it => it)); ok(load(NS, 'function/un-this')([].slice)([1, 2, 3], 1)[0] === 2); ok(load(NS, 'function/virtual/un-this').call([].slice)([1, 2, 3], 1)[0] === 2); ok(typeof load(NS, 'iterator/as-indexed-pairs') == 'function'); ok(typeof load(NS, 'iterator/indexed') == 'function'); ok(load(NS, 'iterator/range')(1, 2).next().value === 1); ok(load(NS, 'map/delete-all')(new Map(), 1, 2) === false); ok(load(NS, 'map/emplace')(new Map([[1, 2]]), 1, { update: it => it ** 2 }) === 4); ok(load(NS, 'map/every')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === false); ok(load(NS, 'map/filter')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2).size === 1); ok(load(NS, 'map/find')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === 3); ok(load(NS, 'map/find-key')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === 2); ok(load(NS, 'map/from')([[1, 2], [3, 4]]) instanceof Map); ok(load(NS, 'map/includes')(new Map([[1, 2]]), 2), true); ok(load(NS, 'map/key-by')([], it => it) instanceof Map); ok(load(NS, 'map/key-of')(new Map([[1, 2]]), 2), 1); ok(load(NS, 'map/map-keys')(new Map([[1, 2], [2, 3], [3, 4]]), it => it).size === 3); ok(load(NS, 'map/map-values')(new Map([[1, 2], [2, 3], [3, 4]]), it => it).size === 3); ok(load(NS, 'map/merge')(new Map([[1, 2], [2, 3]]), [[2, 4], [4, 5]]).size === 3); ok(load(NS, 'map/update-or-insert')(new Map([[1, 2]]), 1, it => it ** 2, () => 42) === 4); ok(load(NS, 'map/upsert')(new Map([[1, 2]]), 1, it => it ** 2, () => 42) === 4); ok(load(NS, 'math/clamp')(6, 2, 4) === 4); ok(load(NS, 'math/deg-per-rad') === Math.PI / 180); ok(load(NS, 'math/degrees')(Math.PI) === 180); ok(load(NS, 'math/fscale')(3, 1, 2, 1, 2) === 3); ok(load(NS, 'math/iaddh')(3, 2, 0xFFFFFFFF, 4) === 7); ok(load(NS, 'math/isubh')(3, 4, 0xFFFFFFFF, 2) === 1); ok(load(NS, 'math/imulh')(0xFFFFFFFF, 7) === -1); ok(load(NS, 'math/rad-per-deg') === 180 / Math.PI); ok(load(NS, 'math/radians')(180) === Math.PI); ok(load(NS, 'math/scale')(3, 1, 2, 1, 2) === 3); ok(typeof load(NS, 'math/seeded-prng')({ seed: 42 }).next().value === 'number'); ok(load(NS, 'math/signbit')(-2) === true); ok(load(NS, 'math/umulh')(0xFFFFFFFF, 7) === 6); ok(load(NS, 'map/of')([1, 2], [3, 4]) instanceof Map); ok(load(NS, 'map/reduce')(new Map([[1, 2], [2, 3], [3, 4]]), (a, b) => a + b) === 9); ok(load(NS, 'map/some')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === true); ok(load(NS, 'map/update')(new Map([[1, 2]]), 1, it => it * 2).get(1) === 4); ok(load(NS, 'number/from-string')('12', 3) === 5); ok(load(NS, 'number/range')(1, 2).next().value === 1); ok(typeof load(NS, 'object/iterate-entries')({}).next == 'function'); ok(typeof load(NS, 'object/iterate-keys')({}).next == 'function'); ok(typeof load(NS, 'object/iterate-values')({}).next == 'function'); ok('from' in load(NS, 'observable')); ok(typeof load(NS, 'reflect/define-metadata') == 'function'); ok(typeof load(NS, 'reflect/delete-metadata') == 'function'); ok(typeof load(NS, 'reflect/get-metadata') == 'function'); ok(typeof load(NS, 'reflect/get-metadata-keys') == 'function'); ok(typeof load(NS, 'reflect/get-own-metadata') == 'function'); ok(typeof load(NS, 'reflect/get-own-metadata-keys') == 'function'); ok(typeof load(NS, 'reflect/has-metadata') == 'function'); ok(typeof load(NS, 'reflect/has-own-metadata') == 'function'); ok(typeof load(NS, 'reflect/metadata') == 'function'); ok(load(NS, 'promise/try')(() => 42) instanceof load(NS, 'promise')); ok(load(NS, 'regexp/escape')('10$') === '\\x310\\$'); ok(load(NS, 'set/add-all')(new Set([1, 2, 3]), 4, 5).size === 5); ok(load(NS, 'set/delete-all')(new Set([1, 2, 3]), 4, 5) === false); ok(load(NS, 'set/every')(new Set([1, 2, 3]), it => typeof it == 'number')); ok(load(NS, 'set/filter')(new Set([1, 2, 3]), it => it % 2).size === 2); ok(load(NS, 'set/find')(new Set([2, 3, 4]), it => it % 2) === 3); ok(load(NS, 'set/from')([1, 2, 3, 2, 1]) instanceof Set); ok(load(NS, 'set/join')(new Set([1, 2, 3])) === '1,2,3'); ok(load(NS, 'set/map')(new Set([1, 2, 3]), it => it % 2).size === 2); ok(load(NS, 'set/of')(1, 2, 3, 2, 1) instanceof Set); ok(load(NS, 'set/reduce')(new Set([1, 2, 3]), (it, v) => it + v) === 6); ok(load(NS, 'set/some')(new Set([1, 2, 3]), it => typeof it == 'number')); ok(load(NS, 'string/cooked')`a${ 1 }b` === 'a1b'); ok(load(NS, 'string/dedent')` a${ 1 }b ` === 'a1b'); ok('next' in load(NS, 'string/code-points')('a')); ok('next' in load(NS, 'string/virtual/code-points').call('a')); ok(load(NS, 'symbol/is-registered-symbol')(1) === false); ok(load(NS, 'symbol/is-well-known-symbol')(1) === false); ok(load(NS, 'symbol/is-registered')(1) === false); ok(load(NS, 'symbol/is-well-known')(1) === false); ok(load(NS, 'symbol/matcher')); ok(load(NS, 'symbol/metadata-key')); ok(load(NS, 'symbol/observable')); ok(load(NS, 'symbol/pattern-match')); ok(load(NS, 'symbol/replace-all')); ok(load(NS, 'weak-map/delete-all')(new WeakMap(), [], {}) === false); ok(load(NS, 'weak-map/emplace')(new WeakMap(), {}, { insert: () => ({ a: 42 }) }).a === 42); ok(load(NS, 'weak-map/upsert')(new WeakMap(), {}, null, () => 42) === 42); ok(load(NS, 'weak-map/from')([[{}, 1], [[], 2]]) instanceof WeakMap); ok(load(NS, 'weak-map/of')([{}, 1], [[], 2]) instanceof WeakMap); ok(load(NS, 'weak-set/add-all')(new WeakSet(), [], {}) instanceof WeakSet); ok(load(NS, 'weak-set/delete-all')(new WeakSet(), [], {}) === false); ok(load(NS, 'weak-set/from')([{}, []]) instanceof WeakSet); ok(load(NS, 'weak-set/of')({}, []) instanceof WeakSet); const instanceCodePoints = load(NS, 'instance/code-points'); ok(typeof instanceCodePoints == 'function'); ok(instanceCodePoints({}) === undefined); ok(typeof instanceCodePoints('') == 'function'); ok(instanceCodePoints('').call('abc').next().value.codePoint === 97); const instanceDemethodize = load(NS, 'instance/demethodize'); ok(typeof instanceDemethodize == 'function'); ok(instanceDemethodize({}) === undefined); ok(typeof instanceDemethodize([].slice) == 'function'); ok(instanceDemethodize([].slice).call([].slice)([1, 2, 3], 1)[0] === 2); const instanceFilterOut = load(NS, 'instance/filter-out'); ok(typeof instanceFilterOut == 'function'); ok(instanceFilterOut({}) === undefined); ok(typeof instanceFilterOut([]) == 'function'); ok(instanceFilterOut([]).call([1, 2, 3], it => it % 2).length === 1); const instanceFilterReject = load(NS, 'instance/filter-reject'); ok(typeof instanceFilterReject == 'function'); ok(instanceFilterReject({}) === undefined); ok(typeof instanceFilterReject([]) == 'function'); ok(instanceFilterReject([]).call([1, 2, 3], it => it % 2).length === 1); const instanceUniqueBy = load(NS, 'instance/unique-by'); ok(typeof instanceUniqueBy == 'function'); ok(instanceUniqueBy({}) === undefined); ok(typeof instanceUniqueBy([]) == 'function'); ok(instanceUniqueBy([]).call([1, 2, 3, 2, 1]).length === 3); const instanceUnThis = load(NS, 'instance/un-this'); ok(typeof instanceUnThis == 'function'); ok(instanceUnThis({}) === undefined); ok(typeof instanceUnThis([].slice) == 'function'); ok(instanceUnThis([].slice).call([].slice)([1, 2, 3], 1)[0] === 2); } load('proposals/accessible-object-hasownproperty'); load('proposals/array-filtering'); load('proposals/array-filtering-stage-1'); load('proposals/array-find-from-last'); load('proposals/array-flat-map'); load('proposals/array-from-async'); load('proposals/array-from-async-stage-2'); load('proposals/array-grouping'); load('proposals/array-grouping-stage-3'); load('proposals/array-grouping-stage-3-2'); load('proposals/array-grouping-v2'); load('proposals/array-includes'); load('proposals/array-is-template-object'); load('proposals/array-last'); load('proposals/array-unique'); load('proposals/array-buffer-transfer'); load('proposals/async-explicit-resource-management'); load('proposals/async-iteration'); load('proposals/async-iterator-helpers'); load('proposals/change-array-by-copy'); load('proposals/change-array-by-copy-stage-4'); load('proposals/collection-methods'); load('proposals/collection-of-from'); load('proposals/data-view-get-set-uint8-clamped'); load('proposals/decorator-metadata'); load('proposals/decorator-metadata-v2'); load('proposals/decorators'); load('proposals/efficient-64-bit-arithmetic'); load('proposals/error-cause'); load('proposals/explicit-resource-management'); load('proposals/float16'); load('proposals/function-demethodize'); load('proposals/function-is-callable-is-constructor'); load('proposals/function-un-this'); load('proposals/global-this'); load('proposals/iterator-helpers'); load('proposals/iterator-helpers-stage-3'); load('proposals/iterator-helpers-stage-3-2'); load('proposals/iterator-range'); load('proposals/json-parse-with-source'); load('proposals/keys-composition'); load('proposals/map-update-or-insert'); load('proposals/map-upsert'); load('proposals/map-upsert-stage-2'); load('proposals/math-extensions'); load('proposals/math-signbit'); load('proposals/number-from-string'); load('proposals/number-range'); load('proposals/object-from-entries'); load('proposals/object-iteration'); load('proposals/object-getownpropertydescriptors'); load('proposals/object-values-entries'); load('proposals/observable'); load('proposals/pattern-matching'); load('proposals/promise-all-settled'); load('proposals/promise-any'); load('proposals/promise-finally'); load('proposals/promise-try'); load('proposals/promise-with-resolvers'); load('proposals/reflect-metadata'); load('proposals/regexp-dotall-flag'); load('proposals/regexp-escaping'); load('proposals/regexp-named-groups'); load('proposals/relative-indexing-method'); load('proposals/seeded-random'); load('proposals/set-methods'); load('proposals/set-methods-v2'); load('proposals/string-at'); load('proposals/string-cooked'); load('proposals/string-code-points'); load('proposals/string-dedent'); load('proposals/string-left-right-trim'); load('proposals/string-match-all'); load('proposals/string-padding'); load('proposals/string-replace-all'); load('proposals/string-replace-all-stage-4'); load('proposals/symbol-description'); load('proposals/symbol-predicates'); load('proposals/symbol-predicates-v2'); load('proposals/url'); load('proposals/using-statement'); load('proposals/well-formed-stringify'); load('proposals/well-formed-unicode-strings'); load('proposals'); ok(load('stage/4')); ok(load('stage/3')); ok(load('stage/2')); ok(load('stage/1')); ok(load('stage/0')); ok(load('stage/pre')); ok(load('stage')); ok(load('web/dom-exception')); ok(load('web/dom-collections')); ok(load('web/immediate')); ok(load('web/queue-microtask')); ok(load('web/structured-clone')(42) === 42); ok(load('web/timers')); ok(load('web/url')); ok(load('web/url-search-params')); ok(load('web')); for (const key in entries) { if (key.startsWith('core-js/modules/')) { load('modules', key.slice(16)); } } ok(load()); } for (const NS of ['es', 'stable', 'actual', 'full', 'features']) { ok(typeof load(NS, 'string/match') == 'function'); ok('next' in load(NS, 'string/match-all')('a', /./g)); ok(typeof load(NS, 'string/replace') == 'function'); ok(typeof load(NS, 'string/search') == 'function'); ok(load(NS, 'string/split')('a s d', ' ').length === 3); ok(typeof load(NS, 'array-buffer') == 'function'); ok(typeof load(NS, 'array-buffer/constructor') == 'function'); ok(typeof load(NS, 'array-buffer/is-view') == 'function'); load(NS, 'array-buffer/slice'); ok(typeof load(NS, 'data-view') == 'function'); ok(typeof load(NS, 'typed-array/int8-array') == 'function'); ok(typeof load(NS, 'typed-array/uint8-array') == 'function'); ok(typeof load(NS, 'typed-array/uint8-clamped-array') == 'function'); ok(typeof load(NS, 'typed-array/int16-array') == 'function'); ok(typeof load(NS, 'typed-array/uint16-array') == 'function'); ok(typeof load(NS, 'typed-array/int32-array') == 'function'); ok(typeof load(NS, 'typed-array/uint32-array') == 'function'); ok(typeof load(NS, 'typed-array/float32-array') == 'function'); ok(typeof load(NS, 'typed-array/float64-array') == 'function'); load(NS, 'typed-array/at'); load(NS, 'typed-array/copy-within'); load(NS, 'typed-array/entries'); load(NS, 'typed-array/every'); load(NS, 'typed-array/fill'); load(NS, 'typed-array/filter'); load(NS, 'typed-array/find'); load(NS, 'typed-array/find-index'); load(NS, 'typed-array/find-last'); load(NS, 'typed-array/find-last-index'); load(NS, 'typed-array/for-each'); load(NS, 'typed-array/from'); load(NS, 'typed-array/includes'); load(NS, 'typed-array/index-of'); load(NS, 'typed-array/iterator'); load(NS, 'typed-array/join'); load(NS, 'typed-array/keys'); load(NS, 'typed-array/last-index-of'); load(NS, 'typed-array/map'); load(NS, 'typed-array/of'); load(NS, 'typed-array/reduce'); load(NS, 'typed-array/reduce-right'); load(NS, 'typed-array/reverse'); load(NS, 'typed-array/set'); load(NS, 'typed-array/slice'); load(NS, 'typed-array/some'); load(NS, 'typed-array/sort'); load(NS, 'typed-array/subarray'); load(NS, 'typed-array/to-locale-string'); load(NS, 'typed-array/to-reversed'); load(NS, 'typed-array/to-sorted'); load(NS, 'typed-array/to-string'); load(NS, 'typed-array/values'); load(NS, 'typed-array/with'); load(NS, 'typed-array/methods'); ok(typeof load(NS, 'typed-array').Uint32Array == 'function'); } for (const NS of ['actual', 'full', 'features']) { load(NS, 'typed-array/to-spliced'); } for (const NS of ['full', 'features']) { load(NS, 'typed-array/from-async'); load(NS, 'typed-array/filter-out'); load(NS, 'typed-array/filter-reject'); load(NS, 'typed-array/group-by'); load(NS, 'typed-array/unique-by'); } load('modules/esnext.string.at-alternative'); echo(chalk.green(`tested ${ chalk.cyan(tested.size) } commonjs entry points`)); if (expected.size) { echo(chalk.red('not tested entries:')); expected.forEach(it => echo(chalk.cyan(it))); } core-js-3.33.2/tests/eslint/000077500000000000000000000000001451776221300156145ustar00rootroot00000000000000core-js-3.33.2/tests/eslint/eslint.config.js000066400000000000000000002010011451776221300207060ustar00rootroot00000000000000'use strict'; const globals = require('globals'); const confusingBrowserGlobals = require('confusing-browser-globals'); const parserJSONC = require('jsonc-eslint-parser'); const pluginArrayFunc = require('eslint-plugin-array-func'); const pluginESX = require('eslint-plugin-es-x'); const pluginESlintComments = require('@eslint-community/eslint-plugin-eslint-comments'); const pluginFilenames = require('eslint-plugin-filenames'); const pluginImport = require('eslint-plugin-import'); const pluginJSONC = require('eslint-plugin-jsonc'); const pluginN = require('eslint-plugin-n'); const pluginPromise = require('eslint-plugin-promise'); const pluginQUnit = require('eslint-plugin-qunit'); const pluginReDoS = require('eslint-plugin-redos'); const pluginRegExp = require('eslint-plugin-regexp'); const pluginSonarJS = require('eslint-plugin-sonarjs'); const pluginStylisticJS = require('@stylistic/eslint-plugin-js'); const pluginUnicorn = require('eslint-plugin-unicorn'); const PACKAGES_NODE_VERSIONS = require('core-js-builder/package').engines.node; const DEV_NODE_VERSIONS = '^18.12'; const ERROR = 'error'; const OFF = 'off'; const ALWAYS = 'always'; const NEVER = 'never'; const READONLY = 'readonly'; function disable(rules) { return Object.fromEntries(Object.keys(rules).map(key => [key, OFF])); } const base = { // possible problems: // enforces return statements in callbacks of array's methods 'array-callback-return': ERROR, // require `super()` calls in constructors 'constructor-super': ERROR, // enforce 'for' loop update clause moving the counter in the right direction 'for-direction': ERROR, // disallow using an async function as a `Promise` executor 'no-async-promise-executor': ERROR, // disallow reassigning class members 'no-class-assign': ERROR, // disallow comparing against -0 'no-compare-neg-zero': ERROR, // disallow reassigning `const` variables 'no-const-assign': ERROR, // disallows expressions where the operation doesn't affect the value 'no-constant-binary-expression': ERROR, // disallow constant expressions in conditions 'no-constant-condition': [ERROR, { checkLoops: false }], // disallow returning value from constructor 'no-constructor-return': ERROR, // disallow use of debugger 'no-debugger': ERROR, // disallow duplicate arguments in functions 'no-dupe-args': ERROR, // disallow duplicate class members 'no-dupe-class-members': ERROR, // disallow duplicate conditions in if-else-if chains 'no-dupe-else-if': ERROR, // disallow duplicate keys when creating object literals 'no-dupe-keys': ERROR, // disallow a duplicate case label 'no-duplicate-case': ERROR, // disallow duplicate module imports 'no-duplicate-imports': ERROR, // disallow empty destructuring patterns 'no-empty-pattern': ERROR, // disallow assigning to the exception in a catch block 'no-ex-assign': ERROR, // disallow fallthrough of case statements 'no-fallthrough': [ERROR, { commentPattern: 'break omitted' }], // disallow overwriting functions written as function declarations 'no-func-assign': ERROR, // disallow assigning to imported bindings 'no-import-assign': ERROR, // disallow irregular whitespace outside of strings and comments 'no-irregular-whitespace': ERROR, // disallow literal numbers that lose precision 'no-loss-of-precision': ERROR, // disallow `new` operators with global non-constructor functions 'no-new-native-nonconstructor': ERROR, // disallow the use of object properties of the global object (Math and JSON) as functions 'no-obj-calls': ERROR, // disallow use of Object.prototypes builtins directly 'no-prototype-builtins': ERROR, // disallow self assignment 'no-self-assign': ERROR, // disallow comparisons where both sides are exactly the same 'no-self-compare': ERROR, // disallow sparse arrays 'no-sparse-arrays': ERROR, // disallow template literal placeholder syntax in regular strings 'no-template-curly-in-string': ERROR, // disallow `this` / `super` before calling `super()` in constructors 'no-this-before-super': ERROR, // disallow unmodified loop conditions 'no-unmodified-loop-condition': ERROR, // disallow use of undeclared variables unless mentioned in a /*global */ block 'no-undef': [ERROR, { typeof: false }], // disallow control flow statements in `finally` blocks 'no-unsafe-finally': ERROR, // avoid code that looks like two expressions but is actually one 'no-unexpected-multiline': ERROR, // disallow unreachable statements after a return, throw, continue, or break statement 'no-unreachable': ERROR, // disallow loops with a body that allows only one iteration 'no-unreachable-loop': ERROR, // disallow negation of the left operand of an in expression 'no-unsafe-negation': ERROR, // disallow use of optional chaining in contexts where the `undefined` value is not allowed 'no-unsafe-optional-chaining': ERROR, // disallow unused private class members 'no-unused-private-class-members': ERROR, // disallow declaration of variables that are not used in the code 'no-unused-vars': [ERROR, { vars: 'all', args: 'after-used', ignoreRestSiblings: true, }], // require or disallow the Unicode Byte Order Mark 'unicode-bom': [ERROR, NEVER], // disallow comparisons with the value NaN 'use-isnan': ERROR, // ensure that the results of typeof are compared against a valid string 'valid-typeof': ERROR, // suggestions: // enforce the use of variables within the scope they are defined 'block-scoped-var': ERROR, // require camel case names camelcase: [ERROR, { properties: NEVER }], // enforce default clauses in switch statements to be last 'default-case-last': ERROR, // enforce default parameters to be last 'default-param-last': ERROR, // encourages use of dot notation whenever possible 'dot-notation': [ERROR, { allowKeywords: true }], // require the use of === and !== eqeqeq: [ERROR, 'smart'], // require grouped accessor pairs in object literals and classes 'grouped-accessor-pairs': [ERROR, 'getBeforeSet'], // require logical assignment operator shorthand 'logical-assignment-operators': [ERROR, ALWAYS], // enforce a maximum depth that blocks can be nested 'max-depth': [ERROR, { max: 5 }], // enforce a maximum depth that callbacks can be nested 'max-nested-callbacks': [ERROR, { max: 4 }], // specify the maximum number of statement allowed in a function 'max-statements': [ERROR, { max: 50 }], // require a capital letter for constructors 'new-cap': [ERROR, { newIsCap: true, capIsNew: false }], // disallow window alert / confirm / prompt calls 'no-alert': ERROR, // disallow use of arguments.caller or arguments.callee 'no-caller': ERROR, // disallow lexical declarations in case/default clauses 'no-case-declarations': ERROR, // disallow use of console 'no-console': ERROR, // disallow deletion of variables 'no-delete-var': ERROR, // disallow else after a return in an if 'no-else-return': ERROR, // disallow empty statements 'no-empty': ERROR, // disallow empty functions, except for standalone funcs/arrows 'no-empty-function': ERROR, // disallow empty static blocks 'no-empty-static-block': ERROR, // disallow `null` comparisons without type-checking operators 'no-eq-null': ERROR, // disallow use of eval() 'no-eval': ERROR, // disallow adding to native types 'no-extend-native': ERROR, // disallow unnecessary function binding 'no-extra-bind': ERROR, // disallow unnecessary boolean casts 'no-extra-boolean-cast': ERROR, // disallow unnecessary labels 'no-extra-label': ERROR, // disallow reassignments of native objects 'no-global-assign': ERROR, // disallow use of eval()-like methods 'no-implied-eval': ERROR, // disallow usage of __iterator__ property 'no-iterator': ERROR, // disallow labels that share a name with a variable 'no-label-var': ERROR, // disallow use of labels for anything other then loops and switches 'no-labels': [ERROR, { allowLoop: false, allowSwitch: false }], // disallow unnecessary nested blocks 'no-lone-blocks': ERROR, // disallow `if` as the only statement in an `else` block 'no-lonely-if': ERROR, // disallow function declarations and expressions inside loop statements 'no-loop-func': ERROR, // disallow use of multiline strings 'no-multi-str': ERROR, // disallow use of new operator when not part of the assignment or comparison 'no-new': ERROR, // disallow use of new operator for Function object 'no-new-func': ERROR, // disallows creating new instances of String, Number, and Boolean 'no-new-wrappers': ERROR, // disallow `\8` and `\9` escape sequences in string literals 'no-nonoctal-decimal-escape': ERROR, // disallow calls to the `Object` constructor without an argument 'no-object-constructor': ERROR, // disallow use of (old style) octal literals 'no-octal': ERROR, // disallow use of octal escape sequences in string literals, such as var foo = 'Copyright \251'; 'no-octal-escape': ERROR, // disallow usage of __proto__ property 'no-proto': ERROR, // disallow declaring the same variable more then once 'no-redeclare': [ERROR, { builtinGlobals: false }], // disallow specific global variables 'no-restricted-globals': [ERROR, ...confusingBrowserGlobals], // disallow specified syntax 'no-restricted-syntax': [ERROR, { selector: 'ForInStatement', message: '`for-in` loops are disallowed since iterate over the prototype chain', }, ], // disallow use of `javascript:` urls. 'no-script-url': ERROR, // disallow use of comma operator 'no-sequences': ERROR, // disallow declaration of variables already declared in the outer scope 'no-shadow': ERROR, // disallow shadowing of names such as arguments 'no-shadow-restricted-names': ERROR, // restrict what can be thrown as an exception 'no-throw-literal': ERROR, // disallow initializing variables to `undefined` 'no-undef-init': ERROR, // disallow dangling underscores in identifiers 'no-underscore-dangle': ERROR, // disallow the use of boolean literals in conditional expressions and prefer `a || b` over `a ? a : b` 'no-unneeded-ternary': [ERROR, { defaultAssignment: false }], // disallow usage of expressions in statement position 'no-unused-expressions': [ERROR, { allowShortCircuit: true, allowTernary: true, allowTaggedTemplates: true, }], // disallow unused labels 'no-unused-labels': ERROR, // disallow unnecessary calls to `.call()` and `.apply()` 'no-useless-call': ERROR, // disallow unnecessary catch clauses 'no-useless-catch': ERROR, // disallow unnecessary computed property keys in object literals 'no-useless-computed-key': ERROR, // disallow useless string concatenation 'no-useless-concat': ERROR, // disallow unnecessary constructors 'no-useless-constructor': ERROR, // disallow unnecessary escape characters 'no-useless-escape': ERROR, // disallow renaming import, export, and destructured assignments to the same name 'no-useless-rename': ERROR, // disallow redundant return statements 'no-useless-return': ERROR, // require let or const instead of var 'no-var': ERROR, // disallow void operators 'no-void': ERROR, // disallow use of the with statement 'no-with': ERROR, // require or disallow method and property shorthand syntax for object literals 'object-shorthand': ERROR, // require assignment operator shorthand where possible 'operator-assignment': [ERROR, 'always'], // require using arrow functions for callbacks 'prefer-arrow-callback': ERROR, // require const declarations for variables that are never reassigned after declared 'prefer-const': [ERROR, { destructuring: 'all' }], // require destructuring from arrays and/or objects 'prefer-destructuring': ERROR, // prefer the exponentiation operator over `Math.pow()` 'prefer-exponentiation-operator': ERROR, // disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals 'prefer-numeric-literals': ERROR, // prefer `Object.hasOwn` 'prefer-object-has-own': ERROR, // disallow use of the `RegExp` constructor in favor of regular expression literals 'prefer-regex-literals': [ERROR, { disallowRedundantWrapping: true }], // require rest parameters instead of `arguments` 'prefer-rest-params': ERROR, // require spread operators instead of `.apply()` 'prefer-spread': ERROR, // require template literals instead of string concatenation 'prefer-template': ERROR, // require use of the second argument for parseInt() radix: ERROR, // disallow generator functions that do not have `yield` 'require-yield': ERROR, // require strict mode directives strict: [ERROR, 'global'], // require symbol descriptions 'symbol-description': ERROR, // disallow "Yoda" conditions yoda: [ERROR, NEVER], // layout & formatting: // enforce spacing inside array brackets '@stylistic/js/array-bracket-spacing': [ERROR, NEVER], // require parentheses around arrow function arguments '@stylistic/js/arrow-parens': [ERROR, 'as-needed'], // enforce consistent spacing before and after the arrow in arrow functions '@stylistic/js/arrow-spacing': ERROR, // enforce spacing inside single-line blocks '@stylistic/js/block-spacing': [ERROR, ALWAYS], // enforce one true brace style '@stylistic/js/brace-style': [ERROR, '1tbs', { allowSingleLine: true }], // enforce trailing commas in multiline object literals '@stylistic/js/comma-dangle': [ERROR, 'always-multiline'], // enforce spacing after comma '@stylistic/js/comma-spacing': ERROR, // enforce one true comma style '@stylistic/js/comma-style': [ERROR, 'last'], // disallow padding inside computed properties '@stylistic/js/computed-property-spacing': [ERROR, NEVER], // enforce newline before and after dot '@stylistic/js/dot-location': [ERROR, 'property'], // enforce one newline at the end of files '@stylistic/js/eol-last': [ERROR, ALWAYS], // disallow space between function identifier and application '@stylistic/js/func-call-spacing': ERROR, // require spacing around the `*` in `function *` expressions '@stylistic/js/generator-star-spacing': [ERROR, 'both'], // enforce the location of arrow function bodies '@stylistic/js/implicit-arrow-linebreak': [ERROR, 'beside'], // enforce consistent indentation '@stylistic/js/indent': [ERROR, 2, { ignoredNodes: ['ConditionalExpression'], SwitchCase: 1, VariableDeclarator: 'first', }], // enforces spacing between keys and values in object literal properties '@stylistic/js/key-spacing': [ERROR, { beforeColon: false, afterColon: true }], // require a space before & after certain keywords '@stylistic/js/keyword-spacing': [ERROR, { before: true, after: true }], // enforce consistent linebreak style '@stylistic/js/linebreak-style': [ERROR, 'unix'], // specify the maximum length of a line in your program '@stylistic/js/max-len': [ERROR, { code: 140, tabWidth: 2, ignoreRegExpLiterals: true, ignoreTemplateLiterals: true, ignoreUrls: true, }], // enforce a maximum number of statements allowed per line '@stylistic/js/max-statements-per-line': [ERROR, { max: 2 }], // require parentheses when invoking a constructor with no arguments '@stylistic/js/new-parens': ERROR, // disallow unnecessary semicolons '@stylistic/js/no-extra-semi': ERROR, // disallow the use of leading or trailing decimal points in numeric literals '@stylistic/js/no-floating-decimal': ERROR, // disallow mixed spaces and tabs for indentation '@stylistic/js/no-mixed-spaces-and-tabs': ERROR, // disallow use of multiple spaces '@stylistic/js/no-multi-spaces': [ERROR, { ignoreEOLComments: true }], // disallow multiple empty lines and only one newline at the end '@stylistic/js/no-multiple-empty-lines': [ERROR, { max: 1, maxEOF: 1 }], // disallow tabs '@stylistic/js/no-tabs': ERROR, // disallow trailing whitespace at the end of lines '@stylistic/js/no-trailing-spaces': ERROR, // disallow whitespace before properties '@stylistic/js/no-whitespace-before-property': ERROR, // enforce the location of single-line statements '@stylistic/js/nonblock-statement-body-position': [ERROR, 'beside'], // enforce consistent line breaks after opening and before closing braces '@stylistic/js/object-curly-newline': [ERROR, { consistent: true }], // enforce spaces inside braces '@stylistic/js/object-curly-spacing': [ERROR, ALWAYS], // require newlines around variable declarations with initializations '@stylistic/js/one-var-declaration-per-line': [ERROR, 'initializations'], // enforce padding within blocks '@stylistic/js/padded-blocks': [ERROR, NEVER], // disallow blank lines after 'use strict' '@stylistic/js/padding-line-between-statements': [ERROR, { blankLine: NEVER, prev: 'directive', next: '*' }], // require or disallow use of quotes around object literal property names '@stylistic/js/quote-props': [ERROR, 'as-needed', { keywords: false }], // specify whether double or single quotes should be used '@stylistic/js/quotes': [ERROR, 'single', { avoidEscape: true }], // enforce spacing between rest and spread operators and their expressions '@stylistic/js/rest-spread-spacing': ERROR, // require or disallow use of semicolons instead of ASI '@stylistic/js/semi': [ERROR, ALWAYS], // enforce spacing before and after semicolons '@stylistic/js/semi-spacing': ERROR, // enforce location of semicolons '@stylistic/js/semi-style': [ERROR, 'last'], // require or disallow space before blocks '@stylistic/js/space-before-blocks': ERROR, // require or disallow space before function opening parenthesis '@stylistic/js/space-before-function-paren': [ERROR, { anonymous: ALWAYS, named: NEVER }], // require or disallow spaces inside parentheses '@stylistic/js/space-in-parens': ERROR, // require spaces around operators '@stylistic/js/space-infix-ops': ERROR, // require or disallow spaces before/after unary operators '@stylistic/js/space-unary-ops': ERROR, // require or disallow a space immediately following the // or /* in a comment '@stylistic/js/spaced-comment': [ERROR, ALWAYS, { line: { exceptions: ['/'] }, block: { exceptions: ['*'] }, }], // enforce spacing around colons of switch statements '@stylistic/js/switch-colon-spacing': ERROR, // require or disallow spacing around embedded expressions of template strings '@stylistic/js/template-curly-spacing': [ERROR, ALWAYS], // disallow spacing between template tags and their literals '@stylistic/js/template-tag-spacing': [ERROR, NEVER], // require spacing around the `*` in `yield *` expressions '@stylistic/js/yield-star-spacing': [ERROR, 'both'], // import: // ensure all imports appear before other statements 'import/first': ERROR, // enforce a newline after import statements 'import/newline-after-import': ERROR, // forbid import of modules using absolute paths 'import/no-absolute-path': ERROR, // forbid AMD imports 'import/no-amd': ERROR, // forbid cycle dependencies 'import/no-cycle': [ERROR, { commonjs: true }], // disallow importing from the same path more than once 'import/no-duplicates': ERROR, // forbid `require()` calls with expressions 'import/no-dynamic-require': ERROR, // forbid empty named import blocks 'import/no-empty-named-blocks': ERROR, // forbid imports with CommonJS exports 'import/no-import-module-exports': ERROR, // prevent importing packages through relative paths 'import/no-relative-packages': ERROR, // forbid a module from importing itself 'import/no-self-import': ERROR, // ensure imports point to files / modules that can be resolved 'import/no-unresolved': [ERROR, { commonjs: true }], // forbid useless path segments 'import/no-useless-path-segments': ERROR, // node: // enforce the style of file extensions in `import` declarations 'node/file-extension-in-import': ERROR, // require require() calls to be placed at top-level module scope 'node/global-require': ERROR, // disallow deprecated APIs 'node/no-deprecated-api': ERROR, // disallow the assignment to `exports` 'node/no-exports-assign': ERROR, // disallow third-party modules which are hiding core modules 'node/no-hide-core-modules': ERROR, // disallow require calls to be mixed with regular variable declarations 'node/no-mixed-requires': [ERROR, { grouping: true, allowCall: false }], // disallow new operators with calls to require 'node/no-new-require': ERROR, // disallow string concatenation with `__dirname` and `__filename` 'node/no-path-concat': ERROR, // disallow the use of `process.exit()` 'node/no-process-exit': ERROR, // disallow synchronous methods 'node/no-sync': ERROR, // prefer global 'node/prefer-global/buffer': [ERROR, ALWAYS], 'node/prefer-global/console': [ERROR, ALWAYS], 'node/prefer-global/process': [ERROR, ALWAYS], 'node/prefer-global/text-decoder': [ERROR, ALWAYS], 'node/prefer-global/text-encoder': [ERROR, ALWAYS], 'node/prefer-global/url-search-params': [ERROR, ALWAYS], 'node/prefer-global/url': [ERROR, ALWAYS], // prefer promises 'node/prefer-promises/dns': ERROR, 'node/prefer-promises/fs': ERROR, // array-func: // avoid reversing the array and running a method on it if there is an equivalent of the method operating on the array from the other end 'array-func/avoid-reverse': ERROR, // prefer using the `mapFn` callback of `Array.from` over an immediate `.map()` call on the `Array.from` result 'array-func/from-map': ERROR, // avoid the `this` parameter when providing arrow function as callback in array functions 'array-func/no-unnecessary-this-arg': ERROR, // promise: // avoid calling `cb()` inside of a `then()` or `catch()` 'promise/no-callback-in-promise': ERROR, // disallow creating new promises with paths that resolve multiple times (no-multiple-resolved) 'promise/no-multiple-resolved': ERROR, // avoid nested `then()` or `catch()` statements 'promise/no-nesting': ERROR, // avoid calling new on a `Promise` static method 'promise/no-new-statics': ERROR, // avoid using promises inside of callbacks 'promise/no-promise-in-callback': ERROR, // disallow return statements in `finally()` 'promise/no-return-in-finally': ERROR, // avoid wrapping values in `Promise.resolve` or `Promise.reject` when not needed 'promise/no-return-wrap': ERROR, // enforce consistent param names when creating new promises 'promise/param-names': [ERROR, { resolvePattern: '^resolve', rejectPattern: '^reject', }], // prefer `async` / `await` to the callback pattern 'promise/prefer-await-to-callbacks': ERROR, // prefer `await` to `then()` / `catch()` / `finally()` for reading `Promise` values 'promise/prefer-await-to-then': ERROR, // ensures the proper number of arguments are passed to `Promise` functions 'promise/valid-params': ERROR, // unicorn // enforce a specific parameter name in `catch` clauses 'unicorn/catch-error-name': [ERROR, { name: ERROR, ignore: [/^err/] }], // enforce correct `Error` subclassing 'unicorn/custom-error-definition': ERROR, // enforce passing a message value when throwing a built-in error 'unicorn/error-message': ERROR, // require escape sequences to use uppercase values 'unicorn/escape-case': ERROR, // enforce a case style for filenames 'unicorn/filename-case': [ERROR, { case: 'kebabCase' }], // enforce specifying rules to disable in `eslint-disable` comments 'unicorn/no-abusive-eslint-disable': ERROR, // enforce combining multiple `Array#push` into one call 'unicorn/no-array-push-push': ERROR, // do not use leading/trailing space between `console.log` parameters 'unicorn/no-console-spaces': ERROR, // enforce the use of unicode escapes instead of hexadecimal escapes 'unicorn/no-hex-escape': ERROR, // prevent calling `EventTarget#removeEventListener()` with the result of an expression 'unicorn/no-invalid-remove-event-listener': ERROR, // disallow `if` statements as the only statement in `if` blocks without `else` 'unicorn/no-lonely-if': ERROR, // enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()` 'unicorn/no-new-buffer': ERROR, // forbid classes that only have static members 'unicorn/no-static-only-class': ERROR, // disallow `then` property 'unicorn/no-thenable': ERROR, // disallow comparing `undefined` using `typeof` when it's not required 'unicorn/no-typeof-undefined': ERROR, // disallow awaiting non-promise values 'unicorn/no-unnecessary-await': ERROR, // disallow unreadable array destructuring 'unicorn/no-unreadable-array-destructuring': ERROR, // disallow unreadable IIFEs 'unicorn/no-unreadable-iife': ERROR, // disallow unused object properties 'unicorn/no-unused-properties': ERROR, // forbid useless fallback when spreading in object literals 'unicorn/no-useless-fallback-in-spread': ERROR, // disallow useless array length check 'unicorn/no-useless-length-check': ERROR, // disallow returning / yielding `Promise.{ resolve, reject }` in async functions or promise callbacks 'unicorn/no-useless-promise-resolve-reject': ERROR, // disallow useless spread 'unicorn/no-useless-spread': ERROR, // disallow useless `case` in `switch` statements 'unicorn/no-useless-switch-case': ERROR, // enforce lowercase identifier and uppercase value for number literals 'unicorn/number-literal-case': ERROR, // enforce the style of numeric separators by correctly grouping digits 'unicorn/numeric-separators-style': [ERROR, { onlyIfContainsSeparator: true, number: { minimumDigits: 0, groupLength: 3 }, binary: { minimumDigits: 0, groupLength: 4 }, octal: { minimumDigits: 0, groupLength: 4 }, hexadecimal: { minimumDigits: 0, groupLength: 2 }, }], // prefer `.find()` over the first element from `.filter()` 'unicorn/prefer-array-find': ERROR, // use `.flat()` to flatten an array of arrays 'unicorn/prefer-array-flat': ERROR, // use `.flatMap()` to map and then flatten an array instead of using `.map().flat()` 'unicorn/prefer-array-flat-map': ERROR, // prefer `Array#indexOf` over `Array#findIndex`` when looking for the index of an item 'unicorn/prefer-array-index-of': ERROR, // prefer `.some()` over `.filter().length` check and `.find()` 'unicorn/prefer-array-some': ERROR, // prefer `.at()` method for index access and `String#charAt()` 'unicorn/prefer-at': [ERROR, { checkAllIndexAccess: false }], // prefer `Blob#{ arrayBuffer, text }` over `FileReader#{ readAsArrayBuffer, readAsText }` 'unicorn/prefer-blob-reading-methods': ERROR, // prefer `Date.now()` to get the number of milliseconds since the Unix Epoch 'unicorn/prefer-date-now': ERROR, // prefer default parameters over reassignment 'unicorn/prefer-default-parameters': ERROR, // prefer `EventTarget` over `EventEmitter` 'unicorn/prefer-event-target': ERROR, // prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence 'unicorn/prefer-includes': ERROR, // prefer reading a `JSON` file as a buffer 'unicorn/prefer-json-parse-buffer': ERROR, // prefer using a logical operator over a ternary 'unicorn/prefer-logical-operator-over-ternary': ERROR, // prefer modern `Math` APIs over legacy patterns 'unicorn/prefer-modern-math-apis': ERROR, // prefer negative index over `.length - index` when possible 'unicorn/prefer-negative-index': ERROR, // prefer using the `node:` protocol when importing Node builtin modules 'unicorn/prefer-node-protocol': ERROR, // prefer using `Object.fromEntries()` to transform a list of key-value pairs into an object 'unicorn/prefer-object-from-entries': ERROR, // prefer omitting the `catch` binding parameter 'unicorn/prefer-optional-catch-binding': ERROR, // prefer using `Set#size` instead of `Array#length` 'unicorn/prefer-set-size': ERROR, // prefer `String#replaceAll()` over regex searches with the global flag 'unicorn/prefer-string-replace-all': ERROR, // prefer `String#{ startsWith, endsWith }()` over `RegExp#test()` 'unicorn/prefer-string-starts-ends-with': ERROR, // prefer `String#{ trimStart, trimEnd }()` over `String#{ trimLeft, trimRight }()` 'unicorn/prefer-string-trim-start-end': ERROR, // prefer `switch` over multiple `else-if` 'unicorn/prefer-switch': [ERROR, { minimumCases: 3 }], // enforce consistent relative `URL` style 'unicorn/relative-url-style': [ERROR, ALWAYS], // enforce using the separator argument with `Array#join()` 'unicorn/require-array-join-separator': ERROR, // enforce using the digits argument with `Number#toFixed()` 'unicorn/require-number-to-fixed-digits-argument': ERROR, // enforce using the `targetOrigin`` argument with `window.postMessage()` 'unicorn/require-post-message-target-origin': ERROR, // forbid braces for case clauses 'unicorn/switch-case-braces': [ERROR, 'avoid'], // fix whitespace-insensitive template indentation 'unicorn/template-indent': OFF, // waiting for `String.dedent` // enforce consistent case for text encoding identifiers 'unicorn/text-encoding-identifier-case': ERROR, // require `new` when throwing an error 'unicorn/throw-new-error': ERROR, // sonarjs // collection sizes and array length comparisons should make sense 'sonarjs/no-collection-size-mischeck': ERROR, // two branches in a conditional structure should not have exactly the same implementation 'sonarjs/no-duplicated-branches': ERROR, // collection elements should not be replaced unconditionally 'sonarjs/no-element-overwrite': ERROR, // empty collections should not be accessed or iterated 'sonarjs/no-empty-collection': ERROR, // function calls should not pass extra arguments 'sonarjs/no-extra-arguments': ERROR, // boolean expressions should not be gratuitous 'sonarjs/no-gratuitous-expressions': ERROR, // boolean literals should not be redundant 'sonarjs/no-redundant-boolean': ERROR, // jump statements should not be redundant 'sonarjs/no-redundant-jump': ERROR, // conditionals should start on new lines 'sonarjs/no-same-line-conditional': ERROR, // `switch` statements should have at least 3 `case` clauses 'sonarjs/no-small-switch': ERROR, // collection and array contents should be used 'sonarjs/no-unused-collection': ERROR, // the output of functions that don't return anything should not be used 'sonarjs/no-use-of-empty-return-value': ERROR, // non-existent operators `=+`, `=-` and `=!` should not be used 'sonarjs/non-existent-operator': ERROR, // local variables should not be declared and then immediately returned or thrown 'sonarjs/prefer-immediate-return': ERROR, // object literal syntax should be used 'sonarjs/prefer-object-literal': ERROR, // return of boolean expressions should not be wrapped into an `if-then-else` statement 'sonarjs/prefer-single-boolean-return': ERROR, // a `while` loop should be used instead of a `for` loop with condition only 'sonarjs/prefer-while': ERROR, // regexp // disallow confusing quantifiers 'regexp/confusing-quantifier': ERROR, // enforce consistent escaping of control characters 'regexp/control-character-escape': ERROR, // enforce single grapheme in string literal 'regexp/grapheme-string-literal': ERROR, // enforce consistent usage of hexadecimal escape 'regexp/hexadecimal-escape': [ERROR, NEVER], // enforce into your favorite case 'regexp/letter-case': [ERROR, { caseInsensitive: 'lowercase', unicodeEscape: 'uppercase', }], // enforce match any character style 'regexp/match-any': [ERROR, { allows: ['[\\S\\s]', 'dotAll'] }], // enforce use of escapes on negation 'regexp/negation': ERROR, // disallow elements that contradict assertions 'regexp/no-contradiction-with-assertion': ERROR, // disallow control characters 'regexp/no-control-character': ERROR, // disallow duplicate characters in the RegExp character class 'regexp/no-dupe-characters-character-class': ERROR, // disallow duplicate disjunctions 'regexp/no-dupe-disjunctions': [ERROR, { report: 'all' }], // disallow alternatives without elements 'regexp/no-empty-alternative': ERROR, // disallow capturing group that captures empty 'regexp/no-empty-capturing-group': ERROR, // disallow character classes that match no characters 'regexp/no-empty-character-class': ERROR, // disallow empty group 'regexp/no-empty-group': ERROR, // disallow empty lookahead assertion or empty lookbehind assertion 'regexp/no-empty-lookarounds-assertion': ERROR, // reports empty string literals in character classes 'regexp/no-empty-string-literal': ERROR, // disallow escape backspace `([\b])` 'regexp/no-escape-backspace': ERROR, // disallow unnecessary nested lookaround assertions 'regexp/no-extra-lookaround-assertions': ERROR, // disallow invalid regular expression strings in RegExp constructors 'regexp/no-invalid-regexp': ERROR, // disallow invisible raw character 'regexp/no-invisible-character': ERROR, // disallow lazy quantifiers at the end of an expression 'regexp/no-lazy-ends': ERROR, // disallow legacy RegExp features 'regexp/no-legacy-features': ERROR, // disallow capturing groups that do not behave as one would expect 'regexp/no-misleading-capturing-group': ERROR, // disallow multi-code-point characters in character classes and quantifiers 'regexp/no-misleading-unicode-character': ERROR, // disallow missing `g` flag in patterns used in `String#matchAll` and `String#replaceAll` 'regexp/no-missing-g-flag': ERROR, // disallow non-standard flags 'regexp/no-non-standard-flag': ERROR, // disallow obscure character ranges 'regexp/no-obscure-range': ERROR, // disallow octal escape sequence 'regexp/no-octal': ERROR, // disallow optional assertions 'regexp/no-optional-assertion': ERROR, // disallow backreferences that reference a group that might not be matched 'regexp/no-potentially-useless-backreference': ERROR, // disallow standalone backslashes 'regexp/no-standalone-backslash': ERROR, // disallow trivially nested assertions 'regexp/no-trivially-nested-assertion': ERROR, // disallow nested quantifiers that can be rewritten as one quantifier 'regexp/no-trivially-nested-quantifier': ERROR, // disallow unused capturing group 'regexp/no-unused-capturing-group': ERROR, // disallow assertions that are known to always accept (or reject) 'regexp/no-useless-assertions': ERROR, // disallow useless backreferences in regular expressions 'regexp/no-useless-backreference': ERROR, // disallow character class with one character 'regexp/no-useless-character-class': ERROR, // disallow useless `$` replacements in replacement string 'regexp/no-useless-dollar-replacements': ERROR, // disallow unnecessary string escaping 'regexp/no-useless-escape': ERROR, // disallow unnecessary regex flags 'regexp/no-useless-flag': ERROR, // disallow unnecessarily non-greedy quantifiers 'regexp/no-useless-lazy': ERROR, // disallow unnecessary non-capturing group 'regexp/no-useless-non-capturing-group': ERROR, // disallow quantifiers that can be removed 'regexp/no-useless-quantifier': ERROR, // disallow unnecessary range of characters by using a hyphen 'regexp/no-useless-range': ERROR, // reports any unnecessary set operands 'regexp/no-useless-set-operand': ERROR, // reports the string alternatives of a single character in `\q{...}`, it can be placed outside `\q{...}` 'regexp/no-useless-string-literal': ERROR, // disallow unnecessary `{n,m}`` quantifier 'regexp/no-useless-two-nums-quantifier': ERROR, // disallow quantifiers with a maximum of zero 'regexp/no-zero-quantifier': ERROR, // disallow the alternatives of lookarounds that end with a non-constant quantifier 'regexp/optimal-lookaround-quantifier': ERROR, // require optimal quantifiers for concatenated quantifiers 'regexp/optimal-quantifier-concatenation': ERROR, // enforce using character class 'regexp/prefer-character-class': ERROR, // enforce using `\d` 'regexp/prefer-d': ERROR, // enforces escape of replacement `$` character (`$$`) 'regexp/prefer-escape-replacement-dollar-char': ERROR, // prefer lookarounds over capturing group that do not replace 'regexp/prefer-lookaround': [ERROR, { lookbehind: true, strictTypes: true }], // enforce using named backreferences 'regexp/prefer-named-backreference': ERROR, // enforce using named capture group in regular expression 'regexp/prefer-named-capture-group': ERROR, // enforce using named replacement 'regexp/prefer-named-replacement': ERROR, // enforce using `+` quantifier 'regexp/prefer-plus-quantifier': ERROR, // prefer predefined assertion over equivalent lookarounds 'regexp/prefer-predefined-assertion': ERROR, // enforce using quantifier 'regexp/prefer-quantifier': ERROR, // enforce using `?` quantifier 'regexp/prefer-question-quantifier': ERROR, // enforce using character class range 'regexp/prefer-range': [ERROR, { target: 'alphanumeric' }], // enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided 'regexp/prefer-regexp-exec': ERROR, // enforce that `RegExp#test` is used instead of `String#match` and `RegExp#exec` 'regexp/prefer-regexp-test': ERROR, // enforce using result array `.groups`` 'regexp/prefer-result-array-groups': ERROR, // enforce using `*` quantifier 'regexp/prefer-star-quantifier': ERROR, // enforce use of unicode codepoint escapes 'regexp/prefer-unicode-codepoint-escapes': ERROR, // enforce using `\w` 'regexp/prefer-w': ERROR, // aims to optimize patterns by simplifying set operations in character classes (with v flag) 'regexp/simplify-set-operations': ERROR, // sort alternatives if order doesn't matter 'regexp/sort-alternatives': ERROR, // enforces elements order in character class 'regexp/sort-character-class-elements': ERROR, // require regex flags to be sorted 'regexp/sort-flags': ERROR, // disallow not strictly valid regular expressions 'regexp/strict': ERROR, // enforce consistent usage of unicode escape or unicode codepoint escape 'regexp/unicode-escape': ERROR, // use the `i` flag if it simplifies the pattern 'regexp/use-ignore-case': ERROR, // ReDoS vulnerability check 'redos/no-vulnerable': [ERROR, { timeout: 1e3, cache: { strategy: 'aggressive' } }], // disallow function declarations in if statement clauses without using blocks 'es/no-function-declarations-in-if-statement-clauses-without-block': ERROR, // disallow initializers in for-in heads 'es/no-initializers-in-for-in': ERROR, // disallow \u2028 and \u2029 in string literals 'es/no-json-superset': ERROR, // disallow labelled function declarations 'es/no-labelled-function-declarations': ERROR, // disallow the `RegExp.prototype.compile` method 'es/no-regexp-prototype-compile': ERROR, // eslint-comments: // disallow duplicate `eslint-disable` comments 'eslint-comments/no-duplicate-disable': ERROR, // disallow `eslint-disable` comments without rule names 'eslint-comments/no-unlimited-disable': ERROR, // disallow unused `eslint-disable` comments // it's clearly disabled since result of some rules (like `redos/no-vulnerable`) is non-deterministic // and anyway it's reported because of `reportUnusedDisableDirectives` option 'eslint-comments/no-unused-disable': OFF, // disallow unused `eslint-enable` comments 'eslint-comments/no-unused-enable': ERROR, // require include descriptions in eslint directive-comments 'eslint-comments/require-description': ERROR, }; const noAsyncAwait = { // prefer `async` / `await` to the callback pattern 'promise/prefer-await-to-callbacks': OFF, // prefer `await` to `then()` / `catch()` / `finally()` for reading `Promise` values 'promise/prefer-await-to-then': OFF, }; const useES3Syntax = { ...noAsyncAwait, // encourages use of dot notation whenever possible 'dot-notation': [ERROR, { allowKeywords: false }], // disallow logical assignment operator shorthand 'logical-assignment-operators': [ERROR, NEVER], // disallow function or variable declarations in nested blocks 'no-inner-declarations': ERROR, // disallow specified syntax 'no-restricted-syntax': OFF, // require let or const instead of var 'no-var': OFF, // require or disallow method and property shorthand syntax for object literals 'object-shorthand': OFF, // require using arrow functions for callbacks 'prefer-arrow-callback': OFF, // require const declarations for variables that are never reassigned after declared 'prefer-const': OFF, // require destructuring from arrays and/or objects 'prefer-destructuring': OFF, // prefer the exponentiation operator over `Math.pow()` 'prefer-exponentiation-operator': OFF, // require rest parameters instead of `arguments` 'prefer-rest-params': OFF, // require spread operators instead of `.apply()` 'prefer-spread': OFF, // require template literals instead of string concatenation 'prefer-template': OFF, // disallow trailing commas in multiline object literals '@stylistic/js/comma-dangle': [ERROR, NEVER], // require or disallow use of quotes around object literal property names '@stylistic/js/quote-props': [ERROR, 'as-needed', { keywords: true }], // prefer lookarounds over capturing group that do not replace 'regexp/prefer-lookaround': [ERROR, { lookbehind: false, strictTypes: true }], // enforce using named capture group in regular expression 'regexp/prefer-named-capture-group': OFF, // prefer default parameters over reassignment 'unicorn/prefer-default-parameters': OFF, // prefer using a logical operator over a ternary 'unicorn/prefer-logical-operator-over-ternary': OFF, // prefer omitting the `catch` binding parameter 'unicorn/prefer-optional-catch-binding': OFF, }; const forbidESAnnexBBuiltIns = { 'es/no-date-prototype-getyear-setyear': ERROR, 'es/no-date-prototype-togmtstring': ERROR, 'es/no-escape-unescape': ERROR, 'es/no-legacy-object-prototype-accessor-methods': ERROR, 'es/no-string-create-html-methods': ERROR, 'es/no-string-prototype-trimleft-trimright': ERROR, // prefer `String#slice` over `String#{ substr, substring }` 'unicorn/prefer-string-slice': ERROR, }; const forbidES5BuiltIns = { 'es/no-array-isarray': ERROR, 'es/no-array-prototype-every': ERROR, 'es/no-array-prototype-filter': ERROR, 'es/no-array-prototype-foreach': ERROR, 'es/no-array-prototype-indexof': ERROR, 'es/no-array-prototype-lastindexof': ERROR, 'es/no-array-prototype-map': ERROR, 'es/no-array-prototype-reduce': ERROR, 'es/no-array-prototype-reduceright': ERROR, 'es/no-array-prototype-some': ERROR, 'es/no-date-now': ERROR, 'es/no-function-prototype-bind': ERROR, 'es/no-json': ERROR, 'es/no-object-create': ERROR, 'es/no-object-defineproperties': ERROR, 'es/no-object-defineproperty': ERROR, 'es/no-object-freeze': ERROR, 'es/no-object-getownpropertydescriptor': ERROR, 'es/no-object-getownpropertynames': ERROR, 'es/no-object-getprototypeof': ERROR, 'es/no-object-isextensible': ERROR, 'es/no-object-isfrozen': ERROR, 'es/no-object-issealed': ERROR, 'es/no-object-keys': ERROR, 'es/no-object-preventextensions': ERROR, 'es/no-object-seal': ERROR, 'es/no-string-prototype-trim': ERROR, // prefer `Date.now()` to get the number of milliseconds since the Unix Epoch 'unicorn/prefer-date-now': OFF, }; const forbidES2015BuiltIns = { 'es/no-array-from': ERROR, 'es/no-array-of': ERROR, 'es/no-array-prototype-copywithin': ERROR, 'es/no-array-prototype-entries': ERROR, 'es/no-array-prototype-fill': ERROR, 'es/no-array-prototype-find': ERROR, 'es/no-array-prototype-findindex': ERROR, 'es/no-array-prototype-keys': ERROR, 'es/no-array-prototype-values': ERROR, 'es/no-map': ERROR, 'es/no-math-acosh': ERROR, 'es/no-math-asinh': ERROR, 'es/no-math-atanh': ERROR, 'es/no-math-cbrt': ERROR, 'es/no-math-clz32': ERROR, 'es/no-math-cosh': ERROR, 'es/no-math-expm1': ERROR, 'es/no-math-fround': ERROR, 'es/no-math-hypot': ERROR, 'es/no-math-imul': ERROR, 'es/no-math-log10': ERROR, 'es/no-math-log1p': ERROR, 'es/no-math-log2': ERROR, 'es/no-math-sign': ERROR, 'es/no-math-sinh': ERROR, 'es/no-math-tanh': ERROR, 'es/no-math-trunc': ERROR, 'es/no-number-epsilon': ERROR, 'es/no-number-isfinite': ERROR, 'es/no-number-isinteger': ERROR, 'es/no-number-isnan': ERROR, 'es/no-number-issafeinteger': ERROR, 'es/no-number-maxsafeinteger': ERROR, 'es/no-number-minsafeinteger': ERROR, 'es/no-number-parsefloat': ERROR, 'es/no-number-parseint': ERROR, 'es/no-object-assign': ERROR, 'es/no-object-getownpropertysymbols': ERROR, 'es/no-object-is': ERROR, 'es/no-object-setprototypeof': ERROR, 'es/no-promise': ERROR, 'es/no-proxy': ERROR, 'es/no-reflect': ERROR, 'es/no-regexp-prototype-flags': ERROR, 'es/no-set': ERROR, 'es/no-string-fromcodepoint': ERROR, 'es/no-string-prototype-codepointat': ERROR, 'es/no-string-prototype-endswith': ERROR, 'es/no-string-prototype-includes': ERROR, 'es/no-string-prototype-normalize': ERROR, 'es/no-string-prototype-repeat': ERROR, 'es/no-string-prototype-startswith': ERROR, 'es/no-string-raw': ERROR, 'es/no-symbol': ERROR, 'es/no-typed-arrays': ERROR, 'es/no-weak-map': ERROR, 'es/no-weak-set': ERROR, // prefer modern `Math` APIs over legacy patterns 'unicorn/prefer-modern-math-apis': OFF, // prefer `String#{ startsWith, endsWith }()` over `RegExp#test()` 'unicorn/prefer-string-starts-ends-with': OFF, }; const forbidES2016BuiltIns = { 'es/no-array-prototype-includes': ERROR, // prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence 'unicorn/prefer-includes': OFF, }; const forbidES2017BuiltIns = { 'es/no-atomics': ERROR, 'es/no-object-entries': ERROR, 'es/no-object-getownpropertydescriptors': ERROR, 'es/no-object-values': ERROR, 'es/no-shared-array-buffer': ERROR, 'es/no-string-prototype-padstart-padend': ERROR, }; const forbidES2018BuiltIns = { 'es/no-promise-prototype-finally': ERROR, }; const forbidES2019BuiltIns = { 'es/no-array-prototype-flat': ERROR, 'es/no-object-fromentries': ERROR, 'es/no-string-prototype-trimstart-trimend': ERROR, 'es/no-symbol-prototype-description': ERROR, // use `.flat()` to flatten an array of arrays 'unicorn/prefer-array-flat': OFF, // prefer using `Object.fromEntries()` to transform a list of key-value pairs into an object 'unicorn/prefer-object-from-entries': OFF, // prefer `String#{ trimStart, trimEnd }()` over `String#{ trimLeft, trimRight }()` 'unicorn/prefer-string-trim-start-end': OFF, }; const forbidES2020BuiltIns = { 'es/no-bigint': ERROR, 'es/no-global-this': ERROR, 'es/no-promise-all-settled': ERROR, 'es/no-regexp-unicode-property-escapes-2020': ERROR, 'es/no-string-prototype-matchall': ERROR, }; const forbidES2021BuiltIns = { 'es/no-promise-any': ERROR, 'es/no-regexp-unicode-property-escapes-2021': ERROR, 'es/no-string-prototype-replaceall': ERROR, 'es/no-weakrefs': ERROR, // prefer `String#replaceAll()` over regex searches with the global flag 'unicorn/prefer-string-replace-all': OFF, }; const forbidES2022BuiltIns = { // prefer `Object.hasOwn` 'prefer-object-has-own': OFF, 'es/no-array-string-prototype-at': ERROR, 'es/no-error-cause': ERROR, 'es/no-object-hasown': ERROR, 'es/no-regexp-d-flag': ERROR, 'es/no-regexp-unicode-property-escapes-2022': ERROR, // prefer `.at()` method for index access and `String#charAt()` 'unicorn/prefer-at': OFF, }; const forbidES2023BuiltIns = { 'es/no-array-prototype-findlast-findlastindex': ERROR, 'es/no-array-prototype-toreversed': ERROR, 'es/no-array-prototype-tosorted': ERROR, 'es/no-array-prototype-tospliced': ERROR, 'es/no-array-prototype-with': ERROR, 'es/no-regexp-unicode-property-escapes-2023': ERROR, }; const forbidES2024BuiltIns = { 'es/no-atomics-waitasync': ERROR, 'es/no-string-prototype-iswellformed-towellformed': ERROR, 'es/no-regexp-v-flag': ERROR, }; const forbidES2016IntlBuiltIns = { 'es/no-intl-getcanonicallocales': ERROR, }; const forbidES2017IntlBuiltIns = { 'es/no-intl-datetimeformat-prototype-formattoparts': ERROR, }; const forbidES2018IntlBuiltIns = { 'es/no-intl-numberformat-prototype-formattoparts': ERROR, 'es/no-intl-pluralrules': ERROR, }; const forbidES2020IntlBuiltIns = { 'es/no-intl-locale': ERROR, 'es/no-intl-relativetimeformat': ERROR, }; const forbidES2021IntlBuiltIns = { 'es/no-intl-datetimeformat-prototype-formatrange': ERROR, 'es/no-intl-displaynames': ERROR, 'es/no-intl-listformat': ERROR, }; const forbidES2022IntlBuiltIns = { 'es/no-intl-segmenter': ERROR, 'es/no-intl-supportedvaluesof': ERROR, }; const forbidES2023IntlBuiltIns = { 'es/no-intl-numberformat-prototype-formatrange': ERROR, 'es/no-intl-numberformat-prototype-formatrangetoparts': ERROR, 'es/no-intl-pluralrules-prototype-selectrange': ERROR, }; const forbidModernESBuiltIns = { ...forbidESAnnexBBuiltIns, ...forbidES5BuiltIns, ...forbidES2015BuiltIns, ...forbidES2016BuiltIns, ...forbidES2017BuiltIns, ...forbidES2018BuiltIns, ...forbidES2019BuiltIns, ...forbidES2020BuiltIns, ...forbidES2021BuiltIns, ...forbidES2022BuiltIns, ...forbidES2023BuiltIns, ...forbidES2024BuiltIns, ...forbidES2016IntlBuiltIns, ...forbidES2017IntlBuiltIns, ...forbidES2018IntlBuiltIns, ...forbidES2020IntlBuiltIns, ...forbidES2021IntlBuiltIns, ...forbidES2022IntlBuiltIns, ...forbidES2023IntlBuiltIns, }; const polyfills = { // avoid nested `then()` or `catch()` statements 'promise/no-nesting': OFF, // prefer `RegExp#test()` over `String#match()` and `RegExp#exec()` // use `RegExp#exec()` since it does not have implicit calls under the hood 'regexp/prefer-regexp-test': OFF, }; const transpiledAndPolyfilled = { ...noAsyncAwait, // disallow accessor properties 'es/no-accessor-properties': ERROR, // disallow async functions 'es/no-async-functions': ERROR, // disallow async iteration 'es/no-async-iteration': ERROR, // disallow generators 'es/no-generators': ERROR, // disallow top-level `await` 'es/no-top-level-await': ERROR, // unpolyfillable es2015 builtins 'es/no-proxy': ERROR, 'es/no-string-prototype-normalize': ERROR, // unpolyfillable es2017 builtins 'es/no-atomics': ERROR, 'es/no-shared-array-buffer': ERROR, // unpolyfillable es2020 builtins 'es/no-bigint': ERROR, // unpolyfillable es2021 builtins 'es/no-weakrefs': ERROR, // prefer lookarounds over capturing group that do not replace 'regexp/prefer-lookaround': [ERROR, { lookbehind: false, strictTypes: true }], // enforce using named capture group in regular expression 'regexp/prefer-named-capture-group': OFF, }; const nodePackages = { // disallow logical assignment operator shorthand 'logical-assignment-operators': [ERROR, NEVER], // enforces the use of `catch()` on un-returned promises 'promise/catch-or-return': ERROR, // disallow third-party modules which are hiding core modules 'node/no-hide-core-modules': OFF, // disallow unsupported ECMAScript built-ins on the specified version 'node/no-unsupported-features/node-builtins': [ERROR, { version: PACKAGES_NODE_VERSIONS }], // prefer promises 'node/prefer-promises/dns': OFF, 'node/prefer-promises/fs': OFF, // prefer lookarounds over capturing group that do not replace 'regexp/prefer-lookaround': [ERROR, { lookbehind: false, strictTypes: true }], // enforce using named capture group in regular expression 'regexp/prefer-named-capture-group': OFF, // prefer using a logical operator over a ternary 'unicorn/prefer-logical-operator-over-ternary': OFF, // prefer using the `node:` protocol when importing Node builtin modules 'unicorn/prefer-node-protocol': OFF, // prefer omitting the `catch` binding parameter 'unicorn/prefer-optional-catch-binding': OFF, ...disable(forbidES5BuiltIns), ...disable(forbidES2015BuiltIns), ...disable(forbidES2016BuiltIns), ...disable(forbidES2017BuiltIns), 'es/no-atomics': ERROR, 'es/no-shared-array-buffer': ERROR, // disallow top-level `await` 'es/no-top-level-await': ERROR, ...forbidES2018BuiltIns, ...forbidES2019BuiltIns, ...forbidES2020BuiltIns, ...forbidES2021BuiltIns, ...forbidES2022BuiltIns, ...forbidES2023BuiltIns, ...forbidES2024BuiltIns, ...disable(forbidES2016IntlBuiltIns), ...disable(forbidES2017IntlBuiltIns), ...forbidES2018IntlBuiltIns, ...forbidES2020IntlBuiltIns, ...forbidES2021IntlBuiltIns, ...forbidES2022IntlBuiltIns, ...forbidES2023IntlBuiltIns, }; const nodeDev = { // disallow unsupported ECMAScript built-ins on the specified version 'node/no-unsupported-features/node-builtins': [ERROR, { version: DEV_NODE_VERSIONS }], ...disable(forbidModernESBuiltIns), ...forbidES2023BuiltIns, 'es/no-array-prototype-findlast-findlastindex': OFF, ...forbidES2024BuiltIns, 'es/no-intl-supportedvaluesof': ERROR, ...forbidES2023IntlBuiltIns, // ReDoS vulnerability check 'redos/no-vulnerable': OFF, // prefer top-level await 'unicorn/prefer-top-level-await': ERROR, }; const tests = { // relax for testing: // enforces return statements in callbacks of array's methods 'array-callback-return': OFF, // specify the maximum number of statement allowed in a function 'max-statements': OFF, // disallow function declarations and expressions inside loop statements 'no-loop-func': OFF, // disallow use of new operator when not part of the assignment or comparison 'no-new': OFF, // disallow use of new operator for Function object 'no-new-func': OFF, // disallows creating new instances of String, Number, and Boolean 'no-new-wrappers': OFF, // disallow specified syntax 'no-restricted-syntax': OFF, // restrict what can be thrown as an exception 'no-throw-literal': OFF, // disallow usage of expressions in statement position 'no-unused-expressions': OFF, // disallow dangling underscores in identifiers 'no-underscore-dangle': [ERROR, { allow: [ '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', ] }], // disallow unnecessary calls to `.call()` and `.apply()` 'no-useless-call': OFF, // specify the maximum length of a line in your program '@stylistic/js/max-len': [ERROR, { ...base['@stylistic/js/max-len'][1], code: 180 }], // enforce passing a message value when throwing a built-in error 'unicorn/error-message': OFF, // prefer `.at()` method for index access and `String#charAt()` 'unicorn/prefer-at': OFF, // prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence 'unicorn/prefer-includes': OFF, // ReDoS vulnerability check 'redos/no-vulnerable': OFF, // allow Annex B methods for testing ...disable(forbidESAnnexBBuiltIns), }; const qunit = { // ensure the correct number of assert arguments is used 'qunit/assert-args': ERROR, // enforce comparison assertions have arguments in the right order 'qunit/literal-compare-order': ERROR, // forbid the use of `assert.equal` 'qunit/no-assert-equal': ERROR, // require use of boolean assertions 'qunit/no-assert-equal-boolean': ERROR, // disallow binary logical expressions in assert arguments 'qunit/no-assert-logical-expression': ERROR, // forbid async calls in loops 'qunit/no-async-in-loops': ERROR, // disallow async module callbacks 'qunit/no-async-module-callbacks': ERROR, // forbid the use of `asyncTest` 'qunit/no-async-test': ERROR, // forbid commented tests 'qunit/no-commented-tests': ERROR, // forbid comparing relational expression to boolean in assertions 'qunit/no-compare-relation-boolean': ERROR, // prevent early return in a qunit test 'qunit/no-early-return': ERROR, // forbid the use of global qunit assertions 'qunit/no-global-assertions': ERROR, // forbid the use of global `expect` 'qunit/no-global-expect': ERROR, // forbid the use of global `module` / `test` / `asyncTest` 'qunit/no-global-module-test': ERROR, // forbid use of global `stop` / `start` 'qunit/no-global-stop-start': ERROR, // disallow the use of hooks from ancestor modules 'qunit/no-hooks-from-ancestor-modules': ERROR, // forbid identical test and module names 'qunit/no-identical-names': ERROR, // forbid use of `QUnit.init` 'qunit/no-init': ERROR, // forbid use of `QUnit.jsDump` 'qunit/no-jsdump': ERROR, // disallow the use of `assert.equal` / `assert.ok` / `assert.notEqual` / `assert.notOk`` 'qunit/no-loose-assertions': ERROR, // forbid `QUnit.test()` calls inside callback of another `QUnit.test` 'qunit/no-nested-tests': ERROR, // forbid equality comparisons in `assert.{ ok, notOk }` 'qunit/no-ok-equality': ERROR, // disallow `QUnit.only` 'qunit/no-only': ERROR, // forbid the use of `QUnit.push` 'qunit/no-qunit-push': ERROR, // forbid `QUnit.start` within tests or test hooks 'qunit/no-qunit-start-in-tests': ERROR, // forbid the use of `QUnit.stop` 'qunit/no-qunit-stop': ERROR, // forbid overwriting of QUnit logging callbacks 'qunit/no-reassign-log-callbacks': ERROR, // forbid use of `QUnit.reset` 'qunit/no-reset': ERROR, // forbid setup / teardown module hooks 'qunit/no-setup-teardown': ERROR, // forbid expect argument in `QUnit.test` 'qunit/no-test-expect-argument': ERROR, // forbid assert.throws() with block, string, and message 'qunit/no-throws-string': ERROR, // enforce use of objects as expected value in `assert.propEqual` 'qunit/require-object-in-propequal': ERROR, // require that all async calls should be resolved in tests 'qunit/resolve-async': ERROR, }; const json = { // enforce spacing inside array brackets 'jsonc/array-bracket-spacing': [ERROR, NEVER], // disallow trailing commas in multiline object literals 'jsonc/comma-dangle': [ERROR, NEVER], // enforce one true comma style 'jsonc/comma-style': [ERROR, 'last'], // enforce consistent indentation 'jsonc/indent': [ERROR, 2], // enforces spacing between keys and values in object literal properties 'jsonc/key-spacing': [ERROR, { beforeColon: false, afterColon: true }], // disallow BigInt literals 'jsonc/no-bigint-literals': ERROR, // disallow binary expression 'jsonc/no-binary-expression': ERROR, // disallow binary numeric literals 'jsonc/no-binary-numeric-literals': ERROR, // disallow comments 'jsonc/no-comments': ERROR, // disallow duplicate keys when creating object literals 'jsonc/no-dupe-keys': ERROR, // disallow escape sequences in identifiers. 'jsonc/no-escape-sequence-in-identifier': ERROR, // disallow leading or trailing decimal points in numeric literals 'jsonc/no-floating-decimal': ERROR, // disallow hexadecimal numeric literals 'jsonc/no-hexadecimal-numeric-literals': ERROR, // disallow `Infinity` 'jsonc/no-infinity': ERROR, // disallow irregular whitespace 'jsonc/no-irregular-whitespace': ERROR, // disallow use of multiline strings 'jsonc/no-multi-str': ERROR, // disallow `NaN` 'jsonc/no-nan': ERROR, // disallow number property keys 'jsonc/no-number-props': ERROR, // disallow numeric separators 'jsonc/no-numeric-separators': ERROR, // disallow use of octal escape sequences in string literals, such as var foo = 'Copyright \251'; 'jsonc/no-octal-escape': ERROR, // disallow octal numeric literals 'jsonc/no-octal-numeric-literals': ERROR, // disallow legacy octal literals 'jsonc/no-octal': ERROR, // disallow parentheses around the expression 'jsonc/no-parenthesized': ERROR, // disallow plus sign 'jsonc/no-plus-sign': ERROR, // disallow RegExp literals 'jsonc/no-regexp-literals': ERROR, // disallow sparse arrays 'jsonc/no-sparse-arrays': ERROR, // disallow template literals 'jsonc/no-template-literals': ERROR, // disallow `undefined` 'jsonc/no-undefined-value': ERROR, // disallow Unicode code point escape sequences. 'jsonc/no-unicode-codepoint-escapes': ERROR, // disallow unnecessary string escaping 'jsonc/no-useless-escape': ERROR, // enforce consistent line breaks after opening and before closing braces 'jsonc/object-curly-newline': [ERROR, { consistent: true }], // enforce spaces inside braces 'jsonc/object-curly-spacing': [ERROR, ALWAYS], // require or disallow use of quotes around object literal property names 'jsonc/quote-props': [ERROR, ALWAYS], // specify whether double or single quotes should be used 'jsonc/quotes': [ERROR, 'double'], // require or disallow spaces before/after unary operators 'jsonc/space-unary-ops': ERROR, // disallow invalid number for JSON 'jsonc/valid-json-number': ERROR, // specify the maximum length of a line in your program '@stylistic/js/max-len': OFF, // require strict mode directives strict: OFF, }; const globalsESNext = { AsyncDisposableStack: READONLY, AsyncIterator: READONLY, DisposableStack: READONLY, Iterator: READONLY, Observable: READONLY, SuppressedError: READONLY, compositeKey: READONLY, compositeSymbol: READONLY, }; const globalsZX = { $: READONLY, __dirname: READONLY, __filename: READONLY, argv: READONLY, cd: READONLY, chalk: READONLY, echo: READONLY, fetch: READONLY, fs: READONLY, glob: READONLY, nothrow: READONLY, os: READONLY, path: READONLY, question: READONLY, require: READONLY, sleep: READONLY, stdin: READONLY, which: READONLY, within: READONLY, YAML: READONLY, }; module.exports = [ { ignores: [ 'deno/corejs/**', 'docs/**', 'packages/core-js-bundle/!(package.json)', 'packages/core-js-compat/!(package).json', 'packages/core-js-pure/override/**', 'tests/**/bundles/**', 'tests/compat/compat-data.js', 'tests/unit-@(global|pure)/index.js', ], }, { languageOptions: { ecmaVersion: 'latest', sourceType: 'script', // unnecessary global builtins disabled by related rules globals: { ...globals.builtin, ...globals.browser, ...globals.node, ...globals.worker, }, }, linterOptions: { reportUnusedDisableDirectives: true, }, plugins: { '@stylistic/js': pluginStylisticJS, 'array-func': pluginArrayFunc, es: pluginESX, 'eslint-comments': pluginESlintComments, filenames: pluginFilenames, import: pluginImport, jsonc: pluginJSONC, node: pluginN, promise: pluginPromise, qunit: pluginQUnit, redos: pluginReDoS, regexp: pluginRegExp, sonarjs: pluginSonarJS, unicorn: pluginUnicorn, }, rules: { ...base, ...forbidESAnnexBBuiltIns, }, }, { files: [ '**/*.mjs', ], languageOptions: { sourceType: 'module', }, }, { files: [ 'packages/core-js?(-pure)/**', 'tests/@(compat|worker)/*.js', ], languageOptions: { ecmaVersion: 3, }, rules: useES3Syntax, }, { files: [ 'packages/core-js?(-pure)/**', 'tests/@(unit-pure|worker)/**', 'tests/compat/@(browsers|hermes|node|rhino)-runner.js', ], rules: forbidModernESBuiltIns, }, { files: [ 'packages/core-js?(-pure)/**', ], rules: polyfills, }, { files: [ '**/postinstall.js', ], rules: disable(forbidES5BuiltIns), }, { files: [ 'tests/@(helpers|unit-@(global|pure)|wpt-url-resources)/**', ], languageOptions: { sourceType: 'module', }, rules: transpiledAndPolyfilled, }, { files: [ 'tests/**', ], rules: tests, }, { files: [ 'tests/@(helpers|unit-@(global|pure))/**', ], languageOptions: { globals: globals.qunit, }, rules: qunit, }, { files: [ 'packages/core-js-@(builder|compat)/**', ], rules: nodePackages, }, { files: [ '*.js', 'packages/core-js-compat/src/**', 'scripts/**', 'tests/compat/*.mjs', 'tests/@(compat-@(data|tools)|eslint|entries|observables|promises-aplus|unit-@(karma|node))/**', ], rules: nodeDev, }, { files: [ 'tests/@(compat|unit-global)/**', ], languageOptions: { globals: globalsESNext, }, }, { files: [ '@(scripts|tests)/*/**', ], rules: { // disable this rule for lazily installed dependencies 'import/no-unresolved': [ERROR, { commonjs: true, ignore: ['^[^.]'] }], }, }, { files: [ 'packages/core-js-compat/src/**', 'scripts/**', 'tests/**/*.mjs', ], languageOptions: { // zx globals: globalsZX, }, rules: { // allow use of console 'no-console': OFF, // import used for tasks 'import/first': OFF, }, }, { rules: { // ensure that filenames match a convention 'filenames/match-regex': [ERROR, /^[\da-z]|[a-z][\d\-.a-z]*[\da-z]$/], }, }, { files: [ 'packages/core-js?(-pure)/modules/**', ], rules: { // ensure that filenames match a convention 'filenames/match-regex': [ERROR, /^(?:es|esnext|web)(?:\.[a-z][\d\-a-z]*[\da-z])+$/], }, }, { files: [ 'tests/@(unit-@(global|pure))/**', ], rules: { // ensure that filenames match a convention 'filenames/match-regex': [ERROR, /^(?:es|esnext|helpers|web)(?:\.[a-z][\d\-a-z]*[\da-z])+$/], }, }, { files: ['**/*.json'], languageOptions: { parser: parserJSONC, }, rules: json, }, ]; core-js-3.33.2/tests/eslint/package-lock.json000066400000000000000000004340601451776221300210370ustar00rootroot00000000000000{ "name": "tests/eslint", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/eslint", "devDependencies": { "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0", "@stylistic/eslint-plugin-js": "^0.1.2", "confusing-browser-globals": "^1.0.11", "eslint": "^8.52.0", "eslint-plugin-array-func": "^4.0.0", "eslint-plugin-es-x": "^7.2.0", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsonc": "^2.10.0", "eslint-plugin-n": "^16.2.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-qunit": "^8.0.1", "eslint-plugin-redos": "^4.5.0-beta.4", "eslint-plugin-regexp": "^2.1.1", "eslint-plugin-sonarjs": "~0.21.0", "eslint-plugin-unicorn": "^49.0.0", "globals": "^13.23.0", "jsonc-eslint-parser": "^2.4.0" } }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/@babel/code-frame": { "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/code-frame/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "dependencies": { "color-convert": "^1.9.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/code-frame/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/code-frame/node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/@babel/code-frame/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" } }, "node_modules/@babel/code-frame/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/@babel/code-frame/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "dependencies": { "has-flag": "^3.0.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "dependencies": { "color-convert": "^1.9.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" } }, "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "dependencies": { "has-flag": "^3.0.0" }, "engines": { "node": ">=4" } }, "node_modules/@eslint-community/eslint-plugin-eslint-comments": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-4.1.0.tgz", "integrity": "sha512-B2mwipifrBS5E00vN8vME68laPMZ0h3sNGOEDj5g9iUN9k5EU99Omq0Nc325eKNoFFDnDtiHp3DqIjO+1bstag==", "dev": true, "dependencies": { "escape-string-regexp": "^4.0.0", "ignore": "^5.2.4" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "dependencies": { "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "node_modules/@eslint-community/regexpp": { "version": "4.10.0", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/@eslint/js": { "version": "8.52.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.13", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, "engines": { "node": ">=12.22" }, "funding": { "type": "github", "url": "https://github.com/sponsors/nzakas" } }, "node_modules/@humanwhocodes/object-schema": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" }, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.stat": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" }, "engines": { "node": ">= 8" } }, "node_modules/@pkgr/utils": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "fast-glob": "^3.3.0", "is-glob": "^4.0.3", "open": "^9.1.0", "picocolors": "^1.0.0", "tslib": "^2.6.0" }, "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/unts" } }, "node_modules/@stylistic/eslint-plugin-js": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-0.1.2.tgz", "integrity": "sha512-s0BdSiAd8SIInpBN4aFl17vQhZMEFokennZ64gWGyPvdrO68gJxHgD9Rox5srVXWEPaBw/YIIRA/2JhpNoElCA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "acorn": "^8.10.0", "escape-string-regexp": "^4.0.0", "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esutils": "^2.0.3", "graphemer": "^1.4.0" } }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.3.tgz", "integrity": "sha512-ehPtgRgaULsFG8x0NeYJvmyH1hmlfsNLujHe9dQEia/7MAJYdzMSi19JtchUHjmBA6XC/75dK55mzZH+RyieSg==", "dev": true }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" }, "engines": { "node": ">=0.4.0" } }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, "node_modules/array-buffer-byte-length": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "is-array-buffer": "^3.0.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array-includes": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "get-intrinsic": "^1.2.1", "is-string": "^1.0.7" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array.prototype.findlastindex": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0", "get-intrinsic": "^1.2.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array.prototype.flat": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array.prototype.flatmap": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/arraybuffer.prototype.slice": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "get-intrinsic": "^1.2.1", "is-array-buffer": "^3.0.2", "is-shared-array-buffer": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", "dev": true, "engines": { "node": ">=0.6" } }, "node_modules/bplist-parser": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", "dev": true, "dependencies": { "big-integer": "^1.6.44" }, "engines": { "node": ">= 5.10.0" } }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "dependencies": { "fill-range": "^7.0.1" }, "engines": { "node": ">=8" } }, "node_modules/builtin-modules": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", "dev": true, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", "dev": true, "dependencies": { "semver": "^7.0.0" } }, "node_modules/builtins/node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/bundle-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", "dev": true, "dependencies": { "run-applescript": "^5.0.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/call-bind": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "get-intrinsic": "^1.2.1", "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/sibiraj-s" } ], "engines": { "node": ">=8" } }, "node_modules/clean-regexp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", "integrity": "sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==", "dev": true, "dependencies": { "escape-string-regexp": "^1.0.5" }, "engines": { "node": ">=4" } }, "node_modules/clean-regexp/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" } }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/comment-parser": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", "dev": true, "engines": { "node": ">= 12.0.0" } }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/confusing-browser-globals": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" }, "engines": { "node": ">= 8" } }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "node_modules/default-browser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", "dev": true, "dependencies": { "bundle-name": "^3.0.0", "default-browser-id": "^3.0.0", "execa": "^7.1.1", "titleize": "^3.0.0" }, "engines": { "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/default-browser-id": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", "dev": true, "dependencies": { "bplist-parser": "^0.2.0", "untildify": "^4.0.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/define-data-property": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/define-lazy-prop": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, "dependencies": { "esutils": "^2.0.2" }, "engines": { "node": ">=6.0.0" } }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } }, "node_modules/es-abstract": { "version": "1.22.3", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "arraybuffer.prototype.slice": "^1.0.2", "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.5", "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.2", "get-symbol-description": "^1.0.0", "globalthis": "^1.0.3", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0", "internal-slot": "^1.0.5", "is-array-buffer": "^3.0.2", "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", "is-typed-array": "^1.1.12", "is-weakref": "^1.0.2", "object-inspect": "^1.13.1", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.5.1", "safe-array-concat": "^1.0.1", "safe-regex-test": "^1.0.0", "string.prototype.trim": "^1.2.8", "string.prototype.trimend": "^1.0.7", "string.prototype.trimstart": "^1.0.7", "typed-array-buffer": "^1.0.0", "typed-array-byte-length": "^1.0.0", "typed-array-byte-offset": "^1.0.0", "typed-array-length": "^1.0.4", "unbox-primitive": "^1.0.2", "which-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es-set-tostringtag": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.2", "has-tostringtag": "^1.0.0", "hasown": "^2.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/es-shim-unscopables": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", "dev": true, "dependencies": { "hasown": "^2.0.0" } }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", "is-symbol": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint": { "version": "8.52.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", "@eslint/js": "8.52.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3", "strip-ansi": "^6.0.1", "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-compat-utils": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz", "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==", "dev": true, "engines": { "node": ">=12" }, "peerDependencies": { "eslint": ">=6.0.0" } }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "dependencies": { "debug": "^3.2.7", "is-core-module": "^2.13.0", "resolve": "^1.22.4" } }, "node_modules/eslint-import-resolver-node/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/eslint-module-utils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, "dependencies": { "debug": "^3.2.7" }, "engines": { "node": ">=4" }, "peerDependenciesMeta": { "eslint": { "optional": true } } }, "node_modules/eslint-module-utils/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/eslint-plugin-array-func": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-array-func/-/eslint-plugin-array-func-4.0.0.tgz", "integrity": "sha512-p3NY2idNIvgmQLF2/62ZskYt8gOuUgQ51smRc3Lh7FtSozpNc2sg+lniz9VaCagLZHEZTl8qGJKqE7xy8O/D/g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "peerDependencies": { "eslint": ">=8.40.0" } }, "node_modules/eslint-plugin-es-x": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.1.2", "@eslint-community/regexpp": "^4.6.0" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/ota-meshi" }, "peerDependencies": { "eslint": ">=8" } }, "node_modules/eslint-plugin-filenames": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/eslint-plugin-filenames/-/eslint-plugin-filenames-1.3.2.tgz", "integrity": "sha512-tqxJTiEM5a0JmRCUYQmxw23vtTxrb2+a3Q2mMOPhFxvt7ZQQJmdiuMby9B/vUAuVMghyP7oET+nIf6EO6CBd/w==", "dev": true, "dependencies": { "lodash.camelcase": "4.3.0", "lodash.kebabcase": "4.1.1", "lodash.snakecase": "4.1.1", "lodash.upperfirst": "4.3.1" }, "peerDependencies": { "eslint": "*" } }, "node_modules/eslint-plugin-import": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", "dev": true, "dependencies": { "array-includes": "^3.1.7", "array.prototype.findlastindex": "^1.2.3", "array.prototype.flat": "^1.3.2", "array.prototype.flatmap": "^1.3.2", "debug": "^3.2.7", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.9", "eslint-module-utils": "^2.8.0", "hasown": "^2.0.0", "is-core-module": "^2.13.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", "object.fromentries": "^2.0.7", "object.groupby": "^1.0.1", "object.values": "^1.1.7", "semver": "^6.3.1", "tsconfig-paths": "^3.14.2" }, "engines": { "node": ">=4" }, "peerDependencies": { "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, "node_modules/eslint-plugin-import/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "dependencies": { "esutils": "^2.0.2" }, "engines": { "node": ">=0.10.0" } }, "node_modules/eslint-plugin-jsonc": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.10.0.tgz", "integrity": "sha512-9d//o6Jyh4s1RxC9fNSt1+MMaFN2ruFdXPG9XZcb/mR2KkfjADYiNL/hbU6W0Cyxfg3tS/XSFuhl5LgtMD8hmw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "eslint-compat-utils": "^0.1.2", "jsonc-eslint-parser": "^2.0.4", "natural-compare": "^1.4.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/ota-meshi" }, "peerDependencies": { "eslint": ">=6.0.0" } }, "node_modules/eslint-plugin-n": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.2.0.tgz", "integrity": "sha512-AQER2jEyQOt1LG6JkGJCCIFotzmlcCZFur2wdKrp1JX2cNotC7Ae0BcD/4lLv3lUAArM9uNS8z/fsvXTd0L71g==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "builtins": "^5.0.1", "eslint-plugin-es-x": "^7.1.0", "get-tsconfig": "^4.7.0", "ignore": "^5.2.4", "is-core-module": "^2.12.1", "minimatch": "^3.1.2", "resolve": "^1.22.2", "semver": "^7.5.3" }, "engines": { "node": ">=16.0.0" }, "funding": { "url": "https://github.com/sponsors/mysticatea" }, "peerDependencies": { "eslint": ">=7.0.0" } }, "node_modules/eslint-plugin-n/node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/eslint-plugin-promise": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "peerDependencies": { "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/eslint-plugin-qunit": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-qunit/-/eslint-plugin-qunit-8.0.1.tgz", "integrity": "sha512-3bFOPryXoQOez95oP/JfWTxHBc/bgDQQZqTuv9uYTwH5sdIvSM2TES1iHDcy/F/LvqiqIpscDAOPAjlqSCnNPg==", "dev": true, "dependencies": { "eslint-utils": "^3.0.0", "requireindex": "^1.2.0" }, "engines": { "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, "node_modules/eslint-plugin-redos": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/eslint-plugin-redos/-/eslint-plugin-redos-4.5.0-beta.4.tgz", "integrity": "sha512-bOjRGB/k+DaRu3pX7ujQ3T1mDb0PUmMz67vs6xQxQG5vZqX4a4yMMbB9joCrOB9ieIMOk88gfocOVF8UGqyxpQ==", "dev": true, "dependencies": { "recheck": "4.5.0-beta.4" }, "engines": { "node": ">=14" }, "peerDependencies": { "eslint": ">= 3" } }, "node_modules/eslint-plugin-regexp": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-regexp/-/eslint-plugin-regexp-2.1.1.tgz", "integrity": "sha512-FGa/idrL5tzMCnGylyx8DCWTX3vDuEtE/CVqTx+yYwe5qY3JRppbNVkOVGIkQF0klVlrG+LxwAXRXTUr5yU5uA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.9.1", "comment-parser": "^1.4.0", "jsdoc-type-pratt-parser": "^4.0.0", "refa": "^0.12.1", "regexp-ast-analysis": "^0.7.1", "scslre": "^0.3.0" }, "engines": { "node": "^18 || >=20" }, "peerDependencies": { "eslint": ">=8.44.0" } }, "node_modules/eslint-plugin-sonarjs": { "version": "0.21.0", "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.21.0.tgz", "integrity": "sha512-oezUDfFT5S6j3rQheZ4DLPrbetPmMS7zHIKWGHr0CM3g5JgyZroz1FpIKa4jV83NsGpmgIeagpokWDKIJzRQmw==", "dev": true, "engines": { "node": ">=14" }, "peerDependencies": { "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/eslint-plugin-unicorn": { "version": "49.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-49.0.0.tgz", "integrity": "sha512-0fHEa/8Pih5cmzFW5L7xMEfUTvI9WKeQtjmKpTUmY+BiFCDxkxrTdnURJOHKykhtwIeyYsxnecbGvDCml++z4Q==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "@eslint-community/eslint-utils": "^4.4.0", "ci-info": "^3.8.0", "clean-regexp": "^1.0.0", "esquery": "^1.5.0", "indent-string": "^4.0.0", "is-builtin-module": "^3.2.1", "jsesc": "^3.0.2", "pluralize": "^8.0.0", "read-pkg-up": "^7.0.1", "regexp-tree": "^0.1.27", "regjsparser": "^0.10.0", "semver": "^7.5.4", "strip-indent": "^3.0.0" }, "engines": { "node": ">=16" }, "funding": { "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { "eslint": ">=8.52.0" } }, "node_modules/eslint-plugin-unicorn/node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-utils": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "dependencies": { "eslint-visitor-keys": "^2.0.0" }, "engines": { "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" }, "funding": { "url": "https://github.com/sponsors/mysticatea" }, "peerDependencies": { "eslint": ">=5" } }, "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/esquery": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" }, "engines": { "node": ">=0.10" } }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "dependencies": { "estraverse": "^5.2.0" }, "engines": { "node": ">=4.0" } }, "node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" } }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/execa": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.1", "human-signals": "^4.3.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", "onetime": "^6.0.0", "signal-exit": "^3.0.7", "strip-final-newline": "^3.0.0" }, "engines": { "node": "^14.18.0 || ^16.14.0 || >=18.0.0" }, "funding": { "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "node_modules/fast-glob": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.4" }, "engines": { "node": ">=8.6.0" } }, "node_modules/fast-glob/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "dependencies": { "reusify": "^1.0.4" } }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "dependencies": { "flat-cache": "^3.0.4" }, "engines": { "node": "^10.12.0 || >=12.0.0" } }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/flat-cache": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", "dev": true, "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { "node": ">=12.0.0" } }, "node_modules/flatted": { "version": "3.2.9", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "dependencies": { "is-callable": "^1.1.3" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/function.prototype.name": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "functions-have-names": "^1.2.3" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-intrinsic": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-tsconfig": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, "funding": { "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "dependencies": { "is-glob": "^4.0.3" }, "engines": { "node": ">=10.13.0" } }, "node_modules/globals": { "version": "13.23.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "dependencies": { "type-fest": "^0.20.2" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/globalthis": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, "dependencies": { "define-properties": "^1.1.3" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/has-property-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-tostringtag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "dev": true, "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "node_modules/human-signals": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", "dev": true, "engines": { "node": ">=14.18.0" } }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "engines": { "node": ">=0.8.19" } }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/internal-slot": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.2", "hasown": "^2.0.0", "side-channel": "^1.0.4" }, "engines": { "node": ">= 0.4" } }, "node_modules/is-array-buffer": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.0", "is-typed-array": "^1.1.10" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, "node_modules/is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", "dev": true, "dependencies": { "has-bigints": "^1.0.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-builtin-module": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", "dev": true, "dependencies": { "builtin-modules": "^3.3.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-core-module": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-date-object": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-docker": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, "bin": { "is-docker": "cli.js" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, "dependencies": { "is-docker": "^3.0.0" }, "bin": { "is-inside-container": "cli.js" }, "engines": { "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "engines": { "node": ">=0.12.0" } }, "node_modules/is-number-object": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", "dev": true, "dependencies": { "call-bind": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-symbol": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-typed-array": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", "dev": true, "dependencies": { "which-typed-array": "^1.1.11" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, "dependencies": { "is-docker": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-wsl/node_modules/is-docker": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, "bin": { "is-docker": "cli.js" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "node_modules/jsdoc-type-pratt-parser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", "dev": true, "engines": { "node": ">=12.0.0" } }, "node_modules/jsesc": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "dev": true, "bin": { "jsesc": "bin/jsesc" }, "engines": { "node": ">=6" } }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, "node_modules/json5": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" }, "bin": { "json5": "lib/cli.js" } }, "node_modules/jsonc-eslint-parser": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz", "integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==", "dev": true, "dependencies": { "acorn": "^8.5.0", "eslint-visitor-keys": "^3.0.0", "espree": "^9.0.0", "semver": "^7.3.5" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/ota-meshi" } }, "node_modules/jsonc-eslint-parser/node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "dependencies": { "json-buffer": "3.0.1" } }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { "p-locate": "^5.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "dev": true }, "node_modules/lodash.kebabcase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", "dev": true }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "node_modules/lodash.snakecase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", "dev": true }, "node_modules/lodash.upperfirst": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", "dev": true }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { "yallist": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" } }, "node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", "dev": true, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "node_modules/normalize-package-data/node_modules/semver": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" } }, "node_modules/npm-run-path": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", "dev": true, "dependencies": { "path-key": "^4.0.0" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/npm-run-path/node_modules/path-key": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/object-inspect": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, "engines": { "node": ">= 0.4" } }, "node_modules/object.assign": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object.fromentries": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object.groupby": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", "get-intrinsic": "^1.2.1" } }, "node_modules/object.values": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/onetime": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", "dev": true, "dependencies": { "mimic-fn": "^4.0.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/open": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", "dev": true, "dependencies": { "default-browser": "^4.0.0", "define-lazy-prop": "^3.0.0", "is-inside-container": "^1.0.0", "is-wsl": "^2.2.0" }, "engines": { "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "dependencies": { "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { "yocto-queue": "^0.1.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { "p-limit": "^3.0.2" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "dependencies": { "callsites": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "engines": { "node": ">= 0.8.0" } }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", "parse-json": "^5.0.0", "type-fest": "^0.6.0" }, "engines": { "node": ">=8" } }, "node_modules/read-pkg-up": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", "dev": true, "dependencies": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", "type-fest": "^0.8.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/read-pkg-up/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/read-pkg-up/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { "p-locate": "^4.1.0" }, "engines": { "node": ">=8" } }, "node_modules/read-pkg-up/node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "dependencies": { "p-try": "^2.0.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/read-pkg-up/node_modules/p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { "p-limit": "^2.2.0" }, "engines": { "node": ">=8" } }, "node_modules/read-pkg-up/node_modules/type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/read-pkg/node_modules/type-fest": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/recheck": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/recheck/-/recheck-4.5.0-beta.4.tgz", "integrity": "sha512-+ek9kLZ8IxCPRGF0rCTjHdZyCYLvatn0GM7wWqi5aC4iw6Q4vyOr3VgusyX9Dr/0DPHmcMr0N+KWxSVf+QH5Zg==", "dev": true, "dependencies": { "synckit": "0.8.5" }, "engines": { "node": ">=16" }, "optionalDependencies": { "recheck-jar": "4.5.0-beta.4", "recheck-linux-x64": "4.5.0-beta.4", "recheck-macos-x64": "4.5.0-beta.4", "recheck-windows-x64": "4.5.0-beta.4" } }, "node_modules/recheck-jar": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/recheck-jar/-/recheck-jar-4.5.0-beta.4.tgz", "integrity": "sha512-plfpWRnuxaihzhE0ZU+MMSwBfyg9qRKunt4/JAcWLfgreVfK1SWMmK8LrEfl6kl6GQPJT/cRrPcNyPssL/VFKw==", "dev": true, "optional": true }, "node_modules/recheck-linux-x64": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/recheck-linux-x64/-/recheck-linux-x64-4.5.0-beta.4.tgz", "integrity": "sha512-PLkeJcFynGdPTkywivI05uzhlWc8ExSY/9K/O18N0AbLCOEddR0PBvPi24vD61+fwfD+A6xYthutUn7BUJOQXw==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "linux" ] }, "node_modules/recheck-macos-x64": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/recheck-macos-x64/-/recheck-macos-x64-4.5.0-beta.4.tgz", "integrity": "sha512-nBpnplHGhmdjseHzEQe8yYj0krVkUBJLj2LjFr7Udlyk+ZPKCi/ojtJxHnipyjWRIAa4Tmk82LcEljwBBiZ5Pg==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "darwin" ] }, "node_modules/recheck-windows-x64": { "version": "4.5.0-beta.4", "resolved": "https://registry.npmjs.org/recheck-windows-x64/-/recheck-windows-x64-4.5.0-beta.4.tgz", "integrity": "sha512-RKkrfwcQ+jAuVQ1WOop4LCeh0YT1F26AaOEAbJajz2MuEq/d2SITMJKJ9PzjjYOF7V7wMdraz4ACRjwIj2QMzA==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "win32" ] }, "node_modules/refa": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/refa/-/refa-0.12.1.tgz", "integrity": "sha512-J8rn6v4DBb2nnFqkqwy6/NnTYMcgLA+sLr0iIO41qpv0n+ngb7ksag2tMRl0inb1bbO/esUwzW1vbJi7K0sI0g==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.8.0" }, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/regexp-ast-analysis": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/regexp-ast-analysis/-/regexp-ast-analysis-0.7.1.tgz", "integrity": "sha512-sZuz1dYW/ZsfG17WSAG7eS85r5a0dDsvg+7BiiYR5o6lKCAtUrEwdmRmaGF6rwVj3LcmAeYkOWKEPlbPzN3Y3A==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.8.0", "refa": "^0.12.1" }, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/regexp-tree": { "version": "0.1.27", "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", "dev": true, "bin": { "regexp-tree": "bin/regexp-tree" } }, "node_modules/regexp.prototype.flags": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "set-function-name": "^2.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regjsparser": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", "integrity": "sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==", "dev": true, "dependencies": { "jsesc": "~0.5.0" }, "bin": { "regjsparser": "bin/parser" } }, "node_modules/regjsparser/node_modules/jsesc": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", "dev": true, "bin": { "jsesc": "bin/jsesc" } }, "node_modules/requireindex": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", "dev": true, "engines": { "node": ">=0.10.5" } }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/run-applescript": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", "dev": true, "dependencies": { "execa": "^5.0.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/run-applescript/node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, "node_modules/run-applescript/node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, "engines": { "node": ">=10.17.0" } }, "node_modules/run-applescript/node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/run-applescript/node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/run-applescript/node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, "dependencies": { "path-key": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/run-applescript/node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/run-applescript/node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "dependencies": { "queue-microtask": "^1.2.2" } }, "node_modules/safe-array-concat": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, "engines": { "node": ">=0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/safe-regex-test": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.3", "is-regex": "^1.1.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/scslre": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/scslre/-/scslre-0.3.0.tgz", "integrity": "sha512-3A6sD0WYP7+QrjbfNA2FN3FsOaGGFoekCVgTyypy53gPxhbkCIjtO6YWgdrfM+n/8sI8JeXZOIxsHjMTNxQ4nQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.8.0", "refa": "^0.12.0", "regexp-ast-analysis": "^0.7.0" }, "engines": { "node": "^14.0.0 || >=16.0.0" } }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/set-function-length": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/set-function-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", "dev": true, "dependencies": { "define-data-property": "^1.0.1", "functions-have-names": "^1.2.3", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", "object-inspect": "^1.9.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "node_modules/spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", "dev": true }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "node_modules/spdx-license-ids": { "version": "3.0.16", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz", "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", "dev": true }, "node_modules/string.prototype.trim": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimend": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/strip-final-newline": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", "dev": true, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, "dependencies": { "min-indent": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { "has-flag": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/synckit": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", "dev": true, "dependencies": { "@pkgr/utils": "^2.3.1", "tslib": "^2.5.0" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/unts" } }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, "node_modules/titleize": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", "dev": true, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "dependencies": { "prelude-ls": "^1.2.1" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/typed-array-buffer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1", "is-typed-array": "^1.1.10" }, "engines": { "node": ">= 0.4" } }, "node_modules/typed-array-byte-length": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", "has-proto": "^1.0.1", "is-typed-array": "^1.1.10" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typed-array-byte-offset": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", "for-each": "^0.3.3", "has-proto": "^1.0.1", "is-typed-array": "^1.1.10" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typed-array-length": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", "is-typed-array": "^1.1.9" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "dependencies": { "punycode": "^2.1.0" } }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" }, "engines": { "node": ">= 8" } }, "node_modules/which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", "dev": true, "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", "is-number-object": "^1.0.4", "is-string": "^1.0.5", "is-symbol": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/which-typed-array": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } } } } core-js-3.33.2/tests/eslint/package.json000066400000000000000000000013771451776221300201120ustar00rootroot00000000000000{ "name": "tests/eslint", "devDependencies": { "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0", "@stylistic/eslint-plugin-js": "^0.1.2", "confusing-browser-globals": "^1.0.11", "eslint": "^8.52.0", "eslint-plugin-array-func": "^4.0.0", "eslint-plugin-es-x": "^7.2.0", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsonc": "^2.10.0", "eslint-plugin-n": "^16.2.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-qunit": "^8.0.1", "eslint-plugin-redos": "^4.5.0-beta.4", "eslint-plugin-regexp": "^2.1.1", "eslint-plugin-sonarjs": "~0.21.0", "eslint-plugin-unicorn": "^49.0.0", "globals": "^13.23.0", "jsonc-eslint-parser": "^2.4.0" } } core-js-3.33.2/tests/eslint/runner.mjs000066400000000000000000000002301451776221300176330ustar00rootroot00000000000000const dir = path.dirname(import.meta.url).slice(7); process.env.ESLINT_USE_FLAT_CONFIG = true; await $`eslint --config ${ dir }/eslint.config.js ./`; core-js-3.33.2/tests/helpers/000077500000000000000000000000001451776221300157605ustar00rootroot00000000000000core-js-3.33.2/tests/helpers/constants.js000066400000000000000000000046201451776221300203340ustar00rootroot00000000000000import defineProperty from 'core-js-pure/es/object/define-property'; export const DESCRIPTORS = !!(() => { try { return defineProperty({}, 'a', { get() { return 7; }, }).a === 7; } catch { /* empty */ } })(); export const GLOBAL = Function('return this')(); export const NATIVE = GLOBAL.NATIVE || false; export const NODE = Object.prototype.toString.call(GLOBAL.process).slice(8, -1) === 'process'; const $TYPED_ARRAYS = { Float32Array: 4, Float64Array: 8, Int8Array: 1, Int16Array: 2, Int32Array: 4, Uint8Array: 1, Uint16Array: 2, Uint32Array: 4, Uint8ClampedArray: 1, }; export const TYPED_ARRAYS = []; for (const name in $TYPED_ARRAYS) TYPED_ARRAYS.push({ name, TypedArray: GLOBAL[name], bytes: $TYPED_ARRAYS[name], $: Number, }); export const TYPED_ARRAYS_WITH_BIG_INT = [...TYPED_ARRAYS]; for (const name of ['BigInt64Array', 'BigUint64Array']) if (GLOBAL[name]) TYPED_ARRAYS_WITH_BIG_INT.push({ name, TypedArray: GLOBAL[name], bytes: 8, // eslint-disable-next-line es/no-bigint -- safe $: BigInt, }); export const LITTLE_ENDIAN = (() => { try { return new GLOBAL.Uint8Array(new GLOBAL.Uint16Array([1]).buffer)[0] === 1; } catch { return true; } })(); export const PROTO = !!Object.setPrototypeOf || '__proto__' in Object.prototype; export let REDEFINABLE_PROTO = false; try { // Chrome 27- bug, also a bug for native `JSON.parse` defineProperty({}, '__proto__', { value: 42, writable: true, configurable: true, enumerable: true }); REDEFINABLE_PROTO = true; } catch { /* empty */ } export const STRICT_THIS = (function () { return this; })(); export const STRICT = !STRICT_THIS; export const FREEZING = !function () { try { return Object.isExtensible(Object.preventExtensions({})); } catch { return true; } }(); export const CORRECT_PROTOTYPE_GETTER = !function () { try { function F() { /* empty */ } F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; } catch { return true; } }(); // FF < 23 bug export const REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR = DESCRIPTORS && !function () { try { defineProperty([], 'length', { writable: false }); } catch { return true; } }(); export const WHITESPACES = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; core-js-3.33.2/tests/helpers/helpers.js000066400000000000000000000107011451776221300177570ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import ITERATOR from 'core-js-pure/es/symbol/iterator'; import ASYNC_ITERATOR from 'core-js-pure/es/symbol/async-iterator'; export function is(a, b) { // eslint-disable-next-line no-self-compare -- NaN check return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b; } export function createIterator(elements, methods) { let index = 0; const iterator = { called: false, next() { iterator.called = true; return { value: elements[index++], done: index > elements.length, }; }, }; if (methods) for (const key in methods) iterator[key] = methods[key]; return iterator; } export function createSetLike(elements) { return { size: elements.length, has(it) { return includes(elements, it); }, keys() { return createIterator(elements); }, }; } export function createIterable(elements, methods) { const iterable = { called: false, received: false, [ITERATOR]() { iterable.received = true; let index = 0; const iterator = { next() { iterable.called = true; return { value: elements[index++], done: index > elements.length, }; }, }; if (methods) for (const key in methods) iterator[key] = methods[key]; return iterator; }, }; return iterable; } export function createAsyncIterable(elements, methods) { const iterable = { called: false, received: false, [ASYNC_ITERATOR]() { iterable.received = true; let index = 0; const iterator = { next() { iterable.called = true; return Promise.resolve({ value: elements[index++], done: index > elements.length, }); }, }; if (methods) for (const key in methods) iterator[key] = methods[key]; return iterator; }, }; return iterable; } export function createConversionChecker(value, string) { const checker = { $valueOf: 0, $toString: 0, valueOf() { checker.$valueOf++; return value; }, toString() { checker.$toString++; return arguments.length > 1 ? string : String(value); }, }; return checker; } export function arrayFromArrayLike(source) { const { length } = source; const result = Array(length); for (let index = 0; index < length; index++) { result[index] = source[index]; } return result; } export function includes(target, wanted) { for (const element of target) if (wanted === element) return true; return false; } export const nativeSubclass = (() => { try { if (Function(` 'use strict'; class Subclass extends Object { /* empty */ }; return new Subclass() instanceof Subclass; `)()) return Function('Parent', ` 'use strict'; return class extends Parent { /* empty */ }; `); } catch { /* empty */ } })(); export function timeLimitedPromise(time, functionOrPromise) { return Promise.race([ typeof functionOrPromise == 'function' ? new Promise(functionOrPromise) : functionOrPromise, new Promise((resolve, reject) => { setTimeout(reject, time); }), ]); } // This function is used to force RegExp.prototype[Symbol.*] methods // to not use the native implementation. export function patchRegExp$exec(run) { return assert => { const originalExec = RegExp.prototype.exec; // eslint-disable-next-line no-extend-native -- required for testing RegExp.prototype.exec = function (...args) { return originalExec.apply(this, args); }; try { return run(assert); // eslint-disable-next-line no-useless-catch -- in very old IE try / finally does not work without catch } catch (error) { throw error; } finally { // eslint-disable-next-line no-extend-native -- required for testing RegExp.prototype.exec = originalExec; } }; } export function fromSource(source) { try { return Function(`return ${ source }`)(); } catch { /* empty */ } } export function arrayToBuffer(array) { const { length } = array; const buffer = new ArrayBuffer(length); const view = new DataView(buffer); for (let i = 0; i < length; ++i) { view.setUint8(i, array[i]); } return buffer; } export function bufferToArray(buffer) { const array = []; const view = new DataView(buffer); for (let i = 0, { byteLength } = view; i < byteLength; ++i) { array.push(view.getUint8(i)); } return array; } core-js-3.33.2/tests/helpers/qunit-helpers.js000066400000000000000000000131261451776221300211210ustar00rootroot00000000000000import { DESCRIPTORS } from './constants.js'; import assign from 'core-js-pure/es/object/assign'; import defineProperties from 'core-js-pure/es/object/define-properties'; import isIterable from 'core-js-pure/es/is-iterable'; import ASYNC_ITERATOR from 'core-js-pure/es/symbol/async-iterator'; import { is, arrayFromArrayLike } from './helpers.js'; // for Babel template transform if (!Object.freeze) Object.freeze = Object; if (!DESCRIPTORS) Object.defineProperties = defineProperties; const { getOwnPropertyDescriptor } = Object; const { toString, propertyIsEnumerable } = Object.prototype; assign(QUnit.assert, { arity(fn, length, message) { this.same(fn.length, length, message ?? `The arity of the function is ${ length }`); }, arrayEqual(a, b, message) { this.deepEqual(arrayFromArrayLike(a), arrayFromArrayLike(b), message); }, avoid(message = 'It should never be called') { this.ok(false, message); }, enumerable(O, key, message) { const result = !DESCRIPTORS || propertyIsEnumerable.call(O, key); this.pushResult({ result, actual: result, expected: 'The property should be enumerable', message: DESCRIPTORS ? message ?? `${ typeof key == 'symbol' ? 'property' : `'${ key }'` } is enumerable` : 'Enumerability is not applicable', }); }, epsilon(a, b, EPSILON = 1e-11, message = null) { const result = Math.abs(a - b) <= EPSILON; this.pushResult({ result, actual: result, expected: `The value should be closer to the target by less than ${ EPSILON }`, message: message ?? `The value should be closer to the target by less than ${ EPSILON }`, }); }, // TODO: Drop from ~ `core-js@5` // unavailable in `qunit@1` that's required for testing in IE9- false(value, message = 'The value is `false`') { this.same(value, false, message); }, isAsyncIterable(actual, message = 'The value is async iterable') { this.pushResult({ result: typeof actual == 'object' && typeof actual[ASYNC_ITERATOR] == 'function', actual, expected: 'The value should be async iterable', message, }); }, isFunction(fn, message) { this.pushResult({ result: typeof fn == 'function' || toString.call(fn).slice(8, -1) === 'Function', actual: typeof fn, expected: 'The value should be a function', message: message ?? 'The value is a function', }); }, isIterable(actual, message = 'The value is iterable') { this.pushResult({ result: isIterable(actual), actual, expected: 'The value should be iterable', message, }); }, isIterator(actual, message = 'The object is an iterator') { this.pushResult({ result: typeof actual == 'object' && typeof actual.next == 'function', actual, expected: 'The object should be an iterator', message, }); }, looksNative(fn, message = 'The function looks like a native') { const source = Function.prototype.toString.call(fn); this.pushResult({ result: /native code/.test(source), actual: source, expected: 'The function should look like a native', message, }); }, name(fn, expected, message) { const applicable = typeof fn == 'function' && 'name' in fn; const actual = fn.name; this.pushResult({ result: applicable ? actual === expected : true, actual, expected, message: applicable ? message ?? `The function name is '${ expected }'` : 'Function#name property test makes no sense', }); }, nonConfigurable(O, key, message) { const result = !DESCRIPTORS || !getOwnPropertyDescriptor(O, key)?.configurable; this.pushResult({ result, actual: result, expected: 'The property should be non-configurable', message: DESCRIPTORS ? message ?? `${ typeof key == 'symbol' ? 'property' : `'${ key }'` } is non-configurable` : 'Configurability is not applicable', }); }, nonEnumerable(O, key, message) { const result = !DESCRIPTORS || !propertyIsEnumerable.call(O, key); this.pushResult({ result, actual: result, expected: 'The property should be non-enumerable', message: DESCRIPTORS ? message ?? `${ typeof key == 'symbol' ? 'property' : `'${ key }'` } is non-enumerable` : 'Enumerability is not applicable', }); }, nonWritable(O, key, message) { const result = !DESCRIPTORS || !getOwnPropertyDescriptor(O, key)?.writable; this.pushResult({ result, actual: result, expected: 'The property should be non-writable', message: DESCRIPTORS ? message ?? `${ typeof key == 'symbol' ? 'property' : `'${ key }'` } is non-writable` : 'Writability is not applicable', }); }, notSame(actual, expected, message) { this.pushResult({ result: !is(actual, expected), actual, expected: 'Something different', message, }); }, notThrows(fn, message = 'Does not throw') { let result = false; let actual; try { actual = fn(); result = true; } catch (error) { actual = error; } this.pushResult({ result, actual, expected: 'It should not throw an error', message, }); }, required(message = 'It should be called') { this.ok(true, message); }, same(actual, expected, message) { this.pushResult({ result: is(actual, expected), actual, expected, message, }); }, // TODO: Drop from ~ `core-js@5` // unavailable in `qunit@1` that's required for testing in IE9- true(value, message = 'The value is `true`') { this.same(value, true, message); }, }); core-js-3.33.2/tests/observables/000077500000000000000000000000001451776221300166255ustar00rootroot00000000000000core-js-3.33.2/tests/observables/adapter.mjs000066400000000000000000000010001451776221300207470ustar00rootroot00000000000000/* eslint-disable import/no-dynamic-require -- dynamic */ delete globalThis.Observable; const pkg = argv.pure ? 'core-js-pure' : 'core-js'; // eslint-disable-next-line import/no-unresolved -- generated later const { runTests } = require('./bundles/observables-tests/default'); globalThis.Symbol = require(`../../packages/${ pkg }/full/symbol`); globalThis.Promise = require(`../../packages/${ pkg }/full/promise`); const Observable = require(`../../packages/${ pkg }/full/observable`); runTests(Observable); core-js-3.33.2/tests/observables/package-lock.json000066400000000000000000001154211451776221300220450ustar00rootroot00000000000000{ "name": "tests/observables", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/observables", "devDependencies": { "@babel/cli": "^7.23.0", "es-observable": "tc39/proposal-observable#d3404f06bc70c7c578a5047dfb3dc813730e3319", "moon-unit": "0.2.2" } }, "node_modules/@ampproject/remapping": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", "dev": true, "peer": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.0", "@jridgewell/trace-mapping": "^0.3.9" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/cli": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.23.0.tgz", "integrity": "sha512-17E1oSkGk2IwNILM4jtfAvgjt+ohmpfBky8aLerUfYZhiPNg7ca+CRCxZn8QDxwNhV/upsc2VHBCqGFIR+iBfA==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.17", "commander": "^4.0.1", "convert-source-map": "^2.0.0", "fs-readdir-recursive": "^1.1.0", "glob": "^7.2.0", "make-dir": "^2.1.0", "slash": "^2.0.0" }, "bin": { "babel": "bin/babel.js", "babel-external-helpers": "bin/babel-external-helpers.js" }, "engines": { "node": ">=6.9.0" }, "optionalDependencies": { "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", "chokidar": "^3.4.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/@babel/code-frame": { "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "peer": true, "dependencies": { "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz", "integrity": "sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.2.tgz", "integrity": "sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==", "dev": true, "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.22.13", "@babel/generator": "^7.23.0", "@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-module-transforms": "^7.23.0", "@babel/helpers": "^7.23.2", "@babel/parser": "^7.23.0", "@babel/template": "^7.22.15", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/babel" } }, "node_modules/@babel/generator": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "peer": true, "dependencies": { "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", "dev": true, "peer": true, "dependencies": { "@babel/compat-data": "^7.22.9", "@babel/helper-validator-option": "^7.22.15", "browserslist": "^4.21.9", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-environment-visitor": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "peer": true, "dependencies": { "@babel/template": "^7.22.15", "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "peer": true, "dependencies": { "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", "dev": true, "peer": true, "dependencies": { "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "dev": true, "peer": true, "dependencies": { "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-module-imports": "^7.22.15", "@babel/helper-simple-access": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-validator-identifier": "^7.22.20" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-simple-access": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", "dev": true, "peer": true, "dependencies": { "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.22.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "peer": true, "dependencies": { "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.2.tgz", "integrity": "sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==", "dev": true, "peer": true, "dependencies": { "@babel/template": "^7.22.15", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "peer": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "peer": true, "bin": { "parser": "bin/babel-parser.js" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/template": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "peer": true, "dependencies": { "@babel/code-frame": "^7.22.13", "@babel/parser": "^7.22.15", "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, "peer": true, "dependencies": { "@babel/code-frame": "^7.22.13", "@babel/generator": "^7.23.0", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", "@babel/parser": "^7.23.0", "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/types": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "peer": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", "dev": true, "peer": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.9" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", "dev": true, "peer": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.20", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@nicolo-ribaudo/chokidar-2": { "version": "2.1.8-no-fsevents.3", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", "dev": true, "optional": true }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "peer": true, "dependencies": { "color-convert": "^1.9.0" }, "engines": { "node": ">=4" } }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "optional": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" }, "engines": { "node": ">= 8" } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, "optional": true, "engines": { "node": ">=8" } }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "optional": true, "dependencies": { "fill-range": "^7.0.1" }, "engines": { "node": ">=8" } }, "node_modules/browserslist": { "version": "4.22.1", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001541", "electron-to-chromium": "^1.4.535", "node-releases": "^2.0.13", "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, "node_modules/caniuse-lite": { "version": "1.0.30001558", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001558.tgz", "integrity": "sha512-/Et7DwLqpjS47JPEcz6VnxU9PwcIdVi0ciLXRWBQdj1XFye68pSQYpV0QtPTfUKWuOaEig+/Vez2l74eDc1tPQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "peer": true }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "peer": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, "engines": { "node": ">=4" } }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "funding": [ { "type": "individual", "url": "https://paulmillr.com/funding/" } ], "optional": true, "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "engines": { "node": ">= 8.10.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "peer": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true, "peer": true }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", "dev": true, "engines": { "node": ">= 6" } }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "peer": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/electron-to-chromium": { "version": "1.4.569", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.569.tgz", "integrity": "sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==", "dev": true, "peer": true }, "node_modules/es-observable": { "version": "0.3.0", "resolved": "git+ssh://git@github.com/tc39/proposal-observable.git#d3404f06bc70c7c578a5047dfb3dc813730e3319", "integrity": "sha512-9dpXmMu1Ssl24wqJGFHQUdquFwEE9P/u9UQjMLuR5XYQAzz0acEOLTMhYncVOjNcqSswFjftTe8dgAj0sqz1JA==", "dev": true }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, "peer": true, "engines": { "node": ">=6" } }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "peer": true, "engines": { "node": ">=0.8.0" } }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "optional": true, "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "optional": true, "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, "peer": true, "engines": { "node": ">=4" } }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, "peer": true, "engines": { "node": ">=4" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "optional": true, "dependencies": { "binary-extensions": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "optional": true, "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "optional": true, "engines": { "node": ">=0.12.0" } }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true, "peer": true }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true, "peer": true, "bin": { "jsesc": "bin/jsesc" }, "engines": { "node": ">=4" } }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "peer": true, "bin": { "json5": "lib/cli.js" }, "engines": { "node": ">=6" } }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "peer": true, "dependencies": { "yallist": "^3.0.2" } }, "node_modules/make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", "dev": true, "dependencies": { "pify": "^4.0.1", "semver": "^5.6.0" }, "engines": { "node": ">=6" } }, "node_modules/make-dir/node_modules/semver": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" } }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/moon-unit": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/moon-unit/-/moon-unit-0.2.2.tgz", "integrity": "sha512-MJMMeBg1u5Colum/DhhKZtw6SUQet2hg298xrm+5+ScQH+t6YNSMMcD4sQ2mA8/7hKXK7pv0p4dEgPyVB5U7UQ==", "dev": true }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true, "peer": true }, "node_modules/node-releases": { "version": "2.0.13", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true, "peer": true }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true, "peer": true }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "optional": true, "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "optional": true, "dependencies": { "picomatch": "^2.2.1" }, "engines": { "node": ">=8.10.0" } }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "peer": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "peer": true, "dependencies": { "has-flag": "^3.0.0" }, "engines": { "node": ">=4" } }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", "dev": true, "peer": true, "engines": { "node": ">=4" } }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "optional": true, "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "peer": true, "dependencies": { "escalade": "^3.1.1", "picocolors": "^1.0.0" }, "bin": { "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "peer": true } } } core-js-3.33.2/tests/observables/package.json000066400000000000000000000003161451776221300211130ustar00rootroot00000000000000{ "name": "tests/observables", "devDependencies": { "@babel/cli": "^7.23.0", "es-observable": "tc39/proposal-observable#d3404f06bc70c7c578a5047dfb3dc813730e3319", "moon-unit": "0.2.2" } } core-js-3.33.2/tests/observables/runner.mjs000066400000000000000000000003101451776221300206430ustar00rootroot00000000000000await $`babel --config-file ../../babel.config.js node_modules/es-observable/test/ -d ./bundles/observables-tests/`; for (const mode of ['global', 'pure']) { await $`zx adapter.mjs --${ mode }`; } core-js-3.33.2/tests/promises/000077500000000000000000000000001451776221300161575ustar00rootroot00000000000000core-js-3.33.2/tests/promises/adapter.js000066400000000000000000000014211451776221300201330ustar00rootroot00000000000000'use strict'; delete globalThis.Promise; const pkg = process.argv.includes('--pure') ? 'core-js-pure' : 'core-js'; // eslint-disable-next-line import/no-dynamic-require -- dynamic const Promise = require(`../../packages/${ pkg }/es/promise`); const assert = require('node:assert'); module.exports = { deferred() { const deferred = {}; deferred.promise = new Promise((resolve, reject) => { deferred.resolve = resolve; deferred.reject = reject; }); return deferred; }, resolved(value) { return Promise.resolve(value); }, rejected(reason) { return Promise.reject(reason); }, defineGlobalPromise() { globalThis.Promise = Promise; globalThis.assert = assert; }, removeGlobalPromise() { delete globalThis.Promise; }, }; core-js-3.33.2/tests/promises/package-lock.json000066400000000000000000000455301451776221300214020ustar00rootroot00000000000000{ "name": "tests/promises", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/promises", "devDependencies": { "promises-aplus-tests": "^2.1.2", "promises-es6-tests": "~0.5.0" } }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/call-bind": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "get-intrinsic": "^1.2.1", "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/commander": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", "integrity": "sha512-CD452fnk0jQyk3NfnK+KkR/hUPoHt5pVaKHogtyyv3N0U4QfAal9W0/rXLOg/vVZgQKa7jdtXypKs1YAip11uQ==", "dev": true, "engines": { "node": ">= 0.6.x" } }, "node_modules/debug": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", "integrity": "sha512-X0rGvJcskG1c3TgSCPqHJ0XJgwlcvOC7elJ5Y0hYuKBZoVqWpAMfLOeIh2UI/DCQ5ruodIjvsugZtjUYUw2pUw==", "dev": true, "dependencies": { "ms": "0.7.1" } }, "node_modules/define-data-property": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/diff": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz", "integrity": "sha512-VzVc42hMZbYU9Sx/ltb7KYuQ6pqAw+cbFWVy4XKdkuEL2CFaRLGEnISPs7YdzaUGpi+CpIqvRmu7hPQ4T7EQ5w==", "dev": true, "engines": { "node": ">=0.3.1" } }, "node_modules/escape-string-regexp": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", "integrity": "sha512-cQpUid7bdTUnFin8S7BnNdOk+/eDqQmKgCANSyd/jAhrKEvxUvr9VQ8XZzXiOtest8NLfk3FSBZzwvemZNQ6Vg==", "dev": true, "engines": { "node": ">=0.8.0" } }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "dependencies": { "is-callable": "^1.1.3" } }, "node_modules/formatio": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", "integrity": "sha512-cPh7is6k3d8tIUh+pnXXuAbD/uhSXGgqLPw0UrYpv5lfdJ+MMMSjx40JNpqP7Top9Nt25YomWEiRmkHbOvkCaA==", "deprecated": "This package is unmaintained. Use @sinonjs/formatio instead", "dev": true, "dependencies": { "samsam": "~1.1" } }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-intrinsic": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", "integrity": "sha512-hVb0zwEZwC1FXSKRPFTeOtN7AArJcJlI6ULGLtrstaswKNlrTJqAA+1lYlSUop4vjA423xlBzqfVS3iWGlqJ+g==", "dev": true, "dependencies": { "inherits": "2", "minimatch": "0.3" }, "engines": { "node": "*" } }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/growl": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", "integrity": "sha512-RTBwDHhNuOx4F0hqzItc/siXCasGfC4DeWcBamclWd+6jWtBaeB/SGbMkGf0eiQoW7ib8JpvOgnUsmgMHI3Mfw==", "dev": true }, "node_modules/has-property-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-tostringtag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "dev": true, "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-generator-function": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-typed-array": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", "dev": true, "dependencies": { "which-typed-array": "^1.1.11" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/jade": { "version": "0.26.3", "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", "integrity": "sha512-mkk3vzUHFjzKjpCXeu+IjXeZD+QOTjUUdubgmHtHTDwvAO2ZTkMTTVrapts5CWz3JvJryh/4KWZpjeZrCepZ3A==", "deprecated": "Jade has been renamed to pug, please install the latest version of pug instead of jade", "dev": true, "dependencies": { "commander": "0.6.1", "mkdirp": "0.3.0" }, "bin": { "jade": "bin/jade" } }, "node_modules/jade/node_modules/commander": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", "integrity": "sha512-0fLycpl1UMTGX257hRsu/arL/cUbcvQM4zMKwvLvzXtfdezIV4yotPS2dYtknF+NmEfWSoCEF6+hj9XLm/6hEw==", "dev": true, "engines": { "node": ">= 0.4.x" } }, "node_modules/jade/node_modules/mkdirp": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", "integrity": "sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==", "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", "dev": true, "engines": { "node": "*" } }, "node_modules/lolex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", "integrity": "sha512-YYp8cqz7/8eruZ15L1mzcPkvLYxipfdsWIDESvNdNmQP9o7TsDitRhNuV2xb7aFu2ofZngao1jiVrVZ842x4BQ==", "dev": true }, "node_modules/lru-cache": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", "integrity": "sha512-WpibWJ60c3AgAz8a2iYErDrcT2C7OmKnsWhIcHOjkUHFjkXncJhtLxNSqUmxRxRunpb5I8Vprd7aNSd2NtksJQ==", "dev": true }, "node_modules/minimatch": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", "integrity": "sha512-WFX1jI1AaxNTZVOHLBVazwTWKaQjoykSzCBNXB72vDTCzopQGtyP91tKdFK5cv1+qMwPyiTu1HqUriqplI8pcA==", "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", "dev": true, "dependencies": { "lru-cache": "2", "sigmund": "~1.0.0" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", "dev": true }, "node_modules/mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", "dev": true, "dependencies": { "minimist": "0.0.8" }, "bin": { "mkdirp": "bin/cmd.js" } }, "node_modules/mocha": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/mocha/-/mocha-2.5.3.tgz", "integrity": "sha512-jNt2iEk9FPmZLzL+sm4FNyOIDYXf2wUU6L4Cc8OIKK/kzgMHKPi4YhTZqG4bW4kQVdIv6wutDybRhXfdnujA1Q==", "dev": true, "dependencies": { "commander": "2.3.0", "debug": "2.2.0", "diff": "1.4.0", "escape-string-regexp": "1.0.2", "glob": "3.2.11", "growl": "1.9.2", "jade": "0.26.3", "mkdirp": "0.5.1", "supports-color": "1.2.0", "to-iso-string": "0.0.2" }, "bin": { "_mocha": "bin/_mocha", "mocha": "bin/mocha" }, "engines": { "node": ">= 0.8.x" } }, "node_modules/ms": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", "integrity": "sha512-lRLiIR9fSNpnP6TC4v8+4OU7oStC01esuNowdQ34L+Gk8e5Puoc88IqJ+XAY/B3Mn2ZKis8l8HX90oU8ivzUHg==", "dev": true }, "node_modules/promises-aplus-tests": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/promises-aplus-tests/-/promises-aplus-tests-2.1.2.tgz", "integrity": "sha512-XiDfjQqx+rHLof8CU9xPOMLsjiXXxr3fkjE7WJjUzXttffB8K/nsnNsPTcwS4VvHliSjGVsYVqIjFeTHw53f5w==", "dev": true, "dependencies": { "mocha": "^2.5.3", "sinon": "^1.10.3", "underscore": "~1.8.3" }, "bin": { "promises-aplus-tests": "lib/cli.js" } }, "node_modules/promises-es6-tests": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/promises-es6-tests/-/promises-es6-tests-0.5.0.tgz", "integrity": "sha512-pIv6ssXSnKGoWHf0AnLF9RiPzvbEGGPyYsxWfER/dJ98HI5DdChujb1t64ULgDyqL9g4xv6/fn1erJ0KAynwng==", "dev": true, "bin": { "promises-es6-tests": "lib/cli.js" } }, "node_modules/samsam": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", "integrity": "sha512-iVL7LibpM3tl4rQPweOXXrmjGegxx27flTOjQEZD3PXe4oZNFzuz6Si4mgleK/JWU/hyCvtV01RUovjvBEpDmw==", "deprecated": "This package has been deprecated in favour of @sinonjs/samsam", "dev": true }, "node_modules/set-function-length": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==", "dev": true }, "node_modules/sinon": { "version": "1.17.7", "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", "integrity": "sha512-M9rtyQxKfcTTdB64rpPSRaTzOvunb+HHPv/3PxvNPrEDnFSny95Pi6/3VoD471ody0ay0IHyzT3BErfcLXj6NA==", "deprecated": "16.1.1", "dev": true, "dependencies": { "formatio": "1.1.1", "lolex": "1.3.2", "samsam": "1.1.2", "util": ">=0.10.3 <1" }, "engines": { "node": ">=0.1.103" } }, "node_modules/supports-color": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.2.0.tgz", "integrity": "sha512-mS5xsnjTh5b7f2DM6bch6lR582UCOTphzINlZnDsfpIRrwI6r58rb6YSSGsdexkm8qw2bBVO2ID2fnJOTuLiPA==", "dev": true, "bin": { "supports-color": "cli.js" }, "engines": { "node": ">=0.10.0" } }, "node_modules/to-iso-string": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/to-iso-string/-/to-iso-string-0.0.2.tgz", "integrity": "sha512-oeHLgfWA7d0CPQa6h0+i5DAJZISz5un0d5SHPkw+Untclcvzv9T+AC3CvGXlZJdOlIbxbTfyyzlqCXc5hjpXYg==", "deprecated": "to-iso-string has been deprecated, use @segment/to-iso-string instead.", "dev": true }, "node_modules/underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha512-5WsVTFcH1ut/kkhAaHf4PVgI8c7++GiVcpCGxPouI6ZVjsqPnSDf8h/8HtVqc0t4fzRXwnMK70EcZeAs3PIddg==", "dev": true }, "node_modules/util": { "version": "0.12.5", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", "dev": true, "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", "which-typed-array": "^1.1.2" } }, "node_modules/which-typed-array": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } } } } core-js-3.33.2/tests/promises/package.json000066400000000000000000000002041451776221300204410ustar00rootroot00000000000000{ "name": "tests/promises", "devDependencies": { "promises-aplus-tests": "^2.1.2", "promises-es6-tests": "~0.5.0" } } core-js-3.33.2/tests/promises/runner.mjs000066400000000000000000000002361451776221300202040ustar00rootroot00000000000000for (const mode of ['global', 'pure']) for (const set of ['aplus', 'es6']) { await $`promises-${ set }-tests adapter --timeout 1000 --color --${ mode }`; } core-js-3.33.2/tests/publint/000077500000000000000000000000001451776221300157735ustar00rootroot00000000000000core-js-3.33.2/tests/publint/package-lock.json000066400000000000000000000152121451776221300212100ustar00rootroot00000000000000{ "name": "tests/publint", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/publint", "devDependencies": { "publint": "^0.2.5" } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/ignore-walk": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-5.0.1.tgz", "integrity": "sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw==", "dev": true, "dependencies": { "minimatch": "^5.0.1" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { "node": ">=10" } }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/npm-bundled": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-2.0.1.tgz", "integrity": "sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw==", "dev": true, "dependencies": { "npm-normalize-package-bin": "^2.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/npm-normalize-package-bin": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-2.0.0.tgz", "integrity": "sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ==", "dev": true, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/npm-packlist": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-5.1.3.tgz", "integrity": "sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg==", "dev": true, "dependencies": { "glob": "^8.0.1", "ignore-walk": "^5.0.1", "npm-bundled": "^2.0.0", "npm-normalize-package-bin": "^2.0.0" }, "bin": { "npm-packlist": "bin/index.js" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "node_modules/publint": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/publint/-/publint-0.2.5.tgz", "integrity": "sha512-eoQiP0WXkxkpth1fMLoS1I/6BQoxKNZxTAAnFjPgURFrJulC5D5Uifk49a9kfNCYmcza9E/ZkbFhQQdjkmKAbg==", "dev": true, "dependencies": { "npm-packlist": "^5.1.3", "picocolors": "^1.0.0", "sade": "^1.8.1" }, "bin": { "publint": "lib/cli.js" }, "engines": { "node": ">=16" }, "funding": { "url": "https://bjornlu.com/sponsor" } }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", "dev": true, "dependencies": { "mri": "^1.1.0" }, "engines": { "node": ">=6" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true } } } core-js-3.33.2/tests/publint/package.json000066400000000000000000000001221451776221300202540ustar00rootroot00000000000000{ "name": "tests/publint", "devDependencies": { "publint": "^0.2.5" } } core-js-3.33.2/tests/publint/runner.mjs000066400000000000000000000001561451776221300200210ustar00rootroot00000000000000const pkgs = await fs.readdir('packages'); await Promise.all(pkgs.map(pkg => $`publint packages/${ pkg }`)); core-js-3.33.2/tests/test262/000077500000000000000000000000001451776221300155275ustar00rootroot00000000000000core-js-3.33.2/tests/test262/package-lock.json000066400000000000000000001267651451776221300207640ustar00rootroot00000000000000{ "name": "test262", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "test262", "devDependencies": { "test262": "tc39/test262#2ac0d3c47b1e5cdf4319eec13cc53043f8427a97", "test262-harness": "^10.0.0" } }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" } }, "node_modules/after": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", "integrity": "sha512-QbJ0NTQ/I9DI3uSJA4cbexiwQeRAfjPScqIbSjUDd9TOrcg6pTkdgziesOqxBMBzit8vFCTwrP27t13vFOORRA==", "dev": true }, "node_modules/ansi-regex": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "dependencies": { "color-convert": "^1.9.0" }, "engines": { "node": ">=4" } }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } }, "node_modules/arraybuffer.slice": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", "dev": true }, "node_modules/ast-types": { "version": "0.12.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.12.4.tgz", "integrity": "sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", "integrity": "sha512-zj6Z6M7Eq+PBZ7PQxl5NT665MvJdAkzp0f60nAJ+sLaSCBPMwVak5ZegFbgVCzFcCJTKFoMizvM5Ld7+JrRJHA==", "dev": true }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/base64-arraybuffer": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", "integrity": "sha512-a1eIFi4R9ySrbiMuyTGx5e92uRH5tQY6kArNcFaKBUleIoLjdjBg7Zxm3Mqm3Kmkf27HLR/1fnxX9q8GQ7Iavg==", "dev": true, "engines": { "node": ">= 0.6.0" } }, "node_modules/base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", "dev": true, "engines": { "node": "^4.5.0 || >= 5.9" } }, "node_modules/blob": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==", "dev": true }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "dependencies": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", "wrap-ansi": "^5.1.0" } }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/component-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", "integrity": "sha512-WZveuKPeKAG9qY+FkYDeADzdHyTYdIboXS59ixDeRJL5ZhxpqUnxSOwop4FQjMsiYm3/Or8cegVbpAHNA7pHxw==", "dev": true }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, "node_modules/component-inherit": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", "integrity": "sha512-w+LhYREhatpVqTESyGFg3NlP6Iu0kEKUHETY9GoZP/pQyW4mHFZuFWRUCIqVPZ36ueVLtoOEZaAqbCF2RDndaA==", "dev": true }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/cookie": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, "node_modules/debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "node_modules/engine.io": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.6.1.tgz", "integrity": "sha512-dfs8EVg/i7QjFsXxn7cCRQ+Wai1G1TlEvHhdYEi80fxn5R1vZ2K661O6v/rezj1FP234SZ14r9CmJke99iYDGg==", "dev": true, "dependencies": { "accepts": "~1.3.4", "base64id": "2.0.0", "cookie": "~0.4.1", "debug": "~4.1.0", "engine.io-parser": "~2.2.0", "ws": "~7.4.2" }, "engines": { "node": ">=8.0.0" } }, "node_modules/engine.io-client": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.3.tgz", "integrity": "sha512-qsgyc/CEhJ6cgMUwxRRtOndGVhIu5hpL5tR4umSpmX/MvkFoIxUTM7oFMDQumHNzlNLwSVy6qhstFPoWTf7dOw==", "dev": true, "dependencies": { "component-emitter": "~1.3.0", "component-inherit": "0.0.3", "debug": "~3.1.0", "engine.io-parser": "~2.2.0", "has-cors": "1.1.0", "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", "ws": "~7.4.2", "xmlhttprequest-ssl": "~1.6.2", "yeast": "0.1.2" } }, "node_modules/engine.io-client/node_modules/debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "dependencies": { "ms": "2.0.0" } }, "node_modules/engine.io-client/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, "node_modules/engine.io-client/node_modules/ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true, "engines": { "node": ">=8.3.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/engine.io-parser": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", "integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==", "dev": true, "dependencies": { "after": "0.8.2", "arraybuffer.slice": "~0.0.7", "base64-arraybuffer": "0.1.4", "blob": "0.0.5", "has-binary2": "~1.0.2" } }, "node_modules/engine.io/node_modules/ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true, "engines": { "node": ">=8.3.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/error-stack-parser": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-1.3.6.tgz", "integrity": "sha512-xhuSYd8wLgOXwNgjcPeXMPL/IiiA1Huck+OPvClpJViVNNlJVtM41o+1emp7bPvlCJwCatFX2DWc05/DgfbWzA==", "dev": true, "dependencies": { "stackframe": "^0.3.1" } }, "node_modules/eshost": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/eshost/-/eshost-9.0.0.tgz", "integrity": "sha512-hq1phapnwdDoBO/o5PhcGoex9ueAY2xlQEcvA0zq/u4J+yUypFnBEh1gZABLlmdM1ZmOBDbjawUb/ICDdvyJVw==", "dev": true, "dependencies": { "error-stack-parser": "^1.3.3", "is-symlink": "^0.1.1", "recast": "^0.17.5", "selenium-webdriver": "^4.0.0-alpha.1", "server-destroy": "^1.0.1", "socket.io": "^2.3.0", "unique-temp-dir": "^1.0.0" } }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" }, "engines": { "node": ">=4" } }, "node_modules/find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "dependencies": { "locate-path": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "node_modules/has-binary2": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", "dev": true, "dependencies": { "isarray": "2.0.1" } }, "node_modules/has-binary2/node_modules/isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", "integrity": "sha512-c2cu3UxbI+b6kR3fy0nRnAhodsvR9dx7U5+znCOzdj6IfP3upFURTr0Xl5BlQZNKZjEtxrmVyfSdeE3O57smoQ==", "dev": true }, "node_modules/has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", "integrity": "sha512-g5VNKdkFuUuVCP9gYfDJHjK2nqdQJ7aDLTnycnc2+RvsOQbuLdF5pm7vuE5J76SEBIQjs4kQY/BWq74JUmjbXA==", "dev": true }, "node_modules/immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", "dev": true }, "node_modules/indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", "integrity": "sha512-i0G7hLJ1z0DE8dsqJa2rycj9dBmNKgXBvotXtZYXakU9oivfB9Uj2ZBC27qqef2U58/ZLwalxa1X/RDCdkHtVg==", "dev": true }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/is-symlink": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-symlink/-/is-symlink-0.1.1.tgz", "integrity": "sha512-HAC7xFRN4t4mVutcQfWzwAFNlD8tQFUSVwOeBLbTtgUf+Lb74AfhMT54ZcsYZ1vB5T08BLJH2z8y8im5lLcCMg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "node_modules/jszip": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", "dev": true, "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", "setimmediate": "^1.0.5" } }, "node_modules/klaw": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.1.1.tgz", "integrity": "sha512-kuInGWCNc98b1ghOqBJfqPOvAKn9HHgm+SdluR5VNfdA7rs7uNsuXGy7CCqsP6pFKPpUoCH4s9o00GEj9xONHg==", "dev": true, "dependencies": { "graceful-fs": "^4.1.9" } }, "node_modules/lie": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", "dev": true, "dependencies": { "immediate": "~3.0.5" } }, "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "dependencies": { "p-try": "^2.0.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "dependencies": { "p-limit": "^2.0.0" }, "engines": { "node": ">=6" } }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "dev": true }, "node_modules/parseqs": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==", "dev": true }, "node_modules/parseuri": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==", "dev": true }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "node_modules/recast": { "version": "0.17.6", "resolved": "https://registry.npmjs.org/recast/-/recast-0.17.6.tgz", "integrity": "sha512-yoQRMRrK1lszNtbkGyM4kN45AwylV5hMiuEveUBlxytUViWevjvX6w+tzJt1LH4cfUhWt4NZvy3ThIhu6+m5wQ==", "dev": true, "dependencies": { "ast-types": "0.12.4", "esprima": "~4.0.0", "private": "^0.1.8", "source-map": "~0.6.1" }, "engines": { "node": ">= 4" } }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, "dependencies": { "tslib": "^1.9.0" }, "engines": { "npm": ">=2.0.0" } }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "node_modules/selenium-webdriver": { "version": "4.9.2", "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.9.2.tgz", "integrity": "sha512-0gDswAgVn6qbCYckZetQQvQK9tWW1r7LaumhiqY1/Wl/7JEWG0JANsTbZKnmGc3+cUU76zAi5/p0P8LUweXlig==", "dev": true, "dependencies": { "jszip": "^3.10.1", "tmp": "^0.2.1", "ws": ">=8.13.0" }, "engines": { "node": ">= 14.20.0" } }, "node_modules/server-destroy": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz", "integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==", "dev": true }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "dev": true }, "node_modules/socket.io": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.5.0.tgz", "integrity": "sha512-gGunfS0od3VpwDBpGwVkzSZx6Aqo9uOcf1afJj2cKnKFAoyl16fvhpsUhmUFd4Ldbvl5JvRQed6eQw6oQp6n8w==", "dev": true, "dependencies": { "debug": "~4.1.0", "engine.io": "~3.6.0", "has-binary2": "~1.0.2", "socket.io-adapter": "~1.1.0", "socket.io-client": "2.5.0", "socket.io-parser": "~3.4.0" } }, "node_modules/socket.io-adapter": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==", "dev": true }, "node_modules/socket.io-client": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.5.0.tgz", "integrity": "sha512-lOO9clmdgssDykiOmVQQitwBAF3I6mYcQAo7hQ7AM6Ny5X7fp8hIJ3HcQs3Rjz4SoggoxA1OgrQyY8EgTbcPYw==", "dev": true, "dependencies": { "backo2": "1.0.2", "component-bind": "1.0.0", "component-emitter": "~1.3.0", "debug": "~3.1.0", "engine.io-client": "~3.5.0", "has-binary2": "~1.0.2", "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", "socket.io-parser": "~3.3.0", "to-array": "0.1.4" } }, "node_modules/socket.io-client/node_modules/debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "dependencies": { "ms": "2.0.0" } }, "node_modules/socket.io-client/node_modules/isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", "integrity": "sha512-c2cu3UxbI+b6kR3fy0nRnAhodsvR9dx7U5+znCOzdj6IfP3upFURTr0Xl5BlQZNKZjEtxrmVyfSdeE3O57smoQ==", "dev": true }, "node_modules/socket.io-client/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, "node_modules/socket.io-client/node_modules/socket.io-parser": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.3.tgz", "integrity": "sha512-qOg87q1PMWWTeO01768Yh9ogn7chB9zkKtQnya41Y355S0UmpXgpcrFwAgjYJxu9BdKug5r5e9YtVSeWhKBUZg==", "dev": true, "dependencies": { "component-emitter": "~1.3.0", "debug": "~3.1.0", "isarray": "2.0.1" } }, "node_modules/socket.io-parser": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.3.tgz", "integrity": "sha512-1rE4dZN3kCI/E5wixd393hmbqa78vVpkKmnEJhLeWoS/C5hbFYAbcSfnWoaVH43u9ToUVtzKjguxEZq+1XZfCQ==", "dev": true, "dependencies": { "component-emitter": "1.2.1", "debug": "~4.1.0", "isarray": "2.0.1" }, "engines": { "node": ">=10.0.0" } }, "node_modules/socket.io-parser/node_modules/component-emitter": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", "integrity": "sha512-jPatnhd33viNplKjqXKRkGU345p263OIWzDL2wH3LGIGp5Kojo+uXizHmOADRvhGFFTnJqX3jBAKP6vvmSDKcA==", "dev": true }, "node_modules/socket.io-parser/node_modules/isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", "integrity": "sha512-c2cu3UxbI+b6kR3fy0nRnAhodsvR9dx7U5+znCOzdj6IfP3upFURTr0Xl5BlQZNKZjEtxrmVyfSdeE3O57smoQ==", "dev": true }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, "node_modules/stackframe": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-0.3.1.tgz", "integrity": "sha512-XmoiF4T5nuWEp2x2w92WdGjdHGY/cZa6LIbRsDRQR/Xlk4uW0PAUlH1zJYVffocwKpCdwyuypIp25xsSXEtZHw==", "dev": true }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" }, "engines": { "node": ">=6" } }, "node_modules/strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, "engines": { "node": ">=6" } }, "node_modules/test262": { "version": "5.0.0", "resolved": "git+ssh://git@github.com/tc39/test262.git#2ac0d3c47b1e5cdf4319eec13cc53043f8427a97", "integrity": "sha512-OaCUnU3GeM3mitlys+yuJ5VziSP8EsF6v7RuxqPzjTYVtgutVB84W1rO7oQfPSIfFc11u98mq/8hgAOAylNJbw==", "dev": true, "license": "BSD" }, "node_modules/test262-harness": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/test262-harness/-/test262-harness-10.0.0.tgz", "integrity": "sha512-ntNOi+q6NMXYNAa7nwg7IgP+8ahcdqvPvkEUu6TN38nkTHIBjB/KY5jLIUD70Qk4EKd15rHHfSGDc1SVdblj4w==", "dev": true, "dependencies": { "eshost": "^9.0.0", "minimatch": "^3.0.4", "rxjs": "^6.4.0", "test262-stream": "^1.3.0", "yargs": "^13.2.2" }, "bin": { "test262-harness": "bin/run.js" } }, "node_modules/test262-stream": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/test262-stream/-/test262-stream-1.4.0.tgz", "integrity": "sha512-s364askxqgyWAtIwvYCG5nYT3P32g9ByEt1ML49ubFlPE52GA6fG5ZZGmf4y/YJgKtppRAZZ7YVd9NOsk1oUxA==", "dev": true, "dependencies": { "js-yaml": "^3.2.1", "klaw": "^2.1.0" } }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", "dev": true, "dependencies": { "rimraf": "^3.0.0" }, "engines": { "node": ">=8.17.0" } }, "node_modules/to-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", "integrity": "sha512-LhVdShQD/4Mk4zXNroIQZJC+Ap3zgLcDuwEdcmLv9CCO73NWockQDwyUnW/m8VX/EElfL6FcYx7EeutN4HJA6A==", "dev": true }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "node_modules/uid2": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", "integrity": "sha512-5gSP1liv10Gjp8cMEnFd6shzkL/D6W1uhXSFNCxDC+YI8+L8wkCYCbJ7n77Ezb4wE/xzMogecE+DtamEe9PZjg==", "dev": true }, "node_modules/unique-temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-temp-dir/-/unique-temp-dir-1.0.0.tgz", "integrity": "sha512-tE68ki2FndoVdPioyiz8mYaJeX3xU/9lk4dml7KlLKEkWLtDGAYeg5LGjE2dMkzB8d6R3HbcKTn/I14nukP2dw==", "dev": true, "dependencies": { "mkdirp": "^0.5.1", "os-tmpdir": "^1.0.1", "uid2": "0.0.3" }, "engines": { "node": ">=0.10.0" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, "node_modules/which-module": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", "dev": true }, "node_modules/wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "dependencies": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", "strip-ansi": "^5.0.0" }, "engines": { "node": ">=6" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/ws": { "version": "8.13.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "dev": true, "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/xmlhttprequest-ssl": { "version": "1.6.3", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz", "integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==", "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "node_modules/yargs": { "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "dependencies": { "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^13.1.2" } }, "node_modules/yargs-parser": { "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "node_modules/yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", "integrity": "sha512-8HFIh676uyGYP6wP13R/j6OJ/1HwJ46snpvzE7aHAN3Ryqh2yX6Xox2B4CUmTwwOIzlG3Bs7ocsP5dZH/R1Qbg==", "dev": true } } } core-js-3.33.2/tests/test262/package.json000066400000000000000000000002351451776221300200150ustar00rootroot00000000000000{ "name": "test262", "devDependencies": { "test262": "tc39/test262#2ac0d3c47b1e5cdf4319eec13cc53043f8427a97", "test262-harness": "^10.0.0" } } core-js-3.33.2/tests/test262/preprocessor.js000066400000000000000000000027351451776221300206220ustar00rootroot00000000000000'use strict'; const include = [ 'Array', // 'ArrayBuffer', 'ArrayIteratorPrototype', 'Boolean', // 'DataView', // 'Date', 'Error', 'Function/prototype', 'IteratorPrototype', 'JSON', 'Map', 'MapIteratorPrototype', 'Math', 'Number', 'Object', 'Promise', 'Reflect', 'RegExp', 'RegExpStringIteratorPrototype', 'Set', 'SetIteratorPrototype', 'String', 'StringIteratorPrototype', 'Symbol', // 'TypedArray', // 'TypedArrayConstructors', 'WeakMap', 'WeakSet', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'unescape', ]; const exclude = [ '/ArrayBuffer/prototype/resize/', '/ArrayBuffer/prototype/resizable/', '/ArrayBuffer/prototype/transfer/', '/Function/prototype/toString/', '/Object/internals/DefineOwnProperty/', // conflict with iterators helpers proposal '/Object/prototype/toString/symbol-tag-non-str-builtin', '/RegExp/property-escapes/', 'resizable-buffer', 'resize-arraybuffer', 'detached-buffer', 'detach-typedarray', // we can't implement this behavior on methods 100% proper and compatible with ES3 // in case of application some hacks this line will be removed 'not-a-constructor', ]; module.exports = test => { const { file } = test; if (!include.some(namespace => file.includes(`built-ins/${ namespace }/`))) return null; if (exclude.some(it => file.includes(it))) return null; return test; }; core-js-3.33.2/tests/test262/runner.mjs000066400000000000000000000004361451776221300175560ustar00rootroot00000000000000await $`test262-harness \ --threads=${ os.cpus().length } \ --host-args="--unhandled-rejections=none" \ --preprocessor=preprocessor.js \ --prelude=../../packages/core-js-bundle/index.js \ --test262-dir=node_modules/test262 \ node_modules/test262/test/built-ins/**/*.js \ `; core-js-3.33.2/tests/type-definitions/000077500000000000000000000000001451776221300176105ustar00rootroot00000000000000core-js-3.33.2/tests/type-definitions/builder.ts000066400000000000000000000045151451776221300216130ustar00rootroot00000000000000import builder from 'core-js-builder'; const a: Promise = builder({ targets: { node: 17 } }); const b: string = await builder({ targets: { node: 17 } }); await builder(); await builder({}); await builder({ modules: 'core-js/actual' }); await builder({ modules: 'es.array.push' }); await builder({ modules: /^es\.array\./ }); await builder({ modules: ['core-js/actual', /^es\.array\./] }); await builder({ exclude: 'core-js/actual' }); await builder({ exclude: 'es.array.push' }); await builder({ exclude: /^es\.array\./ }); await builder({ exclude: ['core-js/actual', /^es\.array\./] }); await builder({ modules: 'core-js/actual', exclude: /^es\.array\./ }); await builder({ targets: '> 1%' }); await builder({ targets: ['defaults', 'last 5 versions'] }); await builder({ targets: { esmodules: true, node: 'current', browsers: ['> 1%'] } }); await builder({ targets: { chrome: '26', firefox: 4 } }); await builder({ targets: { browsers: { chrome: '26', firefox: 4 } } }); await builder({ targets: { chrome: '26', firefox: 4, esmodules: true, node: 'current', browsers: ['> 1%'] } }); await builder({ format: 'bundle' }); await builder({ format: 'esm' }); await builder({ format: 'cjs' }); await builder({ filename: '/foo/bar/baz.js' }); await builder({ summary: { comment: true } }); await builder({ summary: { comment: { size: true } } }); await builder({ summary: { comment: { size: false, modules: true } } }); await builder({ summary: { console: true } }); await builder({ summary: { console: { size: true } } }); await builder({ summary: { console: { size: false, modules: true } } }); await builder({ summary: { console: { size: false, modules: true }, comment: { size: false, modules: true } } }); await builder({ modules: 'core-js/actual', exclude: /^es\.array\./, targets: { android: 1, bun: '1', chrome: 1, 'chrome-android': '1', deno: 1, edge: '1', electron: 1, firefox: '1', 'firefox-android': 1, hermes: '1', ie: 1, ios: '1', opera: 1, 'opera-android': '1', phantom: 1, quest: '1', 'react-native': 1, rhino: '1', safari: 1, samsung: '1', node: 'current', esmodules: true, browsers: ['> 1%'], }, format: 'bundle', filename: '/foo/bar/baz.js', summary: { console: { size: false, modules: true }, comment: { size: false, modules: true }, }, }); core-js-3.33.2/tests/type-definitions/compat.ts000066400000000000000000000062731451776221300214530ustar00rootroot00000000000000import compat from 'core-js-compat'; import compat2 from 'core-js-compat/compat'; import getModulesListForTargetVersion from 'core-js-compat/get-modules-list-for-target-version'; getModulesListForTargetVersion('3.0'); compat.getModulesListForTargetVersion('3.0'); compat.data['es.array.push'].android compat.data['es.array.push'].firefox if (typeof compat.modules[0] !== 'string') { console.error('Invalid'); } if (!compat.entries['core-js'].includes('es.array.from')) { console.error('Invalid') } compat(); compat({}); compat({ modules: 'core-js/actual' }); compat({ modules: 'es.array.push' }); compat({ modules: /^es\.array\./ }); compat({ modules: ['core-js/actual', /^es\.array\./] }); compat({ exclude: 'core-js/actual' }); compat({ exclude: 'es.array.push' }); compat({ exclude: /^es\.array\./ }); compat({ exclude: ['core-js/actual', /^es\.array\./] }); compat({ modules: 'core-js/actual', exclude: /^es\.array\./ }); compat({ targets: '> 1%' }); compat({ targets: ['defaults', 'last 5 versions'] }); compat({ targets: { esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat({ targets: { chrome: '26', firefox: 4 } }); compat({ targets: { browsers: { chrome: '26', firefox: 4 } } }); compat({ targets: { chrome: '26', firefox: 4, esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat({ version: '3.0' }); compat({ inverse: true }); compat.compat(); compat.compat({}); compat.compat({ modules: 'core-js/actual' }); compat.compat({ modules: 'es.array.push' }); compat.compat({ modules: /^es\.array\./ }); compat.compat({ modules: ['core-js/actual', /^es\.array\./] }); compat.compat({ exclude: 'core-js/actual' }); compat.compat({ exclude: 'es.array.push' }); compat.compat({ exclude: /^es\.array\./ }); compat.compat({ exclude: ['core-js/actual', /^es\.array\./] }); compat.compat({ modules: 'core-js/actual', exclude: /^es\.array\./ }); compat.compat({ targets: '> 1%' }); compat.compat({ targets: ['defaults', 'last 5 versions'] }); compat.compat({ targets: { esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat.compat({ targets: { chrome: '26', firefox: 4 } }); compat.compat({ targets: { browsers: { chrome: '26', firefox: 4 } } }); compat.compat({ targets: { chrome: '26', firefox: 4, esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat.compat({ version: '3.0' }); compat.compat({ inverse: true }); compat2(); compat2({}); compat2({ modules: 'core-js/actual' }); compat2({ modules: 'es.array.push' }); compat2({ modules: /^es\.array\./ }); compat2({ modules: ['core-js/actual', /^es\.array\./] }); compat2({ exclude: 'core-js/actual' }); compat2({ exclude: 'es.array.push' }); compat2({ exclude: /^es\.array\./ }); compat2({ exclude: ['core-js/actual', /^es\.array\./] }); compat2({ modules: 'core-js/actual', exclude: /^es\.array\./ }); compat2({ targets: '> 1%' }); compat2({ targets: ['defaults', 'last 5 versions'] }); compat2({ targets: { esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat2({ targets: { chrome: '26', firefox: 4 } }); compat2({ targets: { browsers: { chrome: '26', firefox: 4 } } }); compat2({ targets: { chrome: '26', firefox: 4, esmodules: true, node: 'current', browsers: ['> 1%'] } }); compat2({ version: '3.0' }); compat2({ inverse: true }); core-js-3.33.2/tests/type-definitions/package-lock.json000066400000000000000000000012111451776221300230170ustar00rootroot00000000000000{ "name": "tests/type-definitions", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/type-definitions", "devDependencies": { "typescript": "^5.2.2" } }, "node_modules/typescript": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=14.17" } } } } core-js-3.33.2/tests/type-definitions/package.json000066400000000000000000000001361451776221300220760ustar00rootroot00000000000000{ "name": "tests/type-definitions", "devDependencies": { "typescript": "^5.2.2" } } core-js-3.33.2/tests/type-definitions/runner.mjs000066400000000000000000000000161451776221300216310ustar00rootroot00000000000000await $`tsc`; core-js-3.33.2/tests/type-definitions/tsconfig.json000066400000000000000000000003221451776221300223140ustar00rootroot00000000000000{ "compilerOptions": { "strict": true, "target": "esnext", "module": "esnext", "moduleResolution": "node", "esModuleInterop": true, "noEmit": true }, "include": [ "*.ts" ] } core-js-3.33.2/tests/unit-browser/000077500000000000000000000000001451776221300167565ustar00rootroot00000000000000core-js-3.33.2/tests/unit-browser/global.html000066400000000000000000000010161451776221300211020ustar00rootroot00000000000000 core-js
core-js-3.33.2/tests/unit-browser/pure.html000066400000000000000000000005721451776221300206230ustar00rootroot00000000000000 core-js-pure
core-js-3.33.2/tests/unit-bun/000077500000000000000000000000001451776221300160575ustar00rootroot00000000000000core-js-3.33.2/tests/unit-bun/package-lock.json000066400000000000000000000044021451776221300212730ustar00rootroot00000000000000{ "name": "tests/unit-bun", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/unit-bun", "devDependencies": { "qunit": "^2.19.4" } }, "node_modules/commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, "engines": { "node": ">= 10" } }, "node_modules/globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", "dev": true }, "node_modules/globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", "dev": true }, "node_modules/node-watch": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.3.tgz", "integrity": "sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/qunit": { "version": "2.19.4", "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.19.4.tgz", "integrity": "sha512-aqUzzUeCqlleWYKlpgfdHHw9C6KxkB9H3wNfiBg5yHqQMzy0xw/pbCRHYFkjl8MsP/t8qkTQE+JTYL71azgiew==", "dev": true, "dependencies": { "commander": "7.2.0", "node-watch": "0.7.3", "tiny-glob": "0.2.9" }, "bin": { "qunit": "bin/qunit.js" }, "engines": { "node": ">=10" } }, "node_modules/tiny-glob": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", "dev": true, "dependencies": { "globalyzer": "0.1.0", "globrex": "^0.1.2" } } } } core-js-3.33.2/tests/unit-bun/package.json000066400000000000000000000001221451776221300203400ustar00rootroot00000000000000{ "name": "tests/unit-bun", "devDependencies": { "qunit": "^2.20.0" } } core-js-3.33.2/tests/unit-bun/runner.mjs000066400000000000000000000004641451776221300201070ustar00rootroot00000000000000await Promise.all([ ['packages/core-js/index', 'tests/bundles/unit-global'], ['packages/core-js/index', 'packages/core-js-bundle/index', 'tests/bundles/unit-global'], ['tests/bundles/unit-pure'], ].map(files => $`bun ./tests/unit-node/node_modules/.bin/qunit ${ files.map(file => `${ file }.js`) }`)); core-js-3.33.2/tests/unit-global/000077500000000000000000000000001451776221300165335ustar00rootroot00000000000000core-js-3.33.2/tests/unit-global/es.aggregate-error.js000066400000000000000000000054361451776221300225640ustar00rootroot00000000000000const { create } = Object; QUnit.test('AggregateError', assert => { assert.isFunction(AggregateError); assert.arity(AggregateError, 2); assert.name(AggregateError, 'AggregateError'); assert.looksNative(AggregateError); assert.true(new AggregateError([1]) instanceof AggregateError); assert.true(new AggregateError([1]) instanceof Error); assert.true(AggregateError([1]) instanceof AggregateError); assert.true(AggregateError([1]) instanceof Error); assert.same(AggregateError([1], 'foo').message, 'foo'); assert.same(AggregateError([1], 123).message, '123'); assert.same(AggregateError([1]).message, ''); assert.deepEqual(AggregateError([1, 2, 3]).errors, [1, 2, 3]); assert.throws(() => AggregateError([1], Symbol('AggregateError test')), 'throws on symbol as a message'); assert.same(({}).toString.call(AggregateError([1])), '[object Error]', 'Object#toString'); assert.same(AggregateError.prototype.constructor, AggregateError, 'prototype constructor'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(AggregateError.prototype.hasOwnProperty('cause'), 'prototype has not cause'); assert.true(AggregateError([1], 1) instanceof AggregateError, 'no cause, without new'); assert.true(new AggregateError([1], 1) instanceof AggregateError, 'no cause, with new'); assert.true(AggregateError([1], 1, {}) instanceof AggregateError, 'with options, without new'); assert.true(new AggregateError([1], 1, {}) instanceof AggregateError, 'with options, with new'); assert.true(AggregateError([1], 1, 'foo') instanceof AggregateError, 'non-object options, without new'); assert.true(new AggregateError([1], 1, 'foo') instanceof AggregateError, 'non-object options, with new'); assert.same(AggregateError([1], 1, { cause: 7 }).cause, 7, 'cause, without new'); assert.same(new AggregateError([1], 1, { cause: 7 }).cause, 7, 'cause, with new'); assert.same(AggregateError([1], 1, create({ cause: 7 })).cause, 7, 'prototype cause, without new'); assert.same(new AggregateError([1], 1, create({ cause: 7 })).cause, 7, 'prototype cause, with new'); let error = AggregateError([1], 1, { cause: 7 }); assert.deepEqual(error.errors, [1]); assert.same(error.name, 'AggregateError', 'instance name'); assert.same(error.message, '1', 'instance message'); assert.same(error.cause, 7, 'instance cause'); // eslint-disable-next-line no-prototype-builtins -- safe assert.true(error.hasOwnProperty('cause'), 'cause is own'); error = AggregateError([1]); assert.deepEqual(error.errors, [1]); assert.same(error.message, '', 'default instance message'); assert.same(error.cause, undefined, 'default instance cause undefined'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(error.hasOwnProperty('cause'), 'default instance cause missed'); }); core-js-3.33.2/tests/unit-global/es.array-buffer.constructor.js000066400000000000000000000014711451776221300244530ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; QUnit.test('ArrayBuffer', assert => { const Symbol = GLOBAL.Symbol || {}; // in Safari 5 typeof ArrayBuffer is 'object' assert.same(ArrayBuffer, Object(ArrayBuffer), 'is object'); // 0 in V8 ~ Chromium 27- assert.arity(ArrayBuffer, 1); // Safari 5 bug assert.name(ArrayBuffer, 'ArrayBuffer'); // Safari 5 bug if (NATIVE) assert.looksNative(ArrayBuffer); assert.same(new ArrayBuffer(123).byteLength, 123, 'length'); // fails in Safari assert.throws(() => new ArrayBuffer(-1), RangeError, 'negative length'); assert.notThrows(() => new ArrayBuffer(0.5), 'fractional length'); assert.notThrows(() => new ArrayBuffer(), 'missed length'); if (DESCRIPTORS) assert.same(ArrayBuffer[Symbol.species], ArrayBuffer, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array-buffer.is-view.js000066400000000000000000000014461451776221300234530ustar00rootroot00000000000000import { TYPED_ARRAYS } from '../helpers/constants.js'; QUnit.test('ArrayBuffer.isView', assert => { const { isView } = ArrayBuffer; assert.isFunction(isView); assert.arity(isView, 1); assert.name(isView, 'isView'); assert.looksNative(isView); assert.nonEnumerable(ArrayBuffer, 'isView'); for (const { name, TypedArray } of TYPED_ARRAYS) { if (TypedArray) { assert.true(isView(new TypedArray([1])), `${ name } - true`); } } assert.true(isView(new DataView(new ArrayBuffer(1))), 'DataView - true'); assert.false(isView(new ArrayBuffer(1)), 'ArrayBuffer - false'); const examples = [undefined, null, false, true, 0, 1, '', 'qwe', {}, [], function () { /* empty */ }]; for (const example of examples) { assert.false(isView(example), `${ example } - false`); } }); core-js-3.33.2/tests/unit-global/es.array-buffer.slice.js000066400000000000000000000017371451776221300231720ustar00rootroot00000000000000import { arrayToBuffer, bufferToArray } from '../helpers/helpers.js'; QUnit.test('ArrayBuffer#slice', assert => { const { slice } = ArrayBuffer.prototype; assert.isFunction(slice); assert.arity(slice, 2); assert.name(slice, 'slice'); assert.looksNative(slice); // assert.nonEnumerable(ArrayBuffer.prototype, 'slice'); const buffer = arrayToBuffer([1, 2, 3, 4, 5]); assert.true(buffer instanceof ArrayBuffer, 'correct buffer'); assert.notSame(buffer.slice(), buffer, 'returns new buffer'); assert.true(buffer.slice() instanceof ArrayBuffer, 'correct instance'); assert.arrayEqual(bufferToArray(buffer.slice()), [1, 2, 3, 4, 5]); assert.arrayEqual(bufferToArray(buffer.slice(1, 3)), [2, 3]); assert.arrayEqual(bufferToArray(buffer.slice(1, undefined)), [2, 3, 4, 5]); assert.arrayEqual(bufferToArray(buffer.slice(1, -1)), [2, 3, 4]); assert.arrayEqual(bufferToArray(buffer.slice(-2, -1)), [4]); assert.arrayEqual(bufferToArray(buffer.slice(-2, -3)), []); }); core-js-3.33.2/tests/unit-global/es.array.at.js000066400000000000000000000017521451776221300212250ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#at', assert => { const { at } = Array.prototype; assert.isFunction(at); assert.arity(at, 1); assert.name(at, 'at'); assert.looksNative(at); assert.nonEnumerable(Array.prototype, 'at'); assert.same(1, [1, 2, 3].at(0)); assert.same(2, [1, 2, 3].at(1)); assert.same(3, [1, 2, 3].at(2)); assert.same(undefined, [1, 2, 3].at(3)); assert.same(3, [1, 2, 3].at(-1)); assert.same(2, [1, 2, 3].at(-2)); assert.same(1, [1, 2, 3].at(-3)); assert.same(undefined, [1, 2, 3].at(-4)); assert.same(1, [1, 2, 3].at(0.4)); assert.same(1, [1, 2, 3].at(0.5)); assert.same(1, [1, 2, 3].at(0.6)); assert.same(1, [1].at(NaN)); assert.same(1, [1].at()); assert.same(1, [1, 2, 3].at(-0)); assert.same(undefined, Array(1).at(0)); assert.same(1, at.call({ 0: 1, length: 1 }, 0)); if (STRICT) { assert.throws(() => at.call(null, 0), TypeError); assert.throws(() => at.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.concat.js000066400000000000000000000031671451776221300220720ustar00rootroot00000000000000/* eslint-disable no-sparse-arrays, unicorn/prefer-array-flat -- required for testing */ QUnit.test('Array#concat', assert => { const { concat } = Array.prototype; assert.isFunction(concat); assert.arity(concat, 1); assert.name(concat, 'concat'); assert.looksNative(concat); assert.nonEnumerable(Array.prototype, 'concat'); let array = [1, 2]; const sparseArray = [1, , 2]; const nonSpreadableArray = [1, 2]; nonSpreadableArray[Symbol.isConcatSpreadable] = false; const arrayLike = { 0: 1, 1: 2, length: 2 }; const spreadableArrayLike = { 0: 1, 1: 2, length: 2, [Symbol.isConcatSpreadable]: true }; assert.deepEqual(array.concat(), [1, 2], '#1'); assert.deepEqual(sparseArray.concat(), [1, , 2], '#2'); assert.deepEqual(nonSpreadableArray.concat(), [[1, 2]], '#3'); assert.deepEqual(concat.call(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#4'); assert.deepEqual(concat.call(spreadableArrayLike), [1, 2], '#5'); assert.deepEqual([].concat(array), [1, 2], '#6'); assert.deepEqual([].concat(sparseArray), [1, , 2], '#7'); assert.deepEqual([].concat(nonSpreadableArray), [[1, 2]], '#8'); assert.deepEqual([].concat(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#9'); assert.deepEqual([].concat(spreadableArrayLike), [1, 2], '#10'); assert.deepEqual(array.concat(sparseArray, nonSpreadableArray, arrayLike, spreadableArrayLike), [ 1, 2, 1, , 2, [1, 2], { 0: 1, 1: 2, length: 2 }, 1, 2, ], '#11'); array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.concat().foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array.copy-within.js000066400000000000000000000027621451776221300230750ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#copyWithin', assert => { const { copyWithin } = Array.prototype; assert.isFunction(copyWithin); assert.arity(copyWithin, 2); assert.name(copyWithin, 'copyWithin'); assert.looksNative(copyWithin); const array = [1]; assert.same(array.copyWithin(0), array); assert.nonEnumerable(Array.prototype, 'copyWithin'); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, 3), [4, 5, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 3), [1, 4, 5, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 2), [1, 3, 4, 5, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(2, 2), [1, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, 3, 4), [4, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 3, 4), [1, 4, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 2, 4), [1, 3, 4, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, -2), [4, 5, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, -2, -1), [4, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3, -2), [1, 3, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3, -1), [1, 3, 4, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3), [1, 3, 4, 5, 5]); if (STRICT) { assert.throws(() => copyWithin.call(null, 0), TypeError); assert.throws(() => copyWithin.call(undefined, 0), TypeError); } assert.true('copyWithin' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.every.js000066400000000000000000000025301451776221300217460ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#every', assert => { const { every } = Array.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Array.prototype, 'every'); let array = [1]; const context = {}; array.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true([1, 2, 3].every(it => typeof it == 'number')); assert.true([1, 2, 3].every(it => it < 4)); assert.false([1, 2, 3].every(it => it < 3)); assert.false([1, 2, 3].every(it => typeof it == 'string')); assert.true([1, 2, 3].every(function () { return +this === 1; }, 1)); let result = ''; [1, 2, 3].every((value, key) => result += key); assert.same(result, '012'); array = [1, 2, 3]; assert.true(array.every((value, key, that) => that === array)); if (STRICT) { assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.fill.js000066400000000000000000000023461451776221300215470ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants.js'; QUnit.test('Array#fill', assert => { const { fill } = Array.prototype; assert.isFunction(fill); assert.arity(fill, 1); assert.name(fill, 'fill'); assert.looksNative(fill); assert.nonEnumerable(Array.prototype, 'fill'); const array = new Array(5); assert.same(array.fill(5), array); assert.deepEqual(Array(5).fill(5), [5, 5, 5, 5, 5]); assert.deepEqual(Array(5).fill(5, 1), [undefined, 5, 5, 5, 5]); assert.deepEqual(Array(5).fill(5, 1, 4), [undefined, 5, 5, 5, undefined]); assert.deepEqual(Array(5).fill(5, 6, 1), [undefined, undefined, undefined, undefined, undefined]); assert.deepEqual(Array(5).fill(5, -3, 4), [undefined, undefined, 5, 5, undefined]); assert.arrayEqual(fill.call({ length: 5 }, 5), [5, 5, 5, 5, 5]); if (STRICT) { assert.throws(() => fill.call(null, 0), TypeError); assert.throws(() => fill.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => fill.call(Object.defineProperty({ length: -1, }, 0, { set() { throw new Error(); }, })), 'uses ToLength'); } assert.true('fill' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.filter.js000066400000000000000000000023101451776221300220750ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#filter', assert => { const { filter } = Array.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Array.prototype, 'filter'); let array = [1]; const context = {}; array.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], [1, 2, 3, 'q', {}, 4, true, 5].filter(it => typeof it == 'number')); if (STRICT) { assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.filter(Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array.find-index.js000066400000000000000000000025631451776221300226470ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#findIndex', assert => { const { findIndex } = Array.prototype; assert.isFunction(findIndex); assert.arity(findIndex, 1); assert.name(findIndex, 'findIndex'); assert.looksNative(findIndex); assert.nonEnumerable(Array.prototype, 'findIndex'); const array = [1]; const context = {}; array.findIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); // eslint-disable-next-line unicorn/prefer-array-index-of -- ignore assert.same([1, 3, NaN, 42, {}].findIndex(it => it === 42), 3); // eslint-disable-next-line unicorn/prefer-array-index-of -- ignore assert.same([1, 3, NaN, 42, {}].findIndex(it => it === 43), -1); if (STRICT) { assert.throws(() => findIndex.call(null, 0), TypeError); assert.throws(() => findIndex.call(undefined, 0), TypeError); } assert.notThrows(() => findIndex.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === -1, 'uses ToLength'); assert.true('findIndex' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.find-last-index.js000066400000000000000000000027271451776221300236120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#findLastIndex', assert => { const { findLastIndex } = Array.prototype; assert.isFunction(findLastIndex); assert.arity(findLastIndex, 1); assert.name(findLastIndex, 'findLastIndex'); assert.looksNative(findLastIndex); assert.nonEnumerable(Array.prototype, 'findLastIndex'); const array = [1]; const context = {}; array.findLastIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same([{}, 2, NaN, 42, 1].findLastIndex(it => !(it % 2)), 3); assert.same([{}, 2, NaN, 42, 1].findLastIndex(it => it > 42), -1); let values = ''; let keys = ''; [1, 2, 3].findLastIndex((value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); if (STRICT) { assert.throws(() => findLastIndex.call(null, 0), TypeError); assert.throws(() => findLastIndex.call(undefined, 0), TypeError); } assert.notThrows(() => findLastIndex.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === -1, 'uses ToLength'); assert.true('findLastIndex' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.find-last.js000066400000000000000000000026241451776221300225010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#findLast', assert => { const { findLast } = Array.prototype; assert.isFunction(findLast); assert.arity(findLast, 1); assert.name(findLast, 'findLast'); assert.looksNative(findLast); assert.nonEnumerable(Array.prototype, 'findLast'); const array = [1]; const context = {}; array.findLast(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same([{}, 2, NaN, 42, 1].findLast(it => !(it % 2)), 42); assert.same([{}, 2, NaN, 42, 1].findLast(it => it === 43), undefined); let values = ''; let keys = ''; [1, 2, 3].findLast((value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); if (STRICT) { assert.throws(() => findLast.call(null, 0), TypeError); assert.throws(() => findLast.call(undefined, 0), TypeError); } assert.notThrows(() => findLast.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === undefined, 'uses ToLength'); assert.true('find' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.find.js000066400000000000000000000022531451776221300215360ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#find', assert => { const { find } = Array.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Array.prototype, 'find'); const array = [1]; const context = {}; array.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same([1, 3, NaN, 42, {}].find(it => it === 42), 42); assert.same([1, 3, NaN, 42, {}].find(it => it === 43), undefined); if (STRICT) { assert.throws(() => find.call(null, 0), TypeError); assert.throws(() => find.call(undefined, 0), TypeError); } assert.notThrows(() => find.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === undefined, 'uses ToLength'); assert.true('find' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.flat-map.js000066400000000000000000000024451451776221300223220ustar00rootroot00000000000000/* eslint-disable unicorn/prefer-array-flat -- required for testing */ import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#flatMap', assert => { const { flatMap } = Array.prototype; assert.isFunction(flatMap); assert.name(flatMap, 'flatMap'); assert.arity(flatMap, 1); assert.looksNative(flatMap); assert.nonEnumerable(Array.prototype, 'flatMap'); assert.deepEqual([].flatMap(it => it), []); assert.deepEqual([1, 2, 3].flatMap(it => it), [1, 2, 3]); assert.deepEqual([1, 2, 3].flatMap(it => [it, it]), [1, 1, 2, 2, 3, 3]); assert.deepEqual([1, 2, 3].flatMap(it => [[it], [it]]), [[1], [1], [2], [2], [3], [3]]); assert.deepEqual([1, [2, 3]].flatMap(() => 1), [1, 1]); const array = [1]; const context = {}; array.flatMap(function (value, key, that) { assert.same(value, 1); assert.same(key, 0); assert.same(that, array); assert.same(this, context); return value; }, context); if (STRICT) { assert.throws(() => flatMap.call(null, it => it), TypeError); assert.throws(() => flatMap.call(undefined, it => it), TypeError); } assert.notThrows(() => flatMap.call({ length: -1 }, () => { throw new Error(); }).length === 0, 'uses ToLength'); assert.true('flatMap' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.flat.js000066400000000000000000000022761451776221300215510ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; QUnit.test('Array#flat', assert => { const { flat } = Array.prototype; const { defineProperty } = Object; assert.isFunction(flat); assert.name(flat, 'flat'); assert.arity(flat, 0); assert.looksNative(flat); assert.nonEnumerable(Array.prototype, 'flat'); assert.deepEqual([].flat(), []); const array = [1, [2, 3], [4, [5, 6]]]; assert.deepEqual(array.flat(0), array); assert.deepEqual(array.flat(1), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(array.flat(), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(array.flat(2), [1, 2, 3, 4, 5, 6]); assert.deepEqual(array.flat(3), [1, 2, 3, 4, 5, 6]); assert.deepEqual(array.flat(-1), array); assert.deepEqual(array.flat(Infinity), [1, 2, 3, 4, 5, 6]); if (STRICT) { assert.throws(() => flat.call(null), TypeError); assert.throws(() => flat.call(undefined), TypeError); } if (DESCRIPTORS) { assert.notThrows(() => flat.call(defineProperty({ length: -1 }, 0, { enumerable: true, get() { throw new Error(); }, })).length === 0, 'uses ToLength'); } assert.true('flat' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.for-each.js000066400000000000000000000027631451776221300223100ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#forEach', assert => { const { forEach } = Array.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(Array.prototype, 'forEach'); let array = [1]; const context = {}; array.forEach(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); let result = ''; [1, 2, 3].forEach(value => { result += value; }); assert.same(result, '123'); result = ''; [1, 2, 3].forEach((value, key) => { result += key; }); assert.same(result, '012'); result = ''; [1, 2, 3].forEach((value, key, that) => { result += that; }); assert.same(result, '1,2,31,2,31,2,3'); result = ''; [1, 2, 3].forEach(function () { result += this; }, 1); assert.same(result, '111'); result = ''; array = []; array[5] = ''; array.forEach((value, key) => { result += key; }); assert.same(result, '5'); if (STRICT) { assert.throws(() => { forEach.call(null, () => { /* empty */ }); }, TypeError); assert.throws(() => { forEach.call(undefined, () => { /* empty */ }); }, TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.from.js000066400000000000000000000104161451776221300215610ustar00rootroot00000000000000/* eslint-disable prefer-rest-params -- required for testing */ import { DESCRIPTORS, GLOBAL } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; QUnit.test('Array.from', assert => { const Symbol = GLOBAL.Symbol || {}; const { from } = Array; const { defineProperty } = Object; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Array, 'from'); let types = { 'array-like': { length: '3', 0: '1', 1: '2', 2: '3', }, arguments: function () { return arguments; }('1', '2', '3'), array: ['1', '2', '3'], iterable: createIterable(['1', '2', '3']), string: '123', }; for (const type in types) { const data = types[type]; assert.arrayEqual(from(data), ['1', '2', '3'], `Works with ${ type }`); assert.arrayEqual(from(data, it => it ** 2), [1, 4, 9], `Works with ${ type } + mapFn`); } types = { 'array-like': { length: 1, 0: 1, }, arguments: function () { return arguments; }(1), array: [1], iterable: createIterable([1]), string: '1', }; for (const type in types) { const data = types[type]; const context = {}; assert.arrayEqual(from(data, function (value, key) { assert.same(this, context, `Works with ${ type }, correct callback context`); assert.same(value, type === 'string' ? '1' : 1, `Works with ${ type }, correct callback key`); assert.same(key, 0, `Works with ${ type }, correct callback value`); assert.same(arguments.length, 2, `Works with ${ type }, correct callback arguments number`); return 42; }, context), [42], `Works with ${ type }, correct result`); } const primitives = [false, true, 0]; for (const primitive of primitives) { assert.arrayEqual(from(primitive), [], `Works with ${ primitive }`); } assert.throws(() => from(null), TypeError, 'Throws on null'); assert.throws(() => from(undefined), TypeError, 'Throws on undefined'); assert.arrayEqual(from('𠮷𠮷𠮷'), ['𠮷', '𠮷', '𠮷'], 'Uses correct string iterator'); let done = true; from(createIterable([1, 2, 3], { return() { return done = false; }, }), () => false); assert.true(done, '.return #default'); done = false; try { from(createIterable([1, 2, 3], { return() { return done = true; }, }), () => { throw new Error(); }); } catch { /* empty */ } assert.true(done, '.return #throw'); class C { /* empty */ } let instance = from.call(C, createIterable([1, 2])); assert.true(instance instanceof C, 'generic, iterable case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, iterable case, elements'); instance = from.call(C, { 0: 1, 1: 2, length: 2, }); assert.true(instance instanceof C, 'generic, array-like case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; assert.arrayEqual(from(array), [1, 2, 3], 'Array with custom iterator, elements'); assert.true(done, 'call @@iterator in Array with custom iterator'); array = [1, 2, 3]; delete array[1]; assert.arrayEqual(from(array, String), ['1', 'undefined', '3'], 'Ignores holes'); assert.notThrows(() => from({ length: -1, 0: 1, }, () => { throw new Error(); }).length === 0, 'Uses ToLength'); assert.arrayEqual(from([], undefined), [], 'Works with undefined as second argument'); assert.throws(() => from([], null), TypeError, 'Throws with null as second argument'); assert.throws(() => from([], 0), TypeError, 'Throws with 0 as second argument'); assert.throws(() => from([], ''), TypeError, 'Throws with "" as second argument'); assert.throws(() => from([], false), TypeError, 'Throws with false as second argument'); assert.throws(() => from([], {}), TypeError, 'Throws with {} as second argument'); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); from.call(C, [1, 2, 3]); assert.false(called, 'Should not call prototype accessors'); } }); core-js-3.33.2/tests/unit-global/es.array.includes.js000066400000000000000000000016631451776221300224300ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#includes', assert => { const { includes } = Array.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.looksNative(includes); assert.nonEnumerable(Array.prototype, 'includes'); const object = {}; const array = [1, 2, 3, -0, object]; assert.true(array.includes(1)); assert.true(array.includes(-0)); assert.true(array.includes(0)); assert.true(array.includes(object)); assert.false(array.includes(4)); assert.false(array.includes(-0.5)); assert.false(array.includes({})); assert.true(Array(1).includes(undefined)); assert.true([NaN].includes(NaN)); if (STRICT) { assert.throws(() => includes.call(null, 0), TypeError); assert.throws(() => includes.call(undefined, 0), TypeError); } assert.true('includes' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.index-of.js000066400000000000000000000015651451776221300223340ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#indexOf', assert => { const { indexOf } = Array.prototype; assert.isFunction(indexOf); assert.arity(indexOf, 1); assert.name(indexOf, 'indexOf'); assert.looksNative(indexOf); assert.nonEnumerable(Array.prototype, 'indexOf'); assert.same(0, [1, 1, 1].indexOf(1)); assert.same(-1, [1, 2, 3].indexOf(1, 1)); assert.same(1, [1, 2, 3].indexOf(2, 1)); assert.same(-1, [1, 2, 3].indexOf(2, -1)); assert.same(1, [1, 2, 3].indexOf(2, -2)); assert.same(-1, [NaN].indexOf(NaN)); assert.same(3, Array(2).concat([1, 2, 3]).indexOf(2)); assert.same(-1, Array(1).indexOf(undefined)); assert.same(0, [1].indexOf(1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => indexOf.call(null, 0), TypeError); assert.throws(() => indexOf.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.is-array.js000066400000000000000000000006671451776221300223540ustar00rootroot00000000000000QUnit.test('Array.isArray', assert => { const { isArray } = Array; assert.isFunction(isArray); assert.arity(isArray, 1); assert.name(isArray, 'isArray'); assert.looksNative(isArray); assert.nonEnumerable(Array, 'isArray'); assert.false(isArray({})); assert.false(isArray(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.true(isArray([])); }); core-js-3.33.2/tests/unit-global/es.array.iterator.js000066400000000000000000000101701451776221300224440ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('Array#keys', assert => { const { keys } = Array.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.name(keys, 'keys'); assert.looksNative(keys); assert.nonEnumerable(Array.prototype, 'keys'); const iterator = ['q', 'w', 'e'].keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.same(String(iterator), '[object Array Iterator]'); assert.deepEqual(iterator.next(), { value: 0, done: false, }); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: 2, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* still not fixed even in modern WebKit assert.deepEqual(keys.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); */ assert.true('keys' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#values', assert => { const { values } = Array.prototype; assert.isFunction(values); assert.arity(values, 0); assert.name(values, 'values'); assert.looksNative(values); assert.nonEnumerable(Array.prototype, 'values'); const iterator = ['q', 'w', 'e'].values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* still not fixed even in modern WebKit assert.deepEqual(values.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); */ assert.true('values' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#entries', assert => { const { entries } = Array.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); assert.looksNative(entries); assert.nonEnumerable(Array.prototype, 'entries'); const iterator = ['q', 'w', 'e'].entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: [1, 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: [2, 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* still not fixed even in modern WebKit assert.deepEqual(entries.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); */ assert.true('entries' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#@@iterator', assert => { assert.isIterable(Array.prototype); assert.arity(Array.prototype[Symbol.iterator], 0); assert.name(Array.prototype[Symbol.iterator], 'values'); assert.looksNative(Array.prototype[Symbol.iterator]); assert.nonEnumerable(Array.prototype, Symbol.iterator); assert.same(Array.prototype[Symbol.iterator], Array.prototype.values); const iterator = ['q', 'w', 'e'][Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* still not fixed even in modern WebKit assert.deepEqual(Array.prototype[Symbol.iterator].call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); */ }); core-js-3.33.2/tests/unit-global/es.array.join.js000066400000000000000000000010711451776221300215520ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#join', assert => { const { join } = Array.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.looksNative(join); assert.nonEnumerable(Array.prototype, 'join'); assert.same(join.call([1, 2, 3], undefined), '1,2,3'); assert.same(join.call('123'), '1,2,3'); assert.same(join.call('123', '|'), '1|2|3'); if (STRICT) { assert.throws(() => join.call(null, 0), TypeError); assert.throws(() => join.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.last-index-of.js000066400000000000000000000016761451776221300233000ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#lastIndexOf', assert => { const { lastIndexOf } = Array.prototype; assert.isFunction(lastIndexOf); assert.arity(lastIndexOf, 1); assert.name(lastIndexOf, 'lastIndexOf'); assert.looksNative(lastIndexOf); assert.nonEnumerable(Array.prototype, 'lastIndexOf'); assert.same(2, [1, 1, 1].lastIndexOf(1)); assert.same(-1, [1, 2, 3].lastIndexOf(3, 1)); assert.same(1, [1, 2, 3].lastIndexOf(2, 1)); assert.same(-1, [1, 2, 3].lastIndexOf(2, -3)); assert.same(-1, [1, 2, 3].lastIndexOf(1, -4)); assert.same(1, [1, 2, 3].lastIndexOf(2, -2)); assert.same(-1, [NaN].lastIndexOf(NaN)); assert.same(1, [1, 2, 3].concat(Array(2)).lastIndexOf(2)); assert.same(0, [1].lastIndexOf(1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => lastIndexOf.call(null, 0), TypeError); assert.throws(() => lastIndexOf.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.map.js000066400000000000000000000024361451776221300213760ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#map', assert => { const { map } = Array.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Array.prototype, 'map'); let array = [1]; const context = {}; array.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([2, 3, 4], [1, 2, 3].map(value => value + 1)); assert.deepEqual([1, 3, 5], [1, 2, 3].map((value, key) => value + key)); assert.deepEqual([2, 2, 2], [1, 2, 3].map(function () { return +this; }, 2)); if (STRICT) { assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.map(Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array.of.js000066400000000000000000000014641451776221300212250ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Array.of', assert => { const { defineProperty } = Object; assert.isFunction(Array.of); assert.arity(Array.of, 0); assert.name(Array.of, 'of'); assert.looksNative(Array.of); assert.nonEnumerable(Array, 'of'); assert.deepEqual(Array.of(1), [1]); assert.deepEqual(Array.of(1, 2, 3), [1, 2, 3]); class C { /* empty */ } const instance = Array.of.call(C, 1, 2); assert.true(instance instanceof C); assert.same(instance[0], 1); assert.same(instance[1], 2); assert.same(instance.length, 2); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); Array.of.call(C, 1, 2, 3); assert.false(called, 'Should not call prototype accessors'); } }); core-js-3.33.2/tests/unit-global/es.array.push.js000066400000000000000000000017411451776221300215760ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; const { defineProperty } = Object; QUnit.test('Array#push', assert => { const { push } = Array.prototype; assert.isFunction(push); assert.arity(push, 1); assert.name(push, 'push'); assert.looksNative(push); assert.nonEnumerable(Array.prototype, 'push'); const object = { length: 0x100000000 }; assert.same(push.call(object, 1), 0x100000001, 'proper ToLength #1'); assert.same(object[0x100000000], 1, 'proper ToLength #2'); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => push.call(defineProperty([], 'length', { writable: false }), 1), TypeError, 'non-writable length, with arg'); assert.throws(() => push.call(defineProperty([], 'length', { writable: false })), TypeError, 'non-writable length, without arg'); } assert.throws(() => push.call(null), TypeError); assert.throws(() => push.call(undefined), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.reduce-right.js000066400000000000000000000036211451776221300232000ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#reduceRight', assert => { const { reduceRight } = Array.prototype; assert.isFunction(reduceRight); assert.arity(reduceRight, 1); assert.name(reduceRight, 'reduceRight'); assert.looksNative(reduceRight); assert.nonEnumerable(Array.prototype, 'reduceRight'); const array = [1]; const accumulator = {}; array.reduceRight(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same([1, 2, 3].reduceRight(((a, b) => a + b), 1), 7, 'works with initial accumulator'); [1, 2].reduceRight((memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same([1, 2, 3].reduceRight((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; [1, 2, 3].reduceRight((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.same(reduceRight.call({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); assert.throws(() => reduceRight.call([], () => { /* empty */ }), TypeError); assert.throws(() => reduceRight.call(Array(5), () => { /* empty */ }), TypeError); if (STRICT) { assert.throws(() => reduceRight.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduceRight.call(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.reduce.js000066400000000000000000000034671451776221300220750ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#reduce', assert => { const { reduce } = Array.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Array.prototype, 'reduce'); const array = [1]; const accumulator = {}; array.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same([1, 2, 3].reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); [1, 2].reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same([1, 2, 3].reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; [1, 2, 3].reduce((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.same(reduce.call({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); assert.throws(() => reduce.call([], () => { /* empty */ }), TypeError); assert.throws(() => reduce.call(Array(5), () => { /* empty */ }), TypeError); if (STRICT) { assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.reverse.js000066400000000000000000000011541451776221300222700ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#reverse', assert => { const { reverse } = Array.prototype; assert.isFunction(reverse); assert.arity(reverse, 0); assert.name(reverse, 'reverse'); assert.looksNative(reverse); assert.nonEnumerable(Array.prototype, 'reverse'); const a = [1, 2.2, 3.3]; function fn() { +a; a.reverse(); } fn(); assert.arrayEqual(a, [3.3, 2.2, 1]); if (STRICT) { assert.throws(() => reverse.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reverse.call(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.slice.js000066400000000000000000000030521451776221300217130ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants.js'; QUnit.test('Array#slice', assert => { const { slice } = Array.prototype; const { isArray } = Array; assert.isFunction(slice); assert.arity(slice, 2); assert.name(slice, 'slice'); assert.looksNative(slice); assert.nonEnumerable(Array.prototype, 'slice'); let array = ['1', '2', '3', '4', '5']; assert.deepEqual(array.slice(), array); assert.deepEqual(array.slice(1, 3), ['2', '3']); assert.deepEqual(array.slice(1, undefined), ['2', '3', '4', '5']); assert.deepEqual(array.slice(1, -1), ['2', '3', '4']); assert.deepEqual(array.slice(-2, -1), ['4']); assert.deepEqual(array.slice(-2, -3), []); const string = '12345'; assert.deepEqual(slice.call(string), array); assert.deepEqual(slice.call(string, 1, 3), ['2', '3']); assert.deepEqual(slice.call(string, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice.call(string, 1, -1), ['2', '3', '4']); assert.deepEqual(slice.call(string, -2, -1), ['4']); assert.deepEqual(slice.call(string, -2, -3), []); const list = GLOBAL.document && document.body && document.body.childNodes; if (list) { assert.notThrows(() => isArray(slice.call(list)), 'works on NodeList'); } if (STRICT) { assert.throws(() => slice.call(null), TypeError); assert.throws(() => slice.call(undefined), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.slice().foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array.some.js000066400000000000000000000025771451776221300215720ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#some', assert => { const { some } = Array.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Array.prototype, 'some'); let array = [1]; const context = {}; array.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true([1, '2', 3].some(value => typeof value == 'number')); assert.true([1, 2, 3].some(value => value < 3)); assert.false([1, 2, 3].some(value => value < 0)); assert.false([1, 2, 3].some(value => typeof value == 'string')); assert.false([1, 2, 3].some(function () { return +this !== 1; }, 1)); let result = ''; [1, 2, 3].some((value, key) => { result += key; return false; }); assert.same(result, '012'); array = [1, 2, 3]; assert.false(array.some((value, key, that) => that !== array)); if (STRICT) { assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.sort.js000066400000000000000000000064231451776221300216100ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#sort', assert => { const { sort } = Array.prototype; assert.isFunction(sort); assert.arity(sort, 1); assert.name(sort, 'sort'); assert.looksNative(sort); assert.nonEnumerable(Array.prototype, 'sort'); assert.deepEqual([1, 3, 2].sort(), [1, 2, 3], '#1'); assert.deepEqual([1, 3, 2, 11].sort(), [1, 11, 2, 3], '#2'); assert.deepEqual([1, -1, 3, NaN, 2, 0, 11, -0].sort(), [-1, 0, -0, 1, 11, 2, 3, NaN], '#1'); let array = Array(5); array[0] = 1; array[2] = 3; array[4] = 2; let expected = Array(5); expected[0] = 1; expected[1] = 2; expected[2] = 3; assert.deepEqual(array.sort(), expected, 'holes'); array = 'zyxwvutsrqponMLKJIHGFEDCBA'.split(''); expected = 'ABCDEFGHIJKLMnopqrstuvwxyz'.split(''); assert.deepEqual(array.sort(), expected, 'alpha #1'); array = 'ёяюэьыъщшчцхфутсрПОНМЛКЙИЗЖЕДГВБА'.split(''); expected = 'АБВГДЕЖЗИЙКЛМНОПрстуфхцчшщъыьэюяё'.split(''); assert.deepEqual(array.sort(), expected, 'alpha #2'); array = [undefined, 1]; assert.notThrows(() => array.sort(() => { throw 1; }), 'undefined #1'); assert.deepEqual(array, [1, undefined], 'undefined #2'); const object = { valueOf: () => 1, toString: () => -1, }; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; expected = { 0: -1, 1: object, 2: 1, 3: 2, 4: Infinity, 5: NaN, 6: 'X', 7: 'a', 8: true, 9: undefined, length: 11, }; assert.deepEqual(sort.call(array), expected, 'custom generic'); let index, mod, code, chr, value; expected = Array(516); array = Array(516); for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } array.sort((a, b) => (a / 4 | 0) - (b / 4 | 0)); assert.true(1 / [0, -0].sort()[0] > 0, '-0'); assert.arrayEqual(array, expected, 'stable #1'); let result = ''; array = []; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } array.sort((a, b) => b.v - a.v); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } assert.same(result, 'DGBEFHACIJK', 'stable #2'); assert.notThrows(() => [1, 2, 3].sort(undefined).length === 3, 'works with undefined'); assert.throws(() => [1, 2, 3].sort(null), 'throws on null'); assert.throws(() => [1, 2, 3].sort({}), 'throws on {}'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => [Symbol(1), Symbol(2)].sort(), 'w/o cmp throws on symbols'); } if (STRICT) { assert.throws(() => sort.call(null), TypeError, 'ToObject(this)'); assert.throws(() => sort.call(undefined), TypeError, 'ToObject(this)'); } }); core-js-3.33.2/tests/unit-global/es.array.splice.js000066400000000000000000000032561451776221300221010ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; const { defineProperty } = Object; QUnit.test('Array#splice', assert => { const { splice } = Array.prototype; assert.isFunction(splice); assert.arity(splice, 2); assert.name(splice, 'splice'); assert.looksNative(splice); assert.nonEnumerable(Array.prototype, 'splice'); let array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2), [3, 4, 5]); assert.deepEqual(array, [1, 2]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(-2), [4, 5]); assert.deepEqual(array, [1, 2, 3]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, 2), [3, 4]); assert.deepEqual(array, [1, 2, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, -2), []); assert.deepEqual(array, [1, 2, 3, 4, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, 2, 6, 7), [3, 4]); assert.deepEqual(array, [1, 2, 6, 7, 5]); // ES6 semantics array = [0, 1, 2]; assert.deepEqual(array.splice(0), [0, 1, 2]); array = [0, 1, 2]; assert.deepEqual(array.splice(1), [1, 2]); array = [0, 1, 2]; assert.deepEqual(array.splice(2), [2]); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => splice.call(defineProperty([1, 2, 3], 'length', { writable: false }), 1, 1), TypeError, 'non-writable length'); } assert.throws(() => splice.call(null), TypeError); assert.throws(() => splice.call(undefined), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.splice().foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/es.array.to-reversed.js000066400000000000000000000026071451776221300230600ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#toReversed', assert => { const { toReversed } = Array.prototype; assert.isFunction(toReversed); assert.arity(toReversed, 0); assert.name(toReversed, 'toReversed'); assert.looksNative(toReversed); assert.nonEnumerable(Array.prototype, 'toReversed'); let array = [1, 2]; assert.notSame(array.toReversed(), array, 'immutable'); assert.deepEqual([1, 2.2, 3.3].toReversed(), [3.3, 2.2, 1], 'basic'); const object = {}; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; const expected = [ Infinity, undefined, NaN, object, true, 'a', -1, 'X', 1, 2, undefined, ]; assert.deepEqual(toReversed.call(array), expected, 'non-array target'); array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(array.toReversed() instanceof Array, 'non-generic'); if (STRICT) { assert.throws(() => toReversed.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => toReversed.call(undefined, () => { /* empty */ }, 1), TypeError); } assert.true('toReversed' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.to-sorted.js000066400000000000000000000073531451776221300225440ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#toSorted', assert => { const { toSorted } = Array.prototype; assert.isFunction(toSorted); assert.arity(toSorted, 1); assert.name(toSorted, 'toSorted'); assert.looksNative(toSorted); assert.nonEnumerable(Array.prototype, 'toSorted'); let array = [1]; assert.notSame(array.toSorted(), array, 'immutable'); assert.deepEqual([1, 3, 2].toSorted(), [1, 2, 3], '#1'); assert.deepEqual([1, 3, 2, 11].toSorted(), [1, 11, 2, 3], '#2'); assert.deepEqual([1, -1, 3, NaN, 2, 0, 11, -0].toSorted(), [-1, 0, -0, 1, 11, 2, 3, NaN], '#1'); array = Array(5); array[0] = 1; array[2] = 3; array[4] = 2; let expected = Array(5); expected[0] = 1; expected[1] = 2; expected[2] = 3; assert.deepEqual(array.toSorted(), expected, 'holes'); array = 'zyxwvutsrqponMLKJIHGFEDCBA'.split(''); expected = 'ABCDEFGHIJKLMnopqrstuvwxyz'.split(''); assert.deepEqual(array.toSorted(), expected, 'alpha #1'); array = 'ёяюэьыъщшчцхфутсрПОНМЛКЙИЗЖЕДГВБА'.split(''); expected = 'АБВГДЕЖЗИЙКЛМНОПрстуфхцчшщъыьэюяё'.split(''); assert.deepEqual(array.toSorted(), expected, 'alpha #2'); array = [undefined, 1]; assert.notThrows(() => array = array.toSorted(() => { throw 1; }), 'undefined #1'); assert.deepEqual(array, [1, undefined], 'undefined #2'); const object = { valueOf: () => 1, toString: () => -1, }; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; expected = [ -1, object, 1, 2, Infinity, NaN, 'X', 'a', true, undefined, undefined, ]; assert.deepEqual(toSorted.call(array), expected, 'non-array target'); let index, mod, code, chr, value; expected = Array(516); array = Array(516); for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } assert.arrayEqual(array.toSorted((a, b) => (a / 4 | 0) - (b / 4 | 0)), expected, 'stable #1'); assert.true(1 / [0, -0].toSorted()[0] > 0, '-0'); let result = ''; array = []; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } array = array.toSorted((a, b) => b.v - a.v); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } assert.same(result, 'DGBEFHACIJK', 'stable #2'); assert.notThrows(() => [1, 2, 3].toSorted(undefined).length === 3, 'works with undefined'); assert.throws(() => [1, 2, 3].toSorted(null), 'throws on null'); assert.throws(() => [1, 2, 3].toSorted({}), 'throws on {}'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => [Symbol(1), Symbol(2)].toSorted(), 'w/o cmp throws on symbols'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(array.toSorted() instanceof Array, 'non-generic'); if (STRICT) { assert.throws(() => toSorted.call(null), TypeError, 'ToObject(this)'); assert.throws(() => toSorted.call(undefined), TypeError, 'ToObject(this)'); } assert.true('toSorted' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.to-spliced.js000066400000000000000000000022761451776221300226660ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#toSpliced', assert => { const { toSpliced } = Array.prototype; assert.isFunction(toSpliced); assert.arity(toSpliced, 2); assert.name(toSpliced, 'toSpliced'); assert.looksNative(toSpliced); assert.nonEnumerable(Array.prototype, 'toSpliced'); let array = [1, 2, 3, 4, 5]; assert.notSame(array.toSpliced(2), array, 'immutable'); assert.deepEqual([1, 2, 3, 4, 5].toSpliced(2), [1, 2]); assert.deepEqual([1, 2, 3, 4, 5].toSpliced(-2), [1, 2, 3]); assert.deepEqual([1, 2, 3, 4, 5].toSpliced(2, 2), [1, 2, 5]); assert.deepEqual([1, 2, 3, 4, 5].toSpliced(2, -2), [1, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].toSpliced(2, 2, 6, 7), [1, 2, 6, 7, 5]); if (STRICT) { assert.throws(() => toSpliced.call(null), TypeError); assert.throws(() => toSpliced.call(undefined), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(array.toSpliced() instanceof Array, 'non-generic'); assert.true('toSpliced' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/es.array.unshift.js000066400000000000000000000016171451776221300223010ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; const { defineProperty } = Object; QUnit.test('Array#unshift', assert => { const { unshift } = Array.prototype; assert.isFunction(unshift); assert.arity(unshift, 1); assert.name(unshift, 'unshift'); assert.looksNative(unshift); assert.nonEnumerable(Array.prototype, 'unshift'); assert.same(unshift.call([1], 0), 2, 'proper result'); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false }), 1), TypeError, 'non-writable length, with arg'); assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false })), TypeError, 'non-writable length, without arg'); } assert.throws(() => unshift.call(null), TypeError); assert.throws(() => unshift.call(undefined), TypeError); } }); core-js-3.33.2/tests/unit-global/es.array.with.js000066400000000000000000000021151451776221300215660ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#with', assert => { const { with: withAt } = Array.prototype; assert.isFunction(withAt); assert.arity(withAt, 2); // assert.name(withAt, 'with'); assert.looksNative(withAt); assert.nonEnumerable(Array.prototype, 'with'); let array = [1, 2, 3, 4, 5]; assert.notSame(array.with(2, 1), array, 'immutable'); assert.deepEqual([1, 2, 3, 4, 5].with(2, 6), [1, 2, 6, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].with(-2, 6), [1, 2, 3, 6, 5]); assert.deepEqual([1, 2, 3, 4, 5].with('1', 6), [1, 6, 3, 4, 5]); assert.throws(() => [1, 2, 3, 4, 5].with(5, 6), RangeError); assert.throws(() => [1, 2, 3, 4, 5].with(-6, 6), RangeError); if (STRICT) { assert.throws(() => withAt.call(null, 1, 2), TypeError); assert.throws(() => withAt.call(undefined, 1, 2), TypeError); } array = [1, 2]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(array.with(1, 2) instanceof Array, 'non-generic'); }); core-js-3.33.2/tests/unit-global/es.data-view.js000066400000000000000000000176551451776221300213760ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants.js'; QUnit.test('DataView', assert => { assert.same(DataView, Object(DataView), 'is object'); // in Safari 5 typeof DataView is 'object' if (NATIVE) assert.arity(DataView, 3); // 1 in IE11 if (NATIVE) assert.name(DataView, 'DataView'); // Safari 5 bug if (NATIVE) assert.looksNative(DataView); // Safari 5 bug let dataview = new DataView(new ArrayBuffer(8)); assert.same(dataview.byteOffset, 0, '#byteOffset, passed buffer'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer'); dataview = new DataView(new ArrayBuffer(16), 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer and byteOffset'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer and byteOffset'); dataview = new DataView(new ArrayBuffer(24), 8, 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and length'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer, byteOffset and length'); if (NATIVE) { // fails in IE / MS Edge dataview = new DataView(new ArrayBuffer(8), undefined); assert.same(dataview.byteOffset, 0, '#byteOffset, passed buffer and undefined'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer and undefined'); // fails in IE / MS Edge dataview = new DataView(new ArrayBuffer(16), 8, undefined); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and undefined'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer, byteOffset and undefined'); // fails in IE10 dataview = new DataView(new ArrayBuffer(8), 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer and byteOffset with buffer length'); assert.same(dataview.byteLength, 0, '#byteLength, passed buffer and byteOffset with buffer length'); // TypeError in IE + FF bug - TypeError instead of RangeError assert.throws(() => new DataView(new ArrayBuffer(8), -1), RangeError, 'If offset < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(8), 16), RangeError, 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(24), 8, 24), RangeError, 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); // Android ~ 4.0 assert.throws(() => DataView(1), TypeError, 'throws without `new`'); assert.throws(() => DataView(1), 'throws without `new`'); } else { // FF bug - TypeError instead of RangeError assert.throws(() => new DataView(new ArrayBuffer(8), -1), 'If offset < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(8), 16), 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(24), 8, 24), 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } dataview = new DataView(new ArrayBuffer(8)); dataview.setUint32(0, 0x12345678); assert.same(dataview.getUint32(0), 0x12345678, 'big endian/big endian'); dataview.setUint32(0, 0x12345678, true); assert.same(dataview.getUint32(0, true), 0x12345678, 'little endian/little endian'); dataview.setUint32(0, 0x12345678, true); assert.same(dataview.getUint32(0), 0x78563412, 'little endian/big endian'); dataview.setUint32(0, 0x12345678); assert.same(dataview.getUint32(0, true), 0x78563412, 'big endian/little endian'); assert.throws(() => new DataView({}), 'non-ArrayBuffer argument, object'); assert.throws(() => new DataView('foo'), 'non-ArrayBuffer argument, string'); }); if (DESCRIPTORS) { QUnit.test('DataView accessors', assert => { const uint8array = new Uint8Array(8); const dataview = new DataView(uint8array.buffer); assert.arrayEqual(uint8array, [0, 0, 0, 0, 0, 0, 0, 0]); dataview.setUint8(0, 255); assert.arrayEqual(uint8array, [0xFF, 0, 0, 0, 0, 0, 0, 0]); dataview.setInt8(1, -1); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0, 0, 0, 0, 0, 0]); dataview.setUint16(2, 0x1234); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0x12, 0x34, 0, 0, 0, 0]); dataview.setInt16(4, -1); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0x12, 0x34, 0xFF, 0xFF, 0, 0]); dataview.setUint32(1, 0x12345678); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x34, 0x56, 0x78, 0xFF, 0, 0]); dataview.setInt32(4, -2023406815); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x34, 0x56, 0x87, 0x65, 0x43, 0x21]); dataview.setFloat32(2, 1.2e+38); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x7E, 0xB4, 0x8E, 0x52, 0x43, 0x21]); dataview.setFloat64(0, -1.2345678e+301); assert.arrayEqual(uint8array, [0xFE, 0x72, 0x6F, 0x51, 0x5F, 0x61, 0x77, 0xE5]); const data = [0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87]; for (let i = 0, { length } = data; i < length; ++i) { uint8array[i] = data[i]; } assert.same(dataview.getUint8(0), 128); assert.same(dataview.getInt8(1), -127); assert.same(dataview.getUint16(2), 33411); assert.same(dataview.getInt16(3), -31868); assert.same(dataview.getUint32(4), 2223343239); assert.same(dataview.getInt32(2), -2105310075); assert.same(dataview.getFloat32(2), -1.932478247535851e-37); assert.same(dataview.getFloat64(0), -3.116851295377095e-306); }); QUnit.test('DataView endian', assert => { const { buffer } = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]); let dataview = new DataView(buffer); assert.same(dataview.byteLength, 8, 'buffer'); assert.same(dataview.byteOffset, 0, 'buffer'); assert.throws(() => dataview.getUint8(-2)); assert.throws(() => dataview.getUint8(8), 'bounds for buffer'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer'); assert.throws(() => dataview.setUint8(8, 0), 'bounds for buffer'); dataview = new DataView(buffer, 2); assert.same(dataview.byteLength, 6, 'buffer, byteOffset'); assert.same(dataview.byteOffset, 2, 'buffer, byteOffset'); assert.same(dataview.getUint8(5), 7, 'buffer, byteOffset'); assert.throws(() => dataview.getUint8(-2), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.getUint8(6), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.setUint8(6, 0), 'bounds for buffer, byteOffset'); assert.throws(() => new DataView(buffer, -1), 'invalid byteOffset'); assert.throws(() => new DataView(buffer, 9), 'invalid byteOffset'); dataview = new DataView(buffer, 2, 4); assert.same(dataview.byteLength, 4, 'buffer, byteOffset, length'); assert.same(dataview.byteOffset, 2, 'buffer, byteOffset, length'); assert.same(dataview.getUint8(3), 5, 'buffer, byteOffset, length'); assert.throws(() => dataview.getUint8(-2), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.getUint8(4), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.setUint8(4, 0), 'bounds for buffer, byteOffset, length'); assert.throws(() => new DataView(buffer, 0, 9), 'invalid byteOffset+length'); assert.throws(() => new DataView(buffer, 8, 1), 'invalid byteOffset+length'); assert.throws(() => new DataView(buffer, 9, -1), 'invalid byteOffset+length'); }); } const types = ['Uint8', 'Int8', 'Uint16', 'Int16', 'Uint32', 'Int32', 'Float32', 'Float64']; for (const type of types) { const GETTER = `get${ type }`; const SETTER = `set${ type }`; QUnit.test(`DataView#${ GETTER }`, assert => { assert.isFunction(DataView.prototype[GETTER]); NATIVE && assert.arity(DataView.prototype[GETTER], 1); assert.same(new DataView(new ArrayBuffer(8))[GETTER](0), 0, 'returns element'); }); QUnit.test(`DataView#${ SETTER }`, assert => { assert.isFunction(DataView.prototype[SETTER]); NATIVE && assert.arity(DataView.prototype[SETTER], 2); assert.same(new DataView(new ArrayBuffer(8))[SETTER](0, 0), undefined, 'void'); }); } core-js-3.33.2/tests/unit-global/es.date.get-year.js000066400000000000000000000005251451776221300221320ustar00rootroot00000000000000QUnit.test('Date#getYear', assert => { const { getYear } = Date.prototype; assert.isFunction(getYear); assert.arity(getYear, 0); assert.name(getYear, 'getYear'); assert.looksNative(getYear); assert.nonEnumerable(Date.prototype, 'getYear'); const date = new Date(); assert.same(date.getYear(), date.getFullYear() - 1900); }); core-js-3.33.2/tests/unit-global/es.date.now.js000066400000000000000000000005361451776221300212220ustar00rootroot00000000000000QUnit.test('Date.now', assert => { const { now } = Date; assert.isFunction(now); assert.arity(now, 0); assert.name(now, 'now'); assert.looksNative(now); assert.nonEnumerable(Date, 'now'); // eslint-disable-next-line unicorn/prefer-date-now -- required for testing assert.epsilon(+new Date(), now(), 10, 'Date.now() ~ +new Date'); }); core-js-3.33.2/tests/unit-global/es.date.set-year.js000066400000000000000000000005271451776221300221500ustar00rootroot00000000000000QUnit.test('Date#setYear', assert => { const { setYear } = Date.prototype; assert.isFunction(setYear); assert.arity(setYear, 1); assert.name(setYear, 'setYear'); assert.looksNative(setYear); assert.nonEnumerable(Date.prototype, 'setYear'); const date = new Date(); date.setYear(1); assert.same(date.getFullYear(), 1901); }); core-js-3.33.2/tests/unit-global/es.date.to-gmt-string.js000066400000000000000000000007361451776221300231340ustar00rootroot00000000000000QUnit.test('Date#toGMTString', assert => { const { toGMTString } = Date.prototype; assert.isFunction(toGMTString); assert.arity(toGMTString, 0); // assert.name(toGMTString, 'toUTCString'); // at least old WebKit assert.looksNative(toGMTString); assert.nonEnumerable(Date.prototype, 'toGMTString'); // assert.same(toGMTString, Date.prototype.toUTCString); // at least old WebKit const date = new Date(); assert.same(date.toGMTString(), date.toUTCString()); }); core-js-3.33.2/tests/unit-global/es.date.to-iso-string.js000066400000000000000000000017221451776221300231330ustar00rootroot00000000000000QUnit.test('Date#toISOString', assert => { const { toISOString } = Date.prototype; assert.isFunction(toISOString); assert.arity(toISOString, 0); assert.name(toISOString, 'toISOString'); assert.looksNative(toISOString); assert.nonEnumerable(Date.prototype, 'toISOString'); assert.same(new Date(0).toISOString(), '1970-01-01T00:00:00.000Z'); assert.same(new Date(1e12 + 1).toISOString(), '2001-09-09T01:46:40.001Z'); assert.same(new Date(-5e13 - 1).toISOString(), '0385-07-25T07:06:39.999Z'); const future = new Date(1e15 + 1).toISOString(); const properFuture = future === '+033658-09-27T01:46:40.001Z' || future === '33658-09-27T01:46:40.001Z'; assert.true(properFuture); const prehistoric = new Date(-1e15 + 1).toISOString(); const properPrehistoric = prehistoric === '-029719-04-05T22:13:20.001Z' || prehistoric === '-29719-04-05T22:13:20.001Z'; assert.true(properPrehistoric); assert.throws(() => new Date(NaN).toISOString(), RangeError); }); core-js-3.33.2/tests/unit-global/es.date.to-json.js000066400000000000000000000007461451776221300220130ustar00rootroot00000000000000QUnit.test('Date#toJSON', assert => { const { toJSON } = Date.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 1); assert.name(toJSON, 'toJSON'); assert.looksNative(toJSON); assert.nonEnumerable(Date.prototype, 'toJSON'); const date = new Date(); assert.same(date.toJSON(), date.toISOString(), 'base'); assert.same(new Date(NaN).toJSON(), null, 'not finite'); assert.same(toJSON.call({ toISOString() { return 42; }, }), 42, 'generic'); }); core-js-3.33.2/tests/unit-global/es.date.to-primitive.js000066400000000000000000000023721451776221300230470ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Date#@@toPrimitive', assert => { const toPrimitive = Date.prototype[Symbol.toPrimitive]; assert.isFunction(toPrimitive); assert.arity(toPrimitive, 1); assert.nonEnumerable(Date.prototype, Symbol.toPrimitive); const date = new Date(); assert.same(date[Symbol.toPrimitive]('string'), date.toString(), 'generic, hint "string"'); assert.same(date[Symbol.toPrimitive]('number'), +date, 'generic, hint "number"'); assert.same(date[Symbol.toPrimitive]('default'), date.toString(), 'generic, hint "default"'); assert.same(toPrimitive.call(Object(2), 'string'), '2', 'generic, hint "string"'); assert.same(toPrimitive.call(Object(2), 'number'), 2, 'generic, hint "number"'); assert.same(toPrimitive.call(Object(2), 'default'), '2', 'generic, hint "default"'); let data = [undefined, '', 'foo', { toString() { return 'string'; } }]; for (const value of data) { assert.throws(() => new Date()[Symbol.toPrimitive](value), TypeError, `throws on ${ value } as a hint`); } if (STRICT) { data = [1, false, 'string', null, undefined]; for (const value of data) { assert.throws(() => toPrimitive.call(value, 'string'), TypeError, `throws on ${ value } as \`this\``); } } }); core-js-3.33.2/tests/unit-global/es.date.to-string.js000066400000000000000000000004761451776221300223500ustar00rootroot00000000000000QUnit.test('Date#toString', assert => { const { toString } = Date.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(Date.prototype, 'toString'); assert.same(String(new Date(NaN)), 'Invalid Date'); }); core-js-3.33.2/tests/unit-global/es.error.cause.js000066400000000000000000000050711451776221300217320ustar00rootroot00000000000000import { GLOBAL, PROTO } from '../helpers/constants.js'; const { create } = Object; function runErrorTestCase($Error, ERROR_NAME) { QUnit.test(`${ ERROR_NAME } constructor with 'cause' param`, assert => { assert.isFunction($Error); assert.arity($Error, 1); assert.name($Error, ERROR_NAME); assert.looksNative($Error); if (PROTO && $Error !== Error) { // eslint-disable-next-line no-prototype-builtins -- safe assert.true(Error.isPrototypeOf($Error), 'constructor has `Error` in the prototype chain'); } assert.same($Error.prototype.constructor, $Error, 'prototype constructor'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false($Error.prototype.hasOwnProperty('cause'), 'prototype has not cause'); assert.true($Error(1) instanceof $Error, 'no cause, without new'); assert.true(new $Error(1) instanceof $Error, 'no cause, with new'); assert.true($Error(1, {}) instanceof $Error, 'with options, without new'); assert.true(new $Error(1, {}) instanceof $Error, 'with options, with new'); assert.true($Error(1, 'foo') instanceof $Error, 'non-object options, without new'); assert.true(new $Error(1, 'foo') instanceof $Error, 'non-object options, with new'); assert.same($Error(1, { cause: 7 }).cause, 7, 'cause, without new'); assert.same(new $Error(1, { cause: 7 }).cause, 7, 'cause, with new'); assert.same($Error(1, create({ cause: 7 })).cause, 7, 'prototype cause, without new'); assert.same(new $Error(1, create({ cause: 7 })).cause, 7, 'prototype cause, with new'); let error = $Error(1, { cause: 7 }); assert.same(error.name, ERROR_NAME, 'instance name'); assert.same(error.message, '1', 'instance message'); assert.same(error.cause, 7, 'instance cause'); // eslint-disable-next-line no-prototype-builtins -- safe assert.true(error.hasOwnProperty('cause'), 'cause is own'); error = $Error(); assert.same(error.message, '', 'default instance message'); assert.same(error.cause, undefined, 'default instance cause undefined'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(error.hasOwnProperty('cause'), 'default instance cause missed'); }); } for (const ERROR_NAME of ['Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError']) { runErrorTestCase(GLOBAL[ERROR_NAME], ERROR_NAME); } if (GLOBAL.WebAssembly) for (const ERROR_NAME of ['CompileError', 'LinkError', 'RuntimeError']) { if (GLOBAL.WebAssembly[ERROR_NAME]) runErrorTestCase(GLOBAL.WebAssembly[ERROR_NAME], ERROR_NAME); } core-js-3.33.2/tests/unit-global/es.error.to-string.js000066400000000000000000000024151451776221300225570ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Error#toString', assert => { const { toString } = Error.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(Error.prototype, 'toString'); assert.same(String(new Error('something')), 'Error: something'); assert.same(String(new TypeError('something')), 'TypeError: something'); assert.same(String(new Error()), 'Error'); assert.same(toString.call({}), 'Error'); assert.same(toString.call({ name: 'foo' }), 'foo'); assert.same(toString.call({ message: 'bar' }), 'Error: bar'); assert.same(toString.call({ name: '', message: 'bar' }), 'bar'); assert.same(toString.call({ name: 'foo', message: 'bar' }), 'foo: bar'); assert.same(toString.call({ name: 1, message: 2 }), '1: 2'); if (STRICT) { assert.throws(() => toString.call(7)); assert.throws(() => toString.call('a')); assert.throws(() => toString.call(false)); assert.throws(() => toString.call(null)); assert.throws(() => toString.call(undefined)); } // assert.throws(() => toString.call({ name: Symbol() }), 'throws on symbol #1'); // assert.throws(() => toString.call({ name: Symbol() }), 'throws on symbol #2'); }); core-js-3.33.2/tests/unit-global/es.escape.js000066400000000000000000000006601451776221300207410ustar00rootroot00000000000000QUnit.test('escape', assert => { assert.isFunction(escape); assert.name(escape, 'escape'); assert.arity(escape, 1); assert.looksNative(escape); assert.same(escape('!q2ф'), '%21q2%u0444'); assert.same(escape(null), 'null'); assert.same(escape(undefined), 'undefined'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => unescape(Symbol('escape test')), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.function.bind.js000066400000000000000000000016131451776221300222400ustar00rootroot00000000000000QUnit.test('Function#bind', assert => { const { bind } = Function.prototype; assert.isFunction(bind); assert.arity(bind, 1); assert.name(bind, 'bind'); assert.looksNative(bind); assert.nonEnumerable(Function.prototype, 'bind'); assert.same(function () { return this.a; }.bind({ a: 42 })(), 42); assert.same(new (function () { /* empty */ })().a, undefined); function A(a, b) { this.a = a; this.b = b; } const instance = new (A.bind(null, 1))(2); assert.true(instance instanceof A); assert.same(instance.a, 1); assert.same(instance.b, 2); assert.same((it => it).bind(null, 42)(), 42); const regExpTest = RegExp.prototype.test.bind(/a/); assert.true(regExpTest('a')); const Date2017 = Date.bind(null, 2017); const date = new Date2017(11); assert.true(date instanceof Date); assert.same(date.getFullYear(), 2017); assert.same(date.getMonth(), 11); }); core-js-3.33.2/tests/unit-global/es.function.has-instance.js000066400000000000000000000004441451776221300237020ustar00rootroot00000000000000QUnit.test('Function#@@hasInstance', assert => { assert.true(Symbol.hasInstance in Function.prototype); assert.nonEnumerable(Function.prototype, Symbol.hasInstance); assert.true(Function[Symbol.hasInstance](() => { /* empty */ })); assert.false(Function[Symbol.hasInstance]({})); }); core-js-3.33.2/tests/unit-global/es.function.name.js000066400000000000000000000023101451776221300222370ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('Function#name', assert => { assert.true('name' in Function.prototype); assert.nonEnumerable(Function.prototype, 'name'); function foo() { /* empty */ } assert.same(foo.name, 'foo'); assert.same(function () { /* empty */ }.name, ''); if (Object.freeze) { assert.same(Object.freeze(() => { /* empty */ }).name, ''); } function bar() { /* empty */ } bar.toString = function () { throw new Error(); }; assert.notThrows(() => bar.name === 'bar', 'works with redefined `.toString`'); const baz = Object(() => { /* empty */ }); baz.toString = function () { return ''; }; assert.same(baz.name, ''); assert.same(function /* multi-line comment */() { /* empty */ }.name, ''); function /* multi-line comment */ foobar() { /* empty */ } assert.same(foobar.name, 'foobar'); function // simple-line comment foobaz() { /* empty */ } assert.same(foobaz.name, 'foobaz'); function // simple-line comment /* multi-line comment */quux/* multi-line comment */() { /* empty */ } assert.same(quux.name, 'quux'); }); } core-js-3.33.2/tests/unit-global/es.global-this.js000066400000000000000000000002371451776221300217060ustar00rootroot00000000000000QUnit.test('globalThis', assert => { assert.same(globalThis, Object(globalThis), 'is object'); assert.same(globalThis.Math, Math, 'contains globals'); }); core-js-3.33.2/tests/unit-global/es.json.stringify.js000066400000000000000000000533141451776221300224730ustar00rootroot00000000000000// Some tests adopted from Test262 project and governed by the BSD license. // Copyright (c) 2012 Ecma International. All rights reserved. /* eslint-disable es/no-bigint,unicorn/no-hex-escape -- testing */ import { DESCRIPTORS, GLOBAL } from '../helpers/constants.js'; if (GLOBAL.JSON?.stringify) { QUnit.test('JSON.stringify', assert => { const { stringify } = JSON; const { defineProperty, keys, values } = Object; assert.isFunction(stringify); assert.arity(stringify, 3); assert.name(stringify, 'stringify'); assert.looksNative(stringify); assert.same(stringify({ a: 1, b: 2 }, []), '{}', 'replacer-array-empty-1'); assert.same(stringify({ a: 1, b: { c: 2 } }, []), '{}', 'replacer-array-empty-2'); assert.same(stringify([1, { a: 2 }], []), '[1,{}]', 'replacer-array-empty-3'); const num1 = new Number(10); num1.toString = () => 'toString'; num1.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify({ 10: 1, toString: 2, valueOf: 3, }, [num1]), '{"toString":2}', 'replacer-array-number-object'); const obj1 = { 0: 0, 1: 1, '-4': 2, 0.3: 3, '-Infinity': 4, NaN: 5, }; assert.same(stringify(obj1, [ -0, 1, -4, 0.3, -Infinity, NaN, ]), stringify(obj1), 'replacer-array-number'); const str1 = new String('str'); str1.toString = () => 'toString'; str1.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify({ str: 1, toString: 2, valueOf: 3, }, [str1]), '{"toString":2}', 'replacer-array-string-object'); assert.same(stringify({ undefined: 1 }, [undefined]), '{}', 'replacer-array-undefined-1'); // eslint-disable-next-line no-sparse-arrays -- testing assert.same(stringify({ key: 1, undefined: 2 }, [,,,]), '{}', 'replacer-array-undefined-2'); const sparse = Array(3); sparse[1] = 'key'; assert.same(stringify({ undefined: 1, key: 2 }, sparse), '{"key":2}', 'replacer-array-undefined-3'); assert.throws(() => stringify({}, () => { throw new EvalError('should not be called'); }), EvalError, 'replacer-function-abrupt'); const calls = []; const b1 = [1, 2]; const b2 = { c1: true, c2: false }; const a1 = { b1, b2: { toJSON() { return b2; }, }, }; const obj2 = { a1, a2: 'a2' }; assert.same(stringify(obj2, function (key, value) { if (key !== '') calls.push([this, key, value]); return value; }), stringify(obj2), 'replacer-function-arguments-1'); assert.arrayEqual(calls[0], [obj2, 'a1', a1], 'replacer-function-arguments-2'); assert.arrayEqual(calls[1], [a1, 'b1', b1], 'replacer-function-arguments-3'); assert.arrayEqual(calls[2], [b1, '0', 1], 'replacer-function-arguments-4'); assert.arrayEqual(calls[3], [b1, '1', 2], 'replacer-function-arguments-5'); assert.arrayEqual(calls[4], [a1, 'b2', b2], 'replacer-function-arguments-6'); assert.arrayEqual(calls[5], [b2, 'c1', true], 'replacer-function-arguments-7'); assert.arrayEqual(calls[6], [b2, 'c2', false], 'replacer-function-arguments-8'); assert.arrayEqual(calls[7], [obj2, 'a2', 'a2'], 'replacer-function-arguments-9'); const circular1 = [{}]; assert.throws(() => stringify(circular1, () => circular1), TypeError, 'replacer-function-array-circular'); const direct1 = { prop: {} }; assert.throws(() => stringify(direct1, () => direct1), TypeError, 'replacer-function-object-circular-1'); const indirect1 = { p1: { p2: {} } }; assert.throws(() => stringify(indirect1, (key, value) => key === 'p2' ? indirect1 : value), TypeError, 'replacer-function-object-circular-2'); assert.same(stringify(1, () => { /* empty */ }), undefined, 'replacer-function-result-undefined-1'); assert.same(stringify([1], () => { /* empty */ }), undefined, 'replacer-function-result-undefined-2'); assert.same(stringify({ prop: 1 }, () => { /* empty */ }), undefined, 'replacer-function-result-undefined-3'); assert.same(stringify([1], (key, value) => value === 1 ? undefined : value), '[null]', 'replacer-function-result-undefined-4'); assert.same(stringify({ prop: 1 }, (key, value) => value === 1 ? undefined : value), '{}', 'replacer-function-result-undefined-5'); assert.same(stringify({ a: { b: [1] } }, (key, value) => value === 1 ? undefined : value), '{"a":{"b":[null]}}', 'replacer-function-result-undefined-6'); assert.same(stringify(null, (key, value) => { assert.same(value, null); switch (key) { case '': return { a1: null, a2: null }; case 'a1': return { b1: null, b2: null }; case 'a2': return 'a2'; case 'b1': return [null, null]; case 'b2': return { c1: null, c2: null }; case '0': return 1; case '1': return 2; case 'c1': return true; case 'c2': return false; } throw new EvalError('unreachable'); }), stringify({ a1: { b1: [1, 2], b2: { c1: true, c2: false, }, }, a2: 'a2', }), 'replacer-function-result'); assert.same(stringify({ toJSON() { return 'toJSON'; }, }, (_key, value) => `${ value }|replacer`), '"toJSON|replacer"', 'replacer-function-tojson-1'); assert.same(stringify({ toJSON() { return { calls: 'toJSON' }; }, }, (_key, value) => { if (value && value.calls) value.calls += '|replacer'; return value; }), '{"calls":"toJSON|replacer"}', 'replacer-function-tojson-2'); const obj4 = { key: [1] }; const json1 = '{"key":[1]}'; assert.same(stringify(obj4, {}), json1, 'replacer-wrong-type-1'); assert.same(stringify(obj4, new String('str')), json1, 'replacer-wrong-type-2'); assert.same(stringify(obj4, new Number(6.1)), json1, 'replacer-wrong-type-3'); assert.same(stringify(obj4, null), json1, 'replacer-wrong-type-4'); assert.same(stringify(obj4, ''), json1, 'replacer-wrong-type-5'); assert.same(stringify(obj4, 0), json1, 'replacer-wrong-type-6'); assert.same(stringify(obj4, Symbol('stringify replacer test')), json1, 'replacer-wrong-type-7'); assert.same(stringify(obj4, true), json1, 'replacer-wrong-type-8'); const obj5 = { a1: { b1: [1, 2, 3, 4], b2: { c1: 1, c2: 2, }, }, a2: 'a2', }; assert.same(stringify(obj5, null, -1.99999), stringify(obj5, null, -1), 'space-number-float-1'); assert.same(stringify(obj5, null, new Number(5.11111)), stringify(obj5, null, 5), 'space-number-float-2'); assert.same(stringify(obj5, null, 6.99999), stringify(obj5, null, 6), 'space-number-float-3'); assert.same(stringify(obj5, null, new Number(1)), stringify(obj5, null, 1), 'space-number-object-1'); const num2 = new Number(1); num2.toString = () => { throw new EvalError('should not be called'); }; num2.valueOf = () => 3; assert.same(stringify(obj5, null, num2), stringify(obj5, null, 3), 'space-number-object-2'); const abrupt1 = new Number(4); abrupt1.toString = () => { throw new EvalError('t262'); }; abrupt1.valueOf = () => { throw new EvalError('t262'); }; assert.throws(() => stringify(obj5, null, abrupt1), EvalError, 'space-number-object-3'); assert.same(stringify(obj5, null, new Number(-5)), stringify(obj5, null, 0), 'space-number-range-1'); assert.same(stringify(obj5, null, 10), stringify(obj5, null, 100), 'space-number-range-2'); assert.same(stringify(obj5, null, 0), stringify(obj5, null, ''), 'space-number-1'); assert.same(stringify(obj5, null, 4), stringify(obj5, null, ' '), 'space-number-2'); assert.same(stringify(obj5, null, new String('xxx')), stringify(obj5, null, 'xxx'), 'space-string-object-1'); const str2 = new String('xxx'); str2.toString = () => '---'; str2.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify(obj5, null, str2), stringify(obj5, null, '---'), 'space-string-object-2'); const abrupt2 = new String('xxx'); abrupt2.toString = () => { throw new EvalError('t262'); }; abrupt2.valueOf = () => { throw new EvalError('t262'); }; assert.throws(() => stringify(obj5, null, abrupt2), EvalError, 'space-string-object-3'); assert.same(stringify(obj5, null, '0123456789xxxxxxxxx'), stringify(obj5, null, '0123456789'), 'space-string-range'); assert.same(stringify(obj5, null, ''), stringify(obj5), 'space-string-1'); assert.same(stringify(obj5, null, ' '), `{ "a1": { "b1": [ 1, 2, 3, 4 ], "b2": { "c1": 1, "c2": 2 } }, "a2": "a2" }`, 'space-string-2'); assert.same(stringify(obj5), stringify(obj5, null, null), 'space-wrong-type-1'); assert.same(stringify(obj5), stringify(obj5, null, true), 'space-wrong-type-2'); assert.same(stringify(obj5), stringify(obj5, null, new Boolean(false)), 'space-wrong-type-3'); assert.same(stringify(obj5), stringify(obj5, null, Symbol('stringify space test')), 'space-wrong-type-4'); assert.same(stringify(obj5), stringify(obj5, null, {}), 'space-wrong-type-5'); const direct2 = []; direct2.push(direct2); assert.throws(() => stringify(direct2), TypeError, 'value-array-circular-1'); const indirect2 = []; indirect2.push([[indirect2]]); assert.throws(() => stringify(indirect2), TypeError, 'value-array-circular-2'); if (typeof BigInt == 'function') { assert.same(stringify(BigInt(0), (k, v) => typeof v === 'bigint' ? 'bigint' : v), '"bigint"', 'value-bigint-replacer-1'); assert.same(stringify({ x: BigInt(0) }, (k, v) => typeof v === 'bigint' ? 'bigint' : v), '{"x":"bigint"}', 'value-bigint-replacer-2'); assert.throws(() => stringify(BigInt(0)), TypeError, 'value-bigint-1'); assert.throws(() => stringify(Object(BigInt(0))), TypeError, 'value-bigint-2'); assert.throws(() => stringify({ x: BigInt(0) }), TypeError, 'value-bigint-3'); } assert.same(stringify(new Boolean(true)), 'true', 'value-boolean-object-1'); assert.same(stringify({ toJSON() { return { key: new Boolean(false) }; }, }), '{"key":false}', 'value-boolean-object-2'); assert.same(stringify([1], (k, v) => v === 1 ? new Boolean(true) : v), '[true]', 'value-boolean-object-3'); assert.same(stringify(() => { /* empty */ }), undefined, 'value-function-1'); assert.same(stringify([() => { /* empty */ }]), '[null]', 'value-function-2'); assert.same(stringify({ key() { /* empty */ } }), '{}', 'value-function-3'); assert.same(stringify(-0), '0', 'value-number-negative-zero-1'); assert.same(stringify(['-0', 0, -0]), '["-0",0,0]', 'value-number-negative-zero-2'); assert.same(stringify({ key: -0 }), '{"key":0}', 'value-number-negative-zero-3'); assert.same(stringify(Infinity), 'null', 'value-number-non-finite-1'); assert.same(stringify({ key: -Infinity }), '{"key":null}', 'value-number-non-finite-2'); assert.same(stringify([NaN]), '[null]', 'value-number-non-finite-3'); assert.same(stringify(new Number(8.5)), '8.5', 'value-number-object-1'); assert.same(stringify(['str'], (key, value) => { if (value === 'str') { const num = new Number(42); num.toString = () => { throw new EvalError('should not be called'); }; num.valueOf = () => 2; return num; } return value; }), '[2]', 'value-number-object-2'); assert.throws(() => stringify({ key: { toJSON() { const num = new Number(3.14); num.toString = () => { throw new EvalError('t262'); }; num.valueOf = () => { throw new EvalError('t262'); }; return num; }, }, }), EvalError, 'value-number-object-3'); const direct3 = { prop: null }; direct3.prop = direct3; assert.throws(() => stringify(direct3), TypeError, 'value-object-circular-1'); const indirect3 = { p1: { p2: {} } }; indirect3.p1.p2.p3 = indirect3; assert.throws(() => stringify(indirect3), TypeError, 'value-object-circular-2'); assert.same(stringify(null), 'null', 'null'); assert.same(stringify(true), 'true', 'true'); assert.same(stringify(false), 'false', 'false'); assert.same(stringify('str'), '"str"', '"str"'); assert.same(stringify(123), '123', '123'); assert.same(stringify(undefined), undefined, 'undefined'); const charToJson = { '"': '\\"', '\\': '\\\\', '\x00': '\\u0000', '\x01': '\\u0001', '\x02': '\\u0002', '\x03': '\\u0003', '\x04': '\\u0004', '\x05': '\\u0005', '\x06': '\\u0006', '\x07': '\\u0007', '\x08': '\\b', '\x09': '\\t', '\x0A': '\\n', '\x0B': '\\u000b', '\x0C': '\\f', '\x0D': '\\r', '\x0E': '\\u000e', '\x0F': '\\u000f', '\x10': '\\u0010', '\x11': '\\u0011', '\x12': '\\u0012', '\x13': '\\u0013', '\x14': '\\u0014', '\x15': '\\u0015', '\x16': '\\u0016', '\x17': '\\u0017', '\x18': '\\u0018', '\x19': '\\u0019', '\x1A': '\\u001a', '\x1B': '\\u001b', '\x1C': '\\u001c', '\x1D': '\\u001d', '\x1E': '\\u001e', '\x1F': '\\u001f', }; const chars = keys(charToJson).join(''); const charsReversed = keys(charToJson).reverse().join(''); const jsonChars = values(charToJson).join(''); const jsonCharsReversed = values(charToJson).reverse().join(''); const json = stringify({ [`name${ chars }${ charsReversed }`]: `${ charsReversed }${ chars }value` }); for (const chr in charToJson) { const count = json.split(charToJson[chr]).length - 1; assert.same(count, 4, `Every ASCII 0x${ chr.charCodeAt(0).toString(16) } serializes to ${ charToJson[chr] }`); } assert.same( json, `{"name${ jsonChars }${ jsonCharsReversed }":"${ jsonCharsReversed }${ jsonChars }value"}`, 'JSON.stringify(objectUsingControlCharacters)', ); assert.same(stringify('\uD834'), '"\\ud834"', 'JSON.stringify("\\uD834")'); assert.same(stringify('\uDF06'), '"\\udf06"', 'JSON.stringify("\\uDF06")'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'JSON.stringify("\\uD834\\uDF06")'); assert.same(stringify('\uD834\uD834\uDF06\uD834'), '"\\ud834𝌆\\ud834"', 'JSON.stringify("\\uD834\\uD834\\uDF06\\uD834")'); assert.same(stringify('\uD834\uD834\uDF06\uDF06'), '"\\ud834𝌆\\udf06"', 'JSON.stringify("\\uD834\\uD834\\uDF06\\uDF06")'); assert.same(stringify('\uDF06\uD834\uDF06\uD834'), '"\\udf06𝌆\\ud834"', 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uD834")'); assert.same(stringify('\uDF06\uD834\uDF06\uDF06'), '"\\udf06𝌆\\udf06"', 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uDF06")'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'JSON.stringify("\\uDF06\\uD834")'); assert.same(stringify('\uD834\uDF06\uD834\uD834'), '"𝌆\\ud834\\ud834"', 'JSON.stringify("\\uD834\\uDF06\\uD834\\uD834")'); assert.same(stringify('\uD834\uDF06\uD834\uDF06'), '"𝌆𝌆"', 'JSON.stringify("\\uD834\\uDF06\\uD834\\uDF06")'); assert.same(stringify('\uDF06\uDF06\uD834\uD834'), '"\\udf06\\udf06\\ud834\\ud834"', 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uD834")'); assert.same(stringify('\uDF06\uDF06\uD834\uDF06'), '"\\udf06\\udf06𝌆"', 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uDF06")'); assert.same(stringify(new String('str')), '"str"', 'value-string-object-1'); assert.same(stringify({ key: { toJSON() { const str = new String('str'); str.toString = () => 'toString'; str.valueOf = () => { throw new EvalError('should not be called'); }; return str; }, }, }), '{"key":"toString"}', 'value-string-object-2'); assert.throws(() => stringify([true], (key, value) => { if (value === true) { const str = new String('str'); str.toString = () => { throw new EvalError('t262'); }; str.valueOf = () => { throw new EvalError('t262'); }; return str; } return value; }), 'value-string-object-3'); assert.throws(() => stringify({ toJSON() { throw new EvalError('t262'); }, }), EvalError, 'value-tojson-abrupt-1'); let callCount = 0; let $this, $key; const obj6 = { toJSON(key) { callCount += 1; $this = this; $key = key; }, }; assert.same(stringify(obj6), undefined, 'value-tojson-arguments-1'); assert.same(callCount, 1, 'value-tojson-arguments-2'); assert.same($this, obj6, 'value-tojson-arguments-3'); assert.same($key, '', 'value-tojson-arguments-4'); assert.same(stringify([1, obj6, 3]), '[1,null,3]', 'value-tojson-arguments-5'); assert.same(callCount, 2, 'value-tojson-arguments-6'); assert.same($this, obj6, 'value-tojson-arguments-7'); // some old implementations (like WebKit) could pass numbers as keys // assert.same($key, '1', 'value-tojson-arguments-8'); assert.same(stringify({ key: obj6 }), '{}', 'value-tojson-arguments-9'); assert.same(callCount, 3, 'value-tojson-arguments-10'); assert.same($this, obj6, 'value-tojson-arguments-11'); assert.same($key, 'key', 'value-tojson-arguments-12'); const arr1 = []; const circular2 = [arr1]; arr1.toJSON = () => circular2; assert.throws(() => stringify(circular2), TypeError, 'value-tojson-array-circular'); assert.same(stringify({ toJSON: null }), '{"toJSON":null}', 'value-tojson-not-function-1'); assert.same(stringify({ toJSON: false }), '{"toJSON":false}', 'value-tojson-not-function-2'); assert.same(stringify({ toJSON: [] }), '{"toJSON":[]}', 'value-tojson-not-function-3'); assert.same(stringify({ toJSON: /re/ }), '{"toJSON":{}}', 'value-tojson-not-function-4'); const obj7 = {}; const circular3 = { prop: obj7 }; obj7.toJSON = () => circular3; assert.throws(() => stringify(circular3), TypeError, 'value-tojson-object-circular'); assert.same(stringify({ toJSON() { return [false]; } }), '[false]', 'value-tojson-result-1'); const arr2 = [true]; arr2.toJSON = () => { /* empty */ }; assert.same(stringify(arr2), undefined, 'value-tojson-result-2'); const str3 = new String('str'); str3.toJSON = () => null; assert.same(stringify({ key: str3 }), '{"key":null}', 'value-tojson-result-3'); const num3 = new Number(14); num3.toJSON = () => ({ key: 7 }); assert.same(stringify([num3]), '[{"key":7}]', 'value-tojson-result-4'); if (DESCRIPTORS) { // This getter will be triggered during enumeration, but the property it adds should not be enumerated. /* IE issue const o = defineProperty({ p1: 'p1', p2: 'p2', p3: 'p3', }, 'add', { enumerable: true, get() { o.extra = 'extra'; return 'add'; }, }); o.p4 = 'p4'; o[2] = '2'; o[0] = '0'; o[1] = '1'; delete o.p1; delete o.p3; o.p1 = 'p1'; assert.same(stringify(o), '{"0":"0","1":"1","2":"2","p2":"p2","add":"add","p4":"p4","p1":"p1"}', 'property-order'); */ let getCalls = 0; assert.same(stringify(defineProperty({}, 'key', { enumerable: true, get() { getCalls += 1; return true; }, }), ['key', 'key']), '{"key":true}', 'replacer-array-duplicates-1'); assert.same(getCalls, 1, 'replacer-array-duplicates-2'); /* old WebKit bug - however, fixing of this is not in priority const obj3 = defineProperty({}, 'a', { enumerable: true, get() { delete this.b; return 1; }, }); obj3.b = 2; assert.same(stringify(obj3, (key, value) => { if (key === 'b') { assert.same(value, undefined, 'replacer-function-object-deleted-property-1'); return ''; } return value; }), '{"a":1,"b":""}', 'replacer-function-object-deleted-property-2'); */ assert.throws(() => stringify({ key: defineProperty(Array(1), '0', { get() { throw new EvalError('t262'); }, }) }), EvalError, 'value-array-abrupt'); assert.throws(() => stringify(defineProperty({}, 'key', { enumerable: true, get() { throw new EvalError('t262'); }, })), EvalError, 'value-object-abrupt'); assert.throws(() => stringify(defineProperty({}, 'toJSON', { get() { throw new EvalError('t262'); }, })), EvalError, 'value-tojson-abrupt-2'); } }); QUnit.test('Symbols & JSON.stringify', assert => { const { stringify } = JSON; const symbol1 = Symbol('symbol & stringify test 1'); const symbol2 = Symbol('symbol & stringify test 2'); assert.same(stringify([ 1, symbol1, false, symbol2, {}, ]), '[1,null,false,null,{}]', 'array value'); assert.same(stringify({ symbol: symbol1, }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; object[symbol1] = 1; assert.same(stringify(object), '{"bar":2}', 'object key'); } assert.same(stringify(symbol1), undefined, 'symbol value'); if (typeof symbol1 == 'symbol') { assert.same(stringify(Object(symbol1)), '{}', 'boxed symbol'); } assert.same(stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); QUnit.test('Well‑formed JSON.stringify', assert => { const { stringify } = JSON; assert.same(stringify({ foo: 'bar' }), '{"foo":"bar"}', 'basic'); assert.same(stringify('\uDEAD'), '"\\udead"', 'r1'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'r2'); assert.same(stringify('\uDF06ab\uD834'), '"\\udf06ab\\ud834"', 'r3'); assert.same(stringify('𠮷'), '"𠮷"', 'r4'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'r5'); assert.same(stringify('\uD834\uD834\uDF06'), '"\\ud834𝌆"', 'r6'); assert.same(stringify('\uD834\uDF06\uDF06'), '"𝌆\\udf06"', 'r7'); assert.same(stringify({ '𠮷': ['\uDF06\uD834'] }), '{"𠮷":["\\udf06\\ud834"]}', 'r8'); }); } core-js-3.33.2/tests/unit-global/es.map.js000066400000000000000000000316451451776221300202650ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite -- required for testing */ import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; import { createIterable, is, nativeSubclass } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const { getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols, freeze } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('Map', assert => { assert.isFunction(Map); assert.arity(Map, 0); assert.name(Map, 'Map'); assert.looksNative(Map); assert.true('clear' in Map.prototype, 'clear in Map.prototype'); assert.true('delete' in Map.prototype, 'delete in Map.prototype'); assert.true('forEach' in Map.prototype, 'forEach in Map.prototype'); assert.true('get' in Map.prototype, 'get in Map.prototype'); assert.true('has' in Map.prototype, 'has in Map.prototype'); assert.true('set' in Map.prototype, 'set in Map.prototype'); assert.true(new Map() instanceof Map, 'new Map instanceof Map'); assert.same(new Map(createIterable([[1, 1], [2, 2], [3, 3]])).size, 3, 'Init from iterable'); assert.same(new Map([[freeze({}), 1], [2, 3]]).size, 2, 'Support frozen objects'); let done = false; try { new Map(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new Map(array); assert.true(done); const object = {}; new Map().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Map); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof Map, 'correct subclassing with native classes #2'); assert.same(new Subclass().set(1, 2).get(1), 2, 'correct subclassing with native classes #3'); } const buffer = new ArrayBuffer(8); const map = new Map([[buffer, 8]]); assert.true(map.has(buffer), 'works with ArrayBuffer keys'); }); QUnit.test('Map#clear', assert => { assert.isFunction(Map.prototype.clear); assert.arity(Map.prototype.clear, 0); assert.name(Map.prototype.clear, 'clear'); assert.looksNative(Map.prototype.clear); assert.nonEnumerable(Map.prototype, 'clear'); let map = new Map(); map.clear(); assert.same(map.size, 0); map = new Map(); map.set(1, 2); map.set(2, 3); map.set(1, 4); map.clear(); assert.same(map.size, 0); assert.false(map.has(1)); assert.false(map.has(2)); const frozen = freeze({}); map = new Map(); map.set(1, 2); map.set(frozen, 3); map.clear(); assert.same(map.size, 0, 'Support frozen objects'); assert.false(map.has(1)); assert.false(map.has(frozen)); }); QUnit.test('Map#delete', assert => { assert.isFunction(Map.prototype.delete); assert.arity(Map.prototype.delete, 1); if (NATIVE) assert.name(Map.prototype.delete, 'delete'); assert.looksNative(Map.prototype.delete); assert.nonEnumerable(Map.prototype, 'delete'); const object = {}; const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); assert.same(map.size, 5); assert.true(map.delete(NaN)); assert.same(map.size, 4); assert.false(map.delete(4)); assert.same(map.size, 4); map.delete([]); assert.same(map.size, 4); map.delete(object); assert.same(map.size, 3); const frozen = freeze({}); map.set(frozen, 42); assert.same(map.size, 4); map.delete(frozen); assert.same(map.size, 3); }); QUnit.test('Map#forEach', assert => { assert.isFunction(Map.prototype.forEach); assert.arity(Map.prototype.forEach, 1); assert.name(Map.prototype.forEach, 'forEach'); assert.looksNative(Map.prototype.forEach); assert.nonEnumerable(Map.prototype, 'forEach'); let result = {}; let count = 0; const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); map.forEach((value, key) => { count++; result[value] = key; }); assert.same(count, 5); assert.deepEqual(result, { 1: NaN, 7: 3, 5: 2, 4: 1, 9: object, }); map = new Map(); map.set('0', 9); map.set('1', 9); map.set('2', 9); map.set('3', 9); result = ''; map.forEach((value, key) => { result += key; if (key === '2') { map.delete('2'); map.delete('3'); map.delete('1'); map.set('4', 9); } }); assert.same(result, '0124'); map = new Map([['0', 1]]); result = ''; map.forEach(it => { map.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.same(result, '1'); assert.throws(() => { Map.prototype.forEach.call(new Set(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Map#get', assert => { assert.isFunction(Map.prototype.get); assert.name(Map.prototype.get, 'get'); assert.arity(Map.prototype.get, 1); assert.looksNative(Map.prototype.get); assert.nonEnumerable(Map.prototype, 'get'); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.same(map.get(NaN), 1); assert.same(map.get(4), undefined); assert.same(map.get({}), undefined); assert.same(map.get(object), object); assert.same(map.get(frozen), 42); assert.same(map.get(2), 5); }); QUnit.test('Map#has', assert => { assert.isFunction(Map.prototype.has); assert.name(Map.prototype.has, 'has'); assert.arity(Map.prototype.has, 1); assert.looksNative(Map.prototype.has); assert.nonEnumerable(Map.prototype, 'has'); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.true(map.has(NaN)); assert.true(map.has(object)); assert.true(map.has(2)); assert.true(map.has(frozen)); assert.false(map.has(4)); assert.false(map.has({})); }); QUnit.test('Map#set', assert => { assert.isFunction(Map.prototype.set); assert.name(Map.prototype.set, 'set'); assert.arity(Map.prototype.set, 2); assert.looksNative(Map.prototype.set); assert.nonEnumerable(Map.prototype, 'set'); const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(object, object); assert.same(map.size, 5); const chain = map.set(7, 2); assert.same(chain, map); map.set(7, 2); assert.same(map.size, 6); assert.same(map.get(7), 2); assert.same(map.get(NaN), 1); map.set(NaN, 42); assert.same(map.size, 6); assert.same(map.get(NaN), 42); map.set({}, 11); assert.same(map.size, 7); assert.same(map.get(object), object); map.set(object, 27); assert.same(map.size, 7); assert.same(map.get(object), 27); map = new Map(); map.set(NaN, 2); map.set(NaN, 3); map.set(NaN, 4); assert.same(map.size, 1); const frozen = freeze({}); map = new Map().set(frozen, 42); assert.same(map.get(frozen), 42); }); QUnit.test('Map#size', assert => { assert.nonEnumerable(Map.prototype, 'size'); const map = new Map(); map.set(2, 1); const { size } = map; assert.same(typeof size, 'number', 'size is number'); assert.same(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Map.prototype, 'size'); const getter = sizeDescriptor && sizeDescriptor.get; const setter = sizeDescriptor && sizeDescriptor.set; assert.same(typeof getter, 'function', 'size is getter'); assert.same(typeof setter, 'undefined', 'size is not setter'); assert.throws(() => Map.prototype.size, TypeError); } }); QUnit.test('Map & -0', assert => { let map = new Map(); map.set(-0, 1); assert.same(map.size, 1); assert.true(map.has(0)); assert.true(map.has(-0)); assert.same(map.get(0), 1); assert.same(map.get(-0), 1); map.forEach((val, key) => { assert.false(is(key, -0)); }); map.delete(-0); assert.same(map.size, 0); map = new Map([[-0, 1]]); map.forEach((val, key) => { assert.false(is(key, -0)); }); map = new Map(); map.set(4, 4); map.set(3, 3); map.set(2, 2); map.set(1, 1); map.set(0, 0); assert.true(map.has(-0)); }); QUnit.test('Map#@@toStringTag', assert => { assert.same(Map.prototype[Symbol.toStringTag], 'Map', 'Map::@@toStringTag is `Map`'); assert.same(String(new Map()), '[object Map]', 'correct stringification'); }); QUnit.test('Map Iterator', assert => { const map = new Map(); map.set('a', 1); map.set('b', 2); map.set('c', 3); map.set('d', 4); const results = []; const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.nonEnumerable(iterator, 'next'); assert.nonEnumerable(iterator, Symbol.iterator); results.push(iterator.next().value); assert.true(map.delete('a')); assert.true(map.delete('b')); assert.true(map.delete('c')); map.set('e'); results.push(iterator.next().value, iterator.next().value); assert.true(iterator.next().done); map.set('f'); assert.true(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Map#keys', assert => { assert.isFunction(Map.prototype.keys); assert.name(Map.prototype.keys, 'keys'); assert.arity(Map.prototype.keys, 0); assert.looksNative(Map.prototype.keys); assert.nonEnumerable(Map.prototype, 'keys'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'a', done: false, }); assert.deepEqual(iterator.next(), { value: 's', done: false, }); assert.deepEqual(iterator.next(), { value: 'd', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#values', assert => { assert.isFunction(Map.prototype.values); assert.name(Map.prototype.values, 'values'); assert.arity(Map.prototype.values, 0); assert.looksNative(Map.prototype.values); assert.nonEnumerable(Map.prototype, 'values'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#entries', assert => { assert.isFunction(Map.prototype.entries); assert.name(Map.prototype.entries, 'entries'); assert.arity(Map.prototype.entries, 0); assert.looksNative(Map.prototype.entries); assert.nonEnumerable(Map.prototype, 'entries'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#@@iterator', assert => { assert.isIterable(Map.prototype); assert.name(Map.prototype.entries, 'entries'); assert.arity(Map.prototype.entries, 0); assert.looksNative(Map.prototype[Symbol.iterator]); assert.same(Map.prototype[Symbol.iterator], Map.prototype.entries); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.same(String(iterator), '[object Map Iterator]'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-global/es.math.acosh.js000066400000000000000000000017241451776221300215300ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.acosh', assert => { const { acosh } = Math; assert.isFunction(acosh); assert.name(acosh, 'acosh'); assert.arity(acosh, 1); assert.looksNative(acosh); assert.nonEnumerable(Math, 'acosh'); assert.same(acosh(NaN), NaN); assert.same(acosh(0.5), NaN); assert.same(acosh(-1), NaN); assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.same(acosh(Infinity), Infinity); assert.epsilon(acosh(1234), 7.811163220849231); assert.epsilon(acosh(8.88), 2.8737631531629235); assert.epsilon(acosh(1e+160), 369.10676205960726); assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); assert.epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8); const checker = createConversionChecker(1234); assert.epsilon(acosh(checker), 7.811163220849231); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.asinh.js000066400000000000000000000016361451776221300215370ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.asinh', assert => { const { asinh } = Math; assert.isFunction(asinh); assert.name(asinh, 'asinh'); assert.arity(asinh, 1); assert.looksNative(asinh); assert.nonEnumerable(Math, 'asinh'); assert.same(asinh(NaN), NaN); assert.same(asinh(0), 0); assert.same(asinh(-0), -0); assert.same(asinh(Infinity), Infinity); assert.same(asinh(-Infinity), -Infinity); assert.epsilon(asinh(1234), 7.811163549201245); assert.epsilon(asinh(9.99), 2.997227420191335); assert.epsilon(asinh(1e150), 346.0809111296668); assert.epsilon(asinh(1e7), 16.811242831518268); assert.epsilon(asinh(-1e7), -16.811242831518268); const checker = createConversionChecker(1234); assert.epsilon(asinh(checker), 7.811163549201245); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.atanh.js000066400000000000000000000017611451776221300215270ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.atanh', assert => { const { atanh } = Math; assert.isFunction(atanh); assert.name(atanh, 'atanh'); assert.arity(atanh, 1); assert.looksNative(atanh); assert.nonEnumerable(Math, 'atanh'); assert.same(atanh(NaN), NaN); assert.same(atanh(-2), NaN); assert.same(atanh(-1.5), NaN); assert.same(atanh(2), NaN); assert.same(atanh(1.5), NaN); assert.same(atanh(-1), -Infinity); assert.same(atanh(1), Infinity); assert.same(atanh(0), 0); assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); assert.epsilon(atanh(0.5), 0.5493061443340549); assert.epsilon(atanh(-0.5), -0.5493061443340549); assert.epsilon(atanh(0.444), 0.47720201260109457); const checker = createConversionChecker(0.5); assert.epsilon(atanh(checker), 0.5493061443340549); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.cbrt.js000066400000000000000000000014021451776221300213560ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.cbrt', assert => { const { cbrt } = Math; assert.isFunction(cbrt); assert.name(cbrt, 'cbrt'); assert.arity(cbrt, 1); assert.looksNative(cbrt); assert.nonEnumerable(Math, 'cbrt'); assert.same(cbrt(NaN), NaN); assert.same(cbrt(0), 0); assert.same(cbrt(-0), -0); assert.same(cbrt(Infinity), Infinity); assert.same(cbrt(-Infinity), -Infinity); assert.same(cbrt(-8), -2); assert.same(cbrt(8), 2); assert.epsilon(cbrt(-1000), -10); assert.epsilon(cbrt(1000), 10); const checker = createConversionChecker(1000); assert.epsilon(cbrt(checker), 10); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.clz32.js000066400000000000000000000012551451776221300213670ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.clz32', assert => { const { clz32 } = Math; assert.isFunction(clz32); assert.name(clz32, 'clz32'); assert.arity(clz32, 1); assert.looksNative(clz32); assert.nonEnumerable(Math, 'clz32'); assert.same(clz32(0), 32); assert.same(clz32(1), 31); assert.same(clz32(-1), 0); assert.same(clz32(0.6), 32); assert.same(clz32(2 ** 32 - 1), 0); assert.same(clz32(2 ** 32), 32); const checker = createConversionChecker(1); assert.same(clz32(checker), 31, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.cosh.js000066400000000000000000000016621451776221300213700ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.cosh', assert => { const { cosh } = Math; assert.isFunction(cosh); assert.name(cosh, 'cosh'); assert.arity(cosh, 1); assert.looksNative(cosh); assert.nonEnumerable(Math, 'cosh'); assert.same(cosh(NaN), NaN); assert.same(cosh(0), 1); assert.same(cosh(-0), 1); assert.same(cosh(Infinity), Infinity); assert.same(cosh(-Infinity), Infinity); assert.epsilon(cosh(12), 81377.395712574, 1e-9); assert.epsilon(cosh(22), 1792456423.065796, 1e-5); assert.epsilon(cosh(-10), 11013.232920103323); assert.epsilon(cosh(-23), 4872401723.124452, 1e-5); assert.epsilon(cosh(710), 1.1169973830808557e+308, 1e+295); const checker = createConversionChecker(12); assert.epsilon(cosh(checker), 81377.395712574, 1e-9, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.expm1.js000066400000000000000000000013751451776221300214670ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.expm1', assert => { const { expm1 } = Math; assert.isFunction(expm1); assert.name(expm1, 'expm1'); assert.arity(expm1, 1); assert.looksNative(expm1); assert.nonEnumerable(Math, 'expm1'); assert.same(expm1(NaN), NaN); assert.same(expm1(0), 0); assert.same(expm1(-0), -0); assert.same(expm1(Infinity), Infinity); assert.same(expm1(-Infinity), -1); assert.epsilon(expm1(10), 22025.465794806718); assert.epsilon(expm1(-10), -0.9999546000702375); const checker = createConversionChecker(10); assert.epsilon(expm1(checker), 22025.465794806718); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.fround.js000066400000000000000000000046711451776221300217340ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; const { MAX_VALUE, MIN_VALUE } = Number; QUnit.test('Math.fround', assert => { const { fround } = Math; assert.isFunction(fround); assert.name(fround, 'fround'); assert.arity(fround, 1); assert.looksNative(fround); assert.nonEnumerable(Math, 'fround'); assert.same(fround(), NaN); assert.same(fround(undefined), NaN); assert.same(fround(NaN), NaN); assert.same(fround(null), 0); assert.same(fround(0), 0); assert.same(fround(-0), -0); assert.same(fround(MIN_VALUE), 0); assert.same(fround(-MIN_VALUE), -0); assert.same(fround(Infinity), Infinity); assert.same(fround(-Infinity), -Infinity); assert.same(fround(MAX_VALUE), Infinity); assert.same(fround(-MAX_VALUE), -Infinity); assert.same(fround(1.7976931348623157e+308), Infinity); assert.same(fround(-1.7976931348623157e+308), -Infinity); assert.same(fround(3.4028235677973366e+38), Infinity); assert.same(fround(3), 3); assert.same(fround(-3), -3); const maxFloat32 = 3.4028234663852886e+38; const minFloat32 = 1.401298464324817e-45; assert.same(fround(maxFloat32), maxFloat32); assert.same(fround(-maxFloat32), -maxFloat32); assert.same(fround(maxFloat32 + 2 ** 102), maxFloat32); assert.same(fround(minFloat32), minFloat32); assert.same(fround(-minFloat32), -minFloat32); assert.same(fround(minFloat32 / 2), 0); assert.same(fround(-minFloat32 / 2), -0); assert.same(fround(minFloat32 / 2 + 2 ** -202), minFloat32); assert.same(fround(-minFloat32 / 2 - 2 ** -202), -minFloat32); const maxSubnormal32 = 1.1754942106924411e-38; const minNormal32 = 1.1754943508222875e-38; assert.same(fround(1.1754942807573642e-38), maxSubnormal32, 'fround(1.1754942807573642e-38)'); assert.same(fround(1.1754942807573643e-38), minNormal32, 'fround(1.1754942807573643e-38)'); assert.same(fround(1.1754942807573644e-38), minNormal32, 'fround(1.1754942807573644e-38)'); assert.same(fround(-1.1754942807573642e-38), -maxSubnormal32, 'fround(-1.1754942807573642e-38)'); assert.same(fround(-1.1754942807573643e-38), -minNormal32, 'fround(-1.1754942807573643e-38)'); assert.same(fround(-1.1754942807573644e-38), -minNormal32, 'fround(-1.1754942807573644e-38)'); const checker = createConversionChecker(1.1754942807573642e-38); assert.same(fround(checker), maxSubnormal32, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.hypot.js000066400000000000000000000051151451776221300215740ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.hypot', assert => { const { hypot, sqrt } = Math; assert.isFunction(hypot); assert.name(hypot, 'hypot'); assert.arity(hypot, 2); assert.looksNative(hypot); assert.nonEnumerable(Math, 'hypot'); assert.same(hypot(), 0); assert.same(hypot(1), 1); assert.same(hypot('', 0), 0); assert.same(hypot(0, ''), 0); assert.same(hypot(Infinity, 0), Infinity, 'Infinity, 0'); assert.same(hypot(-Infinity, 0), Infinity, '-Infinity, 0'); assert.same(hypot(0, Infinity), Infinity, '0, Infinity'); assert.same(hypot(0, -Infinity), Infinity, '0, -Infinity'); assert.same(hypot(Infinity, NaN), Infinity, 'Infinity, NaN'); assert.same(hypot(NaN, -Infinity), Infinity, 'NaN, -Infinity'); assert.same(hypot(NaN, 0), NaN, 'NaN, 0'); assert.same(hypot(0, NaN), NaN, '0, NaN'); assert.same(hypot(0, -0), 0); assert.same(hypot(0, 0), 0); assert.same(hypot(-0, -0), 0); assert.same(hypot(-0, 0), 0); assert.same(hypot(0, 1), 1); assert.same(hypot(0, -1), 1); assert.same(hypot(-0, 1), 1); assert.same(hypot(-0, -1), 1); assert.same(hypot(0), 0); assert.same(hypot(1), 1); assert.same(hypot(2), 2); assert.same(hypot(0, 0, 1), 1); assert.same(hypot(0, 1, 0), 1); assert.same(hypot(1, 0, 0), 1); assert.same(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.same(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); assert.epsilon(hypot(66, 66), 93.33809511662427); assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.same(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.same(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.same(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); assert.same(hypot(-3, 4), 5); assert.same(hypot(3, -4), 5); const checker1 = createConversionChecker(2); const checker2 = createConversionChecker(3); const checker3 = createConversionChecker(4); const checker4 = createConversionChecker(5); assert.same(hypot(checker1, checker2, checker3, checker4), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5), 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.imul.js000066400000000000000000000035761451776221300214100ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.imul', assert => { const { imul } = Math; assert.isFunction(imul); assert.name(imul, 'imul'); assert.arity(imul, 2); assert.looksNative(imul); assert.nonEnumerable(Math, 'imul'); assert.same(imul(0, 0), 0); assert.same(imul(123, 456), 56088); assert.same(imul(-123, 456), -56088); assert.same(imul(123, -456), -56088); assert.same(imul(19088743, 4275878552), 602016552); assert.same(imul(false, 7), 0); assert.same(imul(7, false), 0); assert.same(imul(false, false), 0); assert.same(imul(true, 7), 7); assert.same(imul(7, true), 7); assert.same(imul(true, true), 1); assert.same(imul(undefined, 7), 0); assert.same(imul(7, undefined), 0); assert.same(imul(undefined, undefined), 0); assert.same(imul('str', 7), 0); assert.same(imul(7, 'str'), 0); assert.same(imul({}, 7), 0); assert.same(imul(7, {}), 0); assert.same(imul([], 7), 0); assert.same(imul(7, []), 0); assert.same(imul(0xFFFFFFFF, 5), -5); assert.same(imul(0xFFFFFFFE, 5), -10); assert.same(imul(2, 4), 8); assert.same(imul(-1, 8), -8); assert.same(imul(-2, -2), 4); assert.same(imul(-0, 7), 0); assert.same(imul(7, -0), 0); assert.same(imul(0.1, 7), 0); assert.same(imul(7, 0.1), 0); assert.same(imul(0.9, 7), 0); assert.same(imul(7, 0.9), 0); assert.same(imul(1.1, 7), 7); assert.same(imul(7, 1.1), 7); assert.same(imul(1.9, 7), 7); assert.same(imul(7, 1.9), 7); const checker1 = createConversionChecker(-123); const checker2 = createConversionChecker(456); assert.same(imul(checker1, checker2), -56088, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.log10.js000066400000000000000000000017571451776221300213630ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.log10', assert => { const { log10 } = Math; assert.isFunction(log10); assert.name(log10, 'log10'); assert.arity(log10, 1); assert.looksNative(log10); assert.nonEnumerable(Math, 'log10'); assert.same(log10(''), log10(0)); assert.same(log10(NaN), NaN); assert.same(log10(-1), NaN); assert.same(log10(0), -Infinity); assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); assert.epsilon(log10(0.1), -1); assert.epsilon(log10(0.5), -0.3010299956639812); assert.epsilon(log10(1.5), 0.17609125905568124); assert.epsilon(log10(5), 0.6989700043360189); assert.epsilon(log10(50), 1.6989700043360187); assert.epsilon(log10(1000), 3); const checker = createConversionChecker(0.5); assert.epsilon(log10(checker), -0.3010299956639812); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.log1p.js000066400000000000000000000014721451776221300214550ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.log1p', assert => { const { log1p } = Math; assert.isFunction(log1p); assert.name(log1p, 'log1p'); assert.arity(log1p, 1); assert.looksNative(log1p); assert.nonEnumerable(Math, 'log1p'); assert.same(log1p(''), log1p(0)); assert.same(log1p(NaN), NaN); assert.same(log1p(-2), NaN); assert.same(log1p(-1), -Infinity); assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); assert.epsilon(log1p(5), 1.791759469228055); assert.epsilon(log1p(50), 3.9318256327243257); const checker = createConversionChecker(5); assert.epsilon(log1p(checker), 1.791759469228055); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.log2.js000066400000000000000000000014671451776221300213020ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.log2', assert => { const { log2 } = Math; assert.isFunction(log2); assert.name(log2, 'log2'); assert.arity(log2, 1); assert.looksNative(log2); assert.nonEnumerable(Math, 'log2'); assert.same(log2(''), log2(0)); assert.same(log2(NaN), NaN); assert.same(log2(-1), NaN); assert.same(log2(0), -Infinity); assert.same(log2(-0), -Infinity); assert.same(log2(1), 0); assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); assert.epsilon(log2(5), 2.321928094887362); const checker = createConversionChecker(5); assert.epsilon(log2(checker), 2.321928094887362); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.sign.js000066400000000000000000000014701451776221300213710ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.sign', assert => { const { sign } = Math; assert.isFunction(sign); assert.name(sign, 'sign'); assert.arity(sign, 1); assert.looksNative(sign); assert.nonEnumerable(Math, 'sign'); assert.same(sign(NaN), NaN); assert.same(sign(), NaN); assert.same(sign(-0), -0); assert.same(sign(0), 0); assert.same(sign(Infinity), 1); assert.same(sign(-Infinity), -1); assert.same(sign(13510798882111488), 1); assert.same(sign(-13510798882111488), -1); assert.same(sign(42.5), 1); assert.same(sign(-42.5), -1); const checker = createConversionChecker(-42.5); assert.same(sign(checker), -1, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.sinh.js000066400000000000000000000014261451776221300213730ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.sinh', assert => { const { sinh } = Math; assert.isFunction(sinh); assert.name(sinh, 'sinh'); assert.arity(sinh, 1); assert.looksNative(sinh); assert.nonEnumerable(Math, 'sinh'); assert.same(sinh(NaN), NaN); assert.same(sinh(0), 0); assert.same(sinh(-0), -0); assert.same(sinh(Infinity), Infinity); assert.same(sinh(-Infinity), -Infinity); assert.epsilon(sinh(-5), -74.20321057778875); assert.epsilon(sinh(2), 3.6268604078470186); assert.same(sinh(-2e-17), -2e-17); const checker = createConversionChecker(-5); assert.epsilon(sinh(checker), -74.20321057778875); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.tanh.js000066400000000000000000000014071451776221300213630ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.tanh', assert => { const { tanh } = Math; assert.isFunction(tanh); assert.name(tanh, 'tanh'); assert.arity(tanh, 1); assert.looksNative(tanh); assert.nonEnumerable(Math, 'tanh'); assert.same(tanh(NaN), NaN); assert.same(tanh(0), 0); assert.same(tanh(-0), -0); assert.same(tanh(Infinity), 1); assert.same(tanh(90), 1); assert.epsilon(tanh(10), 0.9999999958776927); if (NATIVE) assert.same(tanh(710), 1); const checker = createConversionChecker(10); assert.epsilon(tanh(checker), 0.9999999958776927); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.math.to-string-tag.js000066400000000000000000000002041451776221300231220ustar00rootroot00000000000000QUnit.test('Math[@@toStringTag]', assert => { assert.same(Math[Symbol.toStringTag], 'Math', 'Math[@@toStringTag] is `Math`'); }); core-js-3.33.2/tests/unit-global/es.math.trunc.js000066400000000000000000000024541451776221300215670ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.trunc', assert => { const { trunc } = Math; assert.isFunction(trunc); assert.name(trunc, 'trunc'); assert.arity(trunc, 1); assert.looksNative(trunc); assert.nonEnumerable(Math, 'trunc'); assert.same(trunc(NaN), NaN, 'NaN -> NaN'); assert.same(trunc(-0), -0, '-0 -> -0'); assert.same(trunc(0), 0, '0 -> 0'); assert.same(trunc(Infinity), Infinity, 'Infinity -> Infinity'); assert.same(trunc(-Infinity), -Infinity, '-Infinity -> -Infinity'); assert.same(trunc(null), 0, 'null -> 0'); assert.same(trunc({}), NaN, '{} -> NaN'); assert.same(trunc([]), 0, '[] -> 0'); assert.same(trunc(1.01), 1, '1.01 -> 0'); assert.same(trunc(1.99), 1, '1.99 -> 0'); assert.same(trunc(-1), -1, '-1 -> -1'); assert.same(trunc(-1.99), -1, '-1.99 -> -1'); assert.same(trunc(-555.555), -555, '-555.555 -> -555'); assert.same(trunc(9007199254740992), 9007199254740992, '9007199254740992 -> 9007199254740992'); assert.same(trunc(-9007199254740992), -9007199254740992, '-9007199254740992 -> -9007199254740992'); const checker = createConversionChecker(-1.99); assert.same(trunc(checker), -1, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/es.number.constructor.js000066400000000000000000000154421451776221300233610ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants.js'; import { nativeSubclass } from '../helpers/helpers.js'; function getCheck(assert) { return function (a, b) { assert.same(Number(a), b, `Number ${ typeof a } ${ a } -> ${ b }`); const x = new Number(a); assert.same(x, Object(x), `new Number ${ typeof a } ${ a } is object`); assert.same({}.toString.call(x).slice(8, -1), 'Number', `classof new Number ${ typeof a } ${ a } is Number`); assert.same(x.valueOf(), b, `new Number(${ typeof a } ${ a }).valueOf() -> ${ b }`); }; } QUnit.test('Number constructor: regression', assert => { const check = getCheck(assert); assert.isFunction(Number); assert.arity(Number, 1); assert.name(Number, 'Number'); assert.looksNative(Number); assert.same(Number.prototype.constructor, Number); assert.same(1.0.constructor, Number); const constants = ['MAX_VALUE', 'MIN_VALUE', 'NaN', 'NEGATIVE_INFINITY', 'POSITIVE_INFINITY']; for (const constant of constants) { assert.true(constant in Number, `Number.${ constant }`); assert.nonEnumerable(Number, constant); } assert.same(Number(), 0); assert.same(new Number().valueOf(), 0); check(42, 42); check(42.42, 42.42); check(new Number(42), 42); check(new Number(42.42), 42.42); check('42', 42); check('42.42', 42.42); check('0x42', 66); check('0X42', 66); check('0xzzz', NaN); check('0x1g', NaN); check('+0x1', NaN); check('-0x1', NaN); check('+0X1', NaN); check('-0X1', NaN); check(new String('42'), 42); check(new String('42.42'), 42.42); check(new String('0x42'), 66); check(null, 0); check(undefined, NaN); check(false, 0); check(true, 1); check(new Boolean(false), 0); check(new Boolean(true), 1); check({}, NaN); check({ valueOf: '1.1', }, NaN); check({ valueOf: '1.1', toString() { return '2.2'; }, }, 2.2); check({ valueOf() { return '1.1'; }, }, 1.1); check({ valueOf() { return '1.1'; }, toString() { return '2.2'; }, }, 1.1); check({ valueOf() { return '-0x1a2b3c'; }, }, NaN); check({ toString() { return '-0x1a2b3c'; }, }, NaN); check({ valueOf() { return 42; }, }, 42); check({ valueOf() { return '42'; }, }, 42); check({ valueOf() { return null; }, }, 0); check({ toString() { return 42; }, }, 42); check({ toString() { return '42'; }, }, 42); check({ valueOf() { return 1; }, toString() { return 2; }, }, 1); check({ valueOf: 1, toString() { return 2; }, }, 2); let number = 1; assert.same(Number({ valueOf() { return ++number; }, }), 2, 'Number call valueOf only once #1'); assert.same(number, 2, 'Number call valueOf only once #2'); number = 1; assert.same(Number({ toString() { return ++number; }, }), 2, 'Number call toString only once #1'); assert.same(number, 2, 'Number call toString only once #2'); number = 1; assert.same(new Number({ valueOf() { return ++number; }, }).valueOf(), 2, 'new Number call valueOf only once #1'); assert.same(number, 2, 'new Number call valueOf only once #2'); number = 1; assert.same(new Number({ toString() { return ++number; }, }).valueOf(), 2, 'new Number call toString only once #1'); assert.same(number, 2, 'new Number call toString only once #2'); assert.throws(() => Number(Object.create(null)), TypeError, 'Number assert.throws on object w/o valueOf and toString'); assert.throws(() => Number({ valueOf: 1, toString: 2, }), TypeError, 'Number assert.throws on object then valueOf and toString are not functions'); assert.throws(() => new Number(Object.create(null)), TypeError, 'new Number assert.throws on object w/o valueOf and toString'); assert.throws(() => new Number({ valueOf: 1, toString: 2, }), TypeError, 'new Number assert.throws on object then valueOf and toString are not functions'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('Number constructor test'); assert.throws(() => Number(symbol), 'throws on symbol argument'); assert.throws(() => new Number(symbol), 'throws on symbol argument, new'); } number = new Number(42); assert.same(typeof number.constructor(number), 'number'); check(`${ WHITESPACES }42`, 42); check(`42${ WHITESPACES }`, 42); check(`${ WHITESPACES }42${ WHITESPACES }`, 42); check(`${ WHITESPACES }0x42`, 66); check(`0x42${ WHITESPACES }`, 66); check(`${ WHITESPACES }0x42${ WHITESPACES }`, 66); check(`${ WHITESPACES }0X42`, 66); check(`0X42${ WHITESPACES }`, 66); check(`${ WHITESPACES }0X42${ WHITESPACES }`, 66); if (nativeSubclass) { const Subclass = nativeSubclass(Number); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof Number, 'correct subclassing with native classes #2'); assert.same(new Subclass(1).toFixed(2), '1.00', 'correct subclassing with native classes #3'); } }); QUnit.test('Number constructor: binary', assert => { const check = getCheck(assert); check('0b1', 1); check('0B1', 1); check('0b12', NaN); check('0b234', NaN); check('0b1!', NaN); check('+0b1', NaN); check('-0b1', NaN); check(' 0b1', 1); check('0b1\n', 1); check('\n 0b1\n ', 1); check(' 0B1', 1); check('0B1\n', 1); check('\n 0B1\n ', 1); check({ valueOf() { return '0b11'; }, }, 3); check({ toString() { return '0b111'; }, }, 7); check({ valueOf() { return '0b101010'; }, }, 42); check({ toString() { return '0b101010'; }, }, 42); check(`${ WHITESPACES }0b11`, 3); check(`0b11${ WHITESPACES }`, 3); check(`${ WHITESPACES }0b11${ WHITESPACES }`, 3); check(`${ WHITESPACES }0B11`, 3); check(`0B11${ WHITESPACES }`, 3); check(`${ WHITESPACES }0B11${ WHITESPACES }`, 3); }); QUnit.test('Number constructor: octal', assert => { const check = getCheck(assert); check('0o7', 7); check('0O7', 7); check('0o18', NaN); check('0o89a', NaN); check('0o1!', NaN); check('+0o1', NaN); check('-0o1', NaN); check(' 0o1', 1); check('0o1\n', 1); check('\n 0o1\n ', 1); check(' 0O1', 1); check('0O1\n', 1); check('\n 0O1\n ', 1); check({ valueOf() { return '0o77'; }, }, 63); check({ toString() { return '0o777'; }, }, 511); check({ valueOf() { return '0o12345'; }, }, 5349); check({ toString() { return '0o12345'; }, }, 5349); check(`${ WHITESPACES }0o11`, 9); check(`0o11${ WHITESPACES }`, 9); check(`${ WHITESPACES }0o11${ WHITESPACES }`, 9); check(`${ WHITESPACES }0O11`, 9); check(`0O11${ WHITESPACES }`, 9); check(`${ WHITESPACES }0O11${ WHITESPACES }`, 9); }); core-js-3.33.2/tests/unit-global/es.number.epsilon.js000066400000000000000000000006501451776221300224400ustar00rootroot00000000000000QUnit.test('Number.EPSILON', assert => { const { EPSILON } = Number; assert.true('EPSILON' in Number, 'EPSILON in Number'); assert.nonEnumerable(Number, 'EPSILON'); assert.nonConfigurable(Number, 'EPSILON'); assert.nonWritable(Number, 'EPSILON'); assert.same(EPSILON, 2 ** -52, 'Is 2^-52'); assert.notSame(1, 1 + EPSILON, '1 is not 1 + EPSILON'); assert.same(1, 1 + EPSILON / 2, '1 is 1 + EPSILON / 2'); }); core-js-3.33.2/tests/unit-global/es.number.is-finite.js000066400000000000000000000017221451776221300226570ustar00rootroot00000000000000QUnit.test('Number.isFinite', assert => { const { isFinite } = Number; const { create } = Object; assert.isFunction(isFinite); assert.name(isFinite, 'isFinite'); assert.arity(isFinite, 1); assert.looksNative(isFinite); assert.nonEnumerable(Number, 'isFinite'); const finite = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of finite) { assert.true(isFinite(value), `isFinite ${ typeof value } ${ value }`); } const notFinite = [ NaN, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notFinite) { assert.false(isFinite(value), `not isFinite ${ typeof value } ${ value }`); } assert.false(isFinite(create(null)), 'Number.isFinite(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-global/es.number.is-integer.js000066400000000000000000000017501451776221300230370ustar00rootroot00000000000000QUnit.test('Number.isInteger', assert => { const { isInteger } = Number; const { create } = Object; assert.isFunction(isInteger); assert.name(isInteger, 'isInteger'); assert.arity(isInteger, 1); assert.looksNative(isInteger); assert.nonEnumerable(Number, 'isInteger'); const integers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of integers) { assert.true(isInteger(value), `isInteger ${ typeof value } ${ value }`); } const notIntegers = [ NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notIntegers) { assert.false(isInteger(value), `not isInteger ${ typeof value } ${ value }`); } assert.false(isInteger(create(null)), 'Number.isInteger(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-global/es.number.is-nan.js000066400000000000000000000015201451776221300221510ustar00rootroot00000000000000QUnit.test('Number.isNaN', assert => { const { isNaN } = Number; const { create } = Object; assert.isFunction(isNaN); assert.name(isNaN, 'isNaN'); assert.arity(isNaN, 1); assert.looksNative(isNaN); assert.nonEnumerable(Number, 'isNaN'); assert.true(isNaN(NaN), 'Number.isNaN NaN'); const notNaNs = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notNaNs) { assert.false(isNaN(value), `not Number.isNaN ${ typeof value } ${ value }`); } assert.false(isNaN(create(null)), 'Number.isNaN(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-global/es.number.is-safe-integer.js000066400000000000000000000022121451776221300237450ustar00rootroot00000000000000QUnit.test('Number.isSafeInteger', assert => { const { isSafeInteger } = Number; const { create } = Object; assert.isFunction(isSafeInteger); assert.name(isSafeInteger, 'isSafeInteger'); assert.arity(isSafeInteger, 1); assert.looksNative(isSafeInteger); assert.nonEnumerable(Number, 'isSafeInteger'); const safeIntegers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, 9007199254740991, -9007199254740991, ]; for (const value of safeIntegers) { assert.true(isSafeInteger(value), `isSafeInteger ${ typeof value } ${ value }`); } const notSafeIntegers = [ 9007199254740992, -9007199254740992, NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notSafeIntegers) { assert.false(isSafeInteger(value), `not isSafeInteger ${ typeof value } ${ value }`); } assert.false(isSafeInteger(create(null)), 'Number.isSafeInteger(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-global/es.number.max-safe-integer.js000066400000000000000000000005031451776221300241200ustar00rootroot00000000000000QUnit.test('Number.MAX_SAFE_INTEGER', assert => { assert.true('MAX_SAFE_INTEGER' in Number); assert.nonEnumerable(Number, 'MAX_SAFE_INTEGER'); assert.nonConfigurable(Number, 'MAX_SAFE_INTEGER'); assert.nonWritable(Number, 'MAX_SAFE_INTEGER'); assert.same(Number.MAX_SAFE_INTEGER, 2 ** 53 - 1, 'Is 2^53 - 1'); }); core-js-3.33.2/tests/unit-global/es.number.min-safe-integer.js000066400000000000000000000005071451776221300241220ustar00rootroot00000000000000QUnit.test('Number.MIN_SAFE_INTEGER', assert => { assert.true('MIN_SAFE_INTEGER' in Number); assert.nonEnumerable(Number, 'MIN_SAFE_INTEGER'); assert.nonConfigurable(Number, 'MIN_SAFE_INTEGER'); assert.nonWritable(Number, 'MIN_SAFE_INTEGER'); assert.same(Number.MIN_SAFE_INTEGER, -(2 ** 53) + 1, 'Is -2^53 + 1'); }); core-js-3.33.2/tests/unit-global/es.number.parse-float.js000066400000000000000000000020361451776221300232040ustar00rootroot00000000000000import { GLOBAL, WHITESPACES } from '../helpers/constants.js'; QUnit.test('Number.parseFloat', assert => { const { parseFloat } = Number; assert.isFunction(parseFloat); assert.name(parseFloat, 'parseFloat'); assert.arity(parseFloat, 1); assert.looksNative(parseFloat); assert.nonEnumerable(Number, 'parseFloat'); assert.same(parseFloat, GLOBAL.parseFloat); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('Number.parseFloat test'); assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.number.parse-int.js000066400000000000000000000041161451776221300226720ustar00rootroot00000000000000/* eslint-disable prefer-numeric-literals -- required for testing */ import { GLOBAL, WHITESPACES } from '../helpers/constants.js'; QUnit.test('Number.parseInt', assert => { const { parseInt } = Number; assert.isFunction(parseInt); assert.name(parseInt, 'parseInt'); assert.arity(parseInt, 2); assert.looksNative(parseInt); assert.nonEnumerable(Number, 'parseInt'); assert.same(parseInt, GLOBAL.parseInt); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('Number.parseInt test'); assert.throws(() => parseInt(symbol), 'throws on symbol argument'); assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.number.to-exponential.js000066400000000000000000000203071451776221300237360ustar00rootroot00000000000000QUnit.test('Number#toExponential', assert => { const { toExponential } = Number.prototype; assert.isFunction(toExponential); assert.name(toExponential, 'toExponential'); assert.arity(toExponential, 1); assert.looksNative(toExponential); assert.nonEnumerable(Number.prototype, 'toExponential'); assert.same(toExponential.call(0.00008, 3), '8.000e-5'); assert.same(toExponential.call(0.9, 0), '9e-1'); assert.same(toExponential.call(1.255, 2), '1.25e+0'); // Chakra Edge 14- / IE11- bug assert.same(toExponential.call(1843654265.0774949, 5), '1.84365e+9'); assert.same(toExponential.call(1000000000000000128.0, 0), '1e+18'); assert.same(toExponential.call(1), '1e+0'); assert.same(toExponential.call(1, 0), '1e+0'); assert.same(toExponential.call(1, 1), '1.0e+0'); assert.same(toExponential.call(1, 1.1), '1.0e+0'); assert.same(toExponential.call(1, 0.9), '1e+0'); assert.same(toExponential.call(1, '0'), '1e+0'); assert.same(toExponential.call(1, '1'), '1.0e+0'); assert.same(toExponential.call(1, '1.1'), '1.0e+0'); assert.same(toExponential.call(1, '0.9'), '1e+0'); assert.same(toExponential.call(1, NaN), '1e+0'); assert.same(toExponential.call(1, 'some string'), '1e+0'); assert.notThrows(() => toExponential.call(1, -0.1) === '1e+0'); assert.same(toExponential.call(new Number(1)), '1e+0'); assert.same(toExponential.call(new Number(1), 0), '1e+0'); assert.same(toExponential.call(new Number(1), 1), '1.0e+0'); assert.same(toExponential.call(new Number(1), 1.1), '1.0e+0'); assert.same(toExponential.call(new Number(1), 0.9), '1e+0'); assert.same(toExponential.call(new Number(1), '0'), '1e+0'); assert.same(toExponential.call(new Number(1), '1'), '1.0e+0'); assert.same(toExponential.call(new Number(1), '1.1'), '1.0e+0'); assert.same(toExponential.call(new Number(1), '0.9'), '1e+0'); assert.same(toExponential.call(new Number(1), NaN), '1e+0'); assert.same(toExponential.call(new Number(1), 'some string'), '1e+0'); assert.notThrows(() => toExponential.call(new Number(1), -0.1) === '1e+0'); assert.same(toExponential.call(NaN), 'NaN'); assert.same(toExponential.call(NaN, 0), 'NaN'); assert.same(toExponential.call(NaN, 1), 'NaN'); assert.same(toExponential.call(NaN, 1.1), 'NaN'); assert.same(toExponential.call(NaN, 0.9), 'NaN'); assert.same(toExponential.call(NaN, '0'), 'NaN'); assert.same(toExponential.call(NaN, '1'), 'NaN'); assert.same(toExponential.call(NaN, '1.1'), 'NaN'); assert.same(toExponential.call(NaN, '0.9'), 'NaN'); assert.same(toExponential.call(NaN, NaN), 'NaN'); assert.same(toExponential.call(NaN, 'some string'), 'NaN'); assert.notThrows(() => toExponential.call(NaN, -0.1) === 'NaN'); assert.same(toExponential.call(new Number(1e21)), '1e+21'); assert.same(toExponential.call(new Number(1e21), 0), '1e+21'); assert.same(toExponential.call(new Number(1e21), 1), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), 1.1), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), 0.9), '1e+21'); assert.same(toExponential.call(new Number(1e21), '0'), '1e+21'); assert.same(toExponential.call(new Number(1e21), '1'), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), '1.1'), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), '0.9'), '1e+21'); assert.same(toExponential.call(new Number(1e21), NaN), '1e+21'); assert.same(toExponential.call(new Number(1e21), 'some string'), '1e+21'); // somehow that randomly fails in FF16- on Linux assert.same(toExponential.call(5, 19), '5.0000000000000000000e+0', '5, 19'); // ported from tests262, the license: https://github.com/tc39/test262/blob/main/LICENSE assert.same(toExponential.call(123.456, 0), '1e+2'); assert.same(toExponential.call(123.456, 1), '1.2e+2'); assert.same(toExponential.call(123.456, 2), '1.23e+2'); assert.same(toExponential.call(123.456, 3), '1.235e+2'); assert.same(toExponential.call(123.456, 4), '1.2346e+2'); assert.same(toExponential.call(123.456, 5), '1.23456e+2'); assert.same(toExponential.call(123.456, 6), '1.234560e+2'); assert.same(toExponential.call(123.456, 7), '1.2345600e+2'); // assert.same(toExponential.call(123.456, 17), '1.23456000000000003e+2'); // assert.same(toExponential.call(123.456, 20), '1.23456000000000003070e+2'); assert.same(toExponential.call(-123.456, 0), '-1e+2'); assert.same(toExponential.call(-123.456, 1), '-1.2e+2'); assert.same(toExponential.call(-123.456, 2), '-1.23e+2'); assert.same(toExponential.call(-123.456, 3), '-1.235e+2'); assert.same(toExponential.call(-123.456, 4), '-1.2346e+2'); assert.same(toExponential.call(-123.456, 5), '-1.23456e+2'); assert.same(toExponential.call(-123.456, 6), '-1.234560e+2'); assert.same(toExponential.call(-123.456, 7), '-1.2345600e+2'); // assert.same(toExponential.call(-123.456, 17), '-1.23456000000000003e+2'); // assert.same(toExponential.call(-123.456, 20), '-1.23456000000000003070e+2'); assert.same(toExponential.call(0.0001, 0), '1e-4'); assert.same(toExponential.call(0.0001, 1), '1.0e-4'); assert.same(toExponential.call(0.0001, 2), '1.00e-4'); assert.same(toExponential.call(0.0001, 3), '1.000e-4'); assert.same(toExponential.call(0.0001, 4), '1.0000e-4'); // assert.same(toExponential.call(0.0001, 16), '1.0000000000000000e-4'); // assert.same(toExponential.call(0.0001, 17), '1.00000000000000005e-4'); // assert.same(toExponential.call(0.0001, 18), '1.000000000000000048e-4'); // assert.same(toExponential.call(0.0001, 19), '1.0000000000000000479e-4'); // assert.same(toExponential.call(0.0001, 20), '1.00000000000000004792e-4'); assert.same(toExponential.call(0.9999, 0), '1e+0'); assert.same(toExponential.call(0.9999, 1), '1.0e+0'); assert.same(toExponential.call(0.9999, 2), '1.00e+0'); assert.same(toExponential.call(0.9999, 3), '9.999e-1'); assert.same(toExponential.call(0.9999, 4), '9.9990e-1'); // assert.same(toExponential.call(0.9999, 16), '9.9990000000000001e-1'); // assert.same(toExponential.call(0.9999, 17), '9.99900000000000011e-1'); // assert.same(toExponential.call(0.9999, 18), '9.999000000000000110e-1'); // assert.same(toExponential.call(0.9999, 19), '9.9990000000000001101e-1'); // assert.same(toExponential.call(0.9999, 20), '9.99900000000000011013e-1'); assert.same(toExponential.call(25, 0), '3e+1'); // FF86- and Chrome 49-50 bugs assert.same(toExponential.call(12345, 3), '1.235e+4'); // FF86- and Chrome 49-50 bugs assert.same(toExponential.call(Number.prototype, 0), '0e+0', 'Number.prototype, 0'); assert.same(toExponential.call(0, 0), '0e+0', '0, 0'); assert.same(toExponential.call(-0, 0), '0e+0', '-0, 0'); assert.same(toExponential.call(0, -0), '0e+0', '0, -0'); assert.same(toExponential.call(-0, -0), '0e+0', '-0, -0'); assert.same(toExponential.call(0, 1), '0.0e+0', '0 and 1'); assert.same(toExponential.call(0, 2), '0.00e+0', '0 and 2'); assert.same(toExponential.call(0, 7), '0.0000000e+0', '0 and 7'); assert.same(toExponential.call(0, 20), '0.00000000000000000000e+0', '0 and 20'); assert.same(toExponential.call(-0, 1), '0.0e+0', '-0 and 1'); assert.same(toExponential.call(-0, 2), '0.00e+0', '-0 and 2'); assert.same(toExponential.call(-0, 7), '0.0000000e+0', '-0 and 7'); assert.same(toExponential.call(-0, 20), '0.00000000000000000000e+0', '-0 and 20'); assert.same(toExponential.call(NaN, 1000), 'NaN', 'NaN check before fractionDigits check'); assert.same(toExponential.call(Infinity, 1000), 'Infinity', 'Infinity check before fractionDigits check'); assert.notThrows(() => toExponential.call(new Number(1e21), -0.1) === '1e+21'); assert.throws(() => toExponential.call(1.0, -101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toExponential.call(1.0, 101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toExponential.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-global/es.number.to-fixed.js000066400000000000000000000073211451776221300225100ustar00rootroot00000000000000/* eslint-disable unicorn/require-number-to-fixed-digits-argument -- required for testing */ QUnit.test('Number#toFixed', assert => { const { toFixed } = Number.prototype; assert.isFunction(toFixed); assert.name(toFixed, 'toFixed'); assert.arity(toFixed, 1); assert.looksNative(toFixed); assert.nonEnumerable(Number.prototype, 'toFixed'); assert.same(0.00008.toFixed(3), '0.000'); assert.same(0.9.toFixed(0), '1'); assert.same(1.255.toFixed(2), '1.25'); assert.same(1843654265.0774949.toFixed(5), '1843654265.07749'); assert.same(1000000000000000128.0.toFixed(0), '1000000000000000128'); assert.same(toFixed.call(1), '1'); assert.same(toFixed.call(1, 0), '1'); assert.same(toFixed.call(1, 1), '1.0'); assert.same(toFixed.call(1, 1.1), '1.0'); assert.same(toFixed.call(1, 0.9), '1'); assert.same(toFixed.call(1, '0'), '1'); assert.same(toFixed.call(1, '1'), '1.0'); assert.same(toFixed.call(1, '1.1'), '1.0'); assert.same(toFixed.call(1, '0.9'), '1'); assert.same(toFixed.call(1, NaN), '1'); assert.same(toFixed.call(1, 'some string'), '1'); assert.notThrows(() => toFixed.call(1, -0.1) === '1'); assert.same(new Number(1).toFixed(), '1'); assert.same(new Number(1).toFixed(0), '1'); assert.same(new Number(1).toFixed(1), '1.0'); assert.same(new Number(1).toFixed(1.1), '1.0'); assert.same(new Number(1).toFixed(0.9), '1'); assert.same(new Number(1).toFixed('0'), '1'); assert.same(new Number(1).toFixed('1'), '1.0'); assert.same(new Number(1).toFixed('1.1'), '1.0'); assert.same(new Number(1).toFixed('0.9'), '1'); assert.same(new Number(1).toFixed(NaN), '1'); assert.same(new Number(1).toFixed('some string'), '1'); assert.notThrows(() => new Number(1).toFixed(-0.1) === '1'); assert.same(NaN.toFixed(), 'NaN'); assert.same(NaN.toFixed(0), 'NaN'); assert.same(NaN.toFixed(1), 'NaN'); assert.same(NaN.toFixed(1.1), 'NaN'); assert.same(NaN.toFixed(0.9), 'NaN'); assert.same(NaN.toFixed('0'), 'NaN'); assert.same(NaN.toFixed('1'), 'NaN'); assert.same(NaN.toFixed('1.1'), 'NaN'); assert.same(NaN.toFixed('0.9'), 'NaN'); assert.same(NaN.toFixed(NaN), 'NaN'); assert.same(NaN.toFixed('some string'), 'NaN'); assert.notThrows(() => NaN.toFixed(-0.1) === 'NaN'); assert.same(new Number(1e21).toFixed(), String(1e21)); assert.same(new Number(1e21).toFixed(0), String(1e21)); assert.same(new Number(1e21).toFixed(1), String(1e21)); assert.same(new Number(1e21).toFixed(1.1), String(1e21)); assert.same(new Number(1e21).toFixed(0.9), String(1e21)); assert.same(new Number(1e21).toFixed('0'), String(1e21)); assert.same(new Number(1e21).toFixed('1'), String(1e21)); assert.same(new Number(1e21).toFixed('1.1'), String(1e21)); assert.same(new Number(1e21).toFixed('0.9'), String(1e21)); assert.same(new Number(1e21).toFixed(NaN), String(1e21)); assert.same(new Number(1e21).toFixed('some string'), String(1e21)); assert.notThrows(() => new Number(1e21).toFixed(-0.1) === String(1e21)); assert.throws(() => 1.0.toFixed(-101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => 1.0.toFixed(101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => NaN.toFixed(Infinity), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toFixed.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-global/es.number.to-precision.js000066400000000000000000000027761451776221300234150ustar00rootroot00000000000000QUnit.test('Number#toPrecision', assert => { const { toPrecision } = Number.prototype; assert.isFunction(toPrecision); assert.name(toPrecision, 'toPrecision'); assert.arity(toPrecision, 1); assert.looksNative(toPrecision); assert.nonEnumerable(Number.prototype, 'toPrecision'); assert.same(0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)'); assert.same(1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)'); assert.same(1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); assert.same(NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".'); assert.same(123.456.toPrecision(), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.same(123.456.toPrecision(undefined), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(() => 0.9.toPrecision(0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => 0.9.toPrecision(101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-global/es.object.assign.js000066400000000000000000000043511451776221300222330ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.assign', assert => { const { assign, keys, defineProperty } = Object; assert.isFunction(assign); assert.arity(assign, 2); assert.name(assign, 'assign'); assert.looksNative(assign); assert.nonEnumerable(Object, 'assign'); let object = { q: 1 }; assert.same(object, assign(object, { bar: 2 }), 'assign return target'); assert.same(object.bar, 2, 'assign define properties'); assert.deepEqual(assign({}, { q: 1 }, { w: 2 }), { q: 1, w: 2 }); assert.deepEqual(assign({}, 'qwe'), { 0: 'q', 1: 'w', 2: 'e' }); assert.throws(() => assign(null, { q: 1 }), TypeError); assert.throws(() => assign(undefined, { q: 1 }), TypeError); let string = assign('qwe', { q: 1 }); assert.same(typeof string, 'object'); assert.same(String(string), 'qwe'); assert.same(string.q, 1); assert.same(assign({}, { valueOf: 42 }).valueOf, 42, 'IE enum keys bug'); if (DESCRIPTORS) { object = { baz: 1 }; assign(object, defineProperty({}, 'bar', { get() { return this.baz + 1; }, })); assert.same(object.bar, undefined, "assign don't copy descriptors"); object = { a: 'a' }; const c = Symbol('c'); const d = Symbol('d'); object[c] = 'c'; defineProperty(object, 'b', { value: 'b' }); defineProperty(object, d, { value: 'd' }); const object2 = assign({}, object); assert.same(object2.a, 'a', 'a'); assert.same(object2.b, undefined, 'b'); assert.same(object2[c], 'c', 'c'); assert.same(object2[d], undefined, 'd'); try { assert.same(Function('assign', ` return assign({ b: 1 }, { get a() { delete this.b; }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } try { assert.same(Function('assign', ` return assign({ b: 1 }, { get a() { Object.defineProperty(this, "b", { value: 3, enumerable: false }); }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } } string = 'abcdefghijklmnopqrst'; const result = {}; for (let i = 0, { length } = string; i < length; ++i) { const chr = string.charAt(i); result[chr] = chr; } assert.same(keys(assign({}, result)).join(''), string); }); core-js-3.33.2/tests/unit-global/es.object.create.js000066400000000000000000000023241451776221300222100ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.create', assert => { const { create, getPrototypeOf, getOwnPropertyNames } = Object; function getPropertyNames(object) { let result = []; do { result = result.concat(getOwnPropertyNames(object)); } while (object = getPrototypeOf(object)); return result; } assert.isFunction(create); assert.arity(create, 2); assert.name(create, 'create'); assert.looksNative(create); assert.nonEnumerable(Object, 'create'); let object = { q: 1 }; assert.true({}.isPrototypeOf.call(object, create(object))); assert.same(create(object).q, 1); function F() { return this.a = 1; } assert.true(create(new F()) instanceof F); assert.same(F.prototype, getPrototypeOf(getPrototypeOf(create(new F())))); assert.same(create(new F()).a, 1); assert.same(create({}, { a: { value: 42 } }).a, 42); object = create(null, { w: { value: 2 } }); assert.same(object, Object(object)); assert.false(('toString' in object)); assert.same(object.w, 2); assert.deepEqual(getPropertyNames(create(null)), []); }); QUnit.test('Object.create.sham flag', assert => { assert.same(Object.create.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.define-getter.js000066400000000000000000000020531451776221300234660ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('Object#__defineGetter__', assert => { const { __defineGetter__ } = Object.prototype; assert.isFunction(__defineGetter__); assert.arity(__defineGetter__, 2); assert.name(__defineGetter__, '__defineGetter__'); assert.looksNative(__defineGetter__); assert.nonEnumerable(Object.prototype, '__defineGetter__'); const object = {}; assert.same(object.__defineGetter__('key', () => 42), undefined, 'void'); assert.same(object.key, 42, 'works'); object.__defineSetter__('key', function () { this.foo = 43; }); object.key = 44; assert.same(object.key, 42, 'works with getter #1'); assert.same(object.foo, 43, 'works with getter #2'); if (STRICT) { assert.throws(() => __defineGetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineGetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-global/es.object.define-properties.js000066400000000000000000000017521451776221300243750ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.defineProperties', assert => { const { defineProperties } = Object; assert.isFunction(defineProperties); assert.arity(defineProperties, 2); assert.name(defineProperties, 'defineProperties'); assert.looksNative(defineProperties); assert.nonEnumerable(Object, 'defineProperties'); const source = {}; const result = defineProperties(source, { q: { value: 42 }, w: { value: 33 } }); assert.same(result, source); assert.same(result.q, 42); assert.same(result.w, 33); if (DESCRIPTORS) { // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(defineProperties(function () { /* empty */ }, { prototype: { value: 42, writable: false, } }).prototype, 42, 'function prototype with non-writable descriptor'); } }); QUnit.test('Object.defineProperties.sham flag', assert => { assert.same(Object.defineProperties.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.define-property.js000066400000000000000000000021171451776221300240610ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.defineProperty', assert => { const { defineProperty, create } = Object; assert.isFunction(defineProperty); assert.arity(defineProperty, 3); assert.name(defineProperty, 'defineProperty'); assert.looksNative(defineProperty); assert.nonEnumerable(Object, 'defineProperty'); const source = {}; const result = defineProperty(source, 'q', { value: 42, }); assert.same(result, source); assert.same(result.q, 42); if (DESCRIPTORS) { // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false, }).prototype, 42, 'function prototype with non-writable descriptor'); } assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Object.defineProperty.sham flag', assert => { assert.same(Object.defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.define-setter.js000066400000000000000000000022351451776221300235040ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('Object#__defineSetter__', assert => { const { __defineSetter__ } = Object.prototype; assert.isFunction(__defineSetter__); assert.arity(__defineSetter__, 2); assert.name(__defineSetter__, '__defineSetter__'); assert.looksNative(__defineSetter__); assert.nonEnumerable(Object.prototype, '__defineSetter__'); let object = {}; assert.same(object.__defineSetter__('key', function () { this.foo = 43; }), undefined, 'void'); object.key = 44; assert.same(object.foo, 43, 'works'); object = {}; object.__defineSetter__('key', function () { this.foo = 43; }); object.__defineGetter__('key', () => 42); object.key = 44; assert.same(object.key, 42, 'works with setter #1'); assert.same(object.foo, 43, 'works with setter #2'); if (STRICT) { assert.throws(() => __defineSetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineSetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-global/es.object.entries.js000066400000000000000000000023051451776221300224150ustar00rootroot00000000000000QUnit.test('Object.entries', assert => { const { entries, create, assign } = Object; assert.isFunction(entries); assert.arity(entries, 1); assert.name(entries, 'entries'); assert.looksNative(entries); assert.nonEnumerable(Object, 'entries'); assert.deepEqual(entries({ q: 1, w: 2, e: 3 }), [['q', 1], ['w', 2], ['e', 3]]); assert.deepEqual(entries(new String('qwe')), [['0', 'q'], ['1', 'w'], ['2', 'e']]); assert.deepEqual(entries(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [['a', 4], ['s', 5], ['d', 6]]); assert.deepEqual(entries({ valueOf: 42 }), [['valueOf', 42]], 'IE enum keys bug'); try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } }); core-js-3.33.2/tests/unit-global/es.object.freeze.js000066400000000000000000000021071451776221300222240ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants.js'; QUnit.test('Object.freeze', assert => { const { freeze, isFrozen, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(freeze); assert.arity(freeze, 1); assert.name(freeze, 'freeze'); assert.looksNative(freeze); assert.nonEnumerable(Object, 'freeze'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => freeze(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(freeze(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.true(isFrozen(freeze({}))); const results = []; for (const key in freeze({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(freeze({})), []); assert.arrayEqual(getOwnPropertyNames(freeze({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(freeze({})), []); if (ownKeys) assert.arrayEqual(ownKeys(freeze({})), []); }); core-js-3.33.2/tests/unit-global/es.object.from-entries.js000066400000000000000000000015301451776221300233550ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Object.fromEntries', assert => { const { fromEntries } = Object; assert.isFunction(fromEntries); assert.arity(fromEntries, 1); assert.name(fromEntries, 'fromEntries'); assert.looksNative(fromEntries); assert.nonEnumerable(Object, 'fromEntries'); assert.true(fromEntries([]) instanceof Object); assert.same(fromEntries([['foo', 1]]).foo, 1); assert.same(fromEntries(createIterable([['bar', 2]])).bar, 2); class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102), new Unit(103)]); const object = fromEntries(units.entries()); assert.same(object.unit101.id, 101); assert.same(object.unit102.id, 102); assert.same(object.unit103.id, 103); }); core-js-3.33.2/tests/unit-global/es.object.get-own-property-descriptor.js000066400000000000000000000022161451776221300263630ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.getOwnPropertyDescriptor', assert => { const { getOwnPropertyDescriptor } = Object; assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); assert.looksNative(getOwnPropertyDescriptor); assert.nonEnumerable(Object, 'getOwnPropertyDescriptor'); assert.deepEqual(getOwnPropertyDescriptor({ q: 42 }, 'q'), { writable: true, enumerable: true, configurable: true, value: 42, }); assert.same(getOwnPropertyDescriptor({}, 'toString'), undefined); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyDescriptor(value) || true, `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyDescriptor(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyDescriptor(undefined), TypeError, 'throws on undefined'); }); QUnit.test('Object.getOwnPropertyDescriptor.sham flag', assert => { assert.same(Object.getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.get-own-property-descriptors.js000066400000000000000000000024321451776221300265460ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Object.getOwnPropertyDescriptors', assert => { const { create, getOwnPropertyDescriptors } = Object; assert.isFunction(getOwnPropertyDescriptors); assert.arity(getOwnPropertyDescriptors, 1); assert.name(getOwnPropertyDescriptors, 'getOwnPropertyDescriptors'); assert.looksNative(getOwnPropertyDescriptors); assert.nonEnumerable(Object, 'getOwnPropertyDescriptors'); const object = create({ q: 1 }, { e: { value: 3 } }); object.w = 2; const symbol = Symbol('4'); object[symbol] = 4; const descriptors = getOwnPropertyDescriptors(object); assert.same(descriptors.q, undefined); assert.deepEqual(descriptors.w, { enumerable: true, configurable: true, writable: true, value: 2, }); if (DESCRIPTORS) { assert.deepEqual(descriptors.e, { enumerable: false, configurable: false, writable: false, value: 3, }); } else { assert.deepEqual(descriptors.e, { enumerable: true, configurable: true, writable: true, value: 3, }); } assert.same(descriptors[symbol].value, 4); }); QUnit.test('Object.getOwnPropertyDescriptors.sham flag', assert => { assert.same(Object.getOwnPropertyDescriptors.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.get-own-property-names.js000066400000000000000000000036701451776221300253150ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; QUnit.test('Object.getOwnPropertyNames', assert => { const { freeze, getOwnPropertyNames } = Object; assert.isFunction(getOwnPropertyNames); assert.arity(getOwnPropertyNames, 1); assert.name(getOwnPropertyNames, 'getOwnPropertyNames'); assert.looksNative(getOwnPropertyNames); assert.nonEnumerable(Object, 'getOwnPropertyNames'); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; const names = getOwnPropertyNames([1, 2, 3]); assert.same(names.length, 4); assert.true(includes(names, '0')); assert.true(includes(names, '1')); assert.true(includes(names, '2')); assert.true(includes(names, 'length')); assert.deepEqual(getOwnPropertyNames(new F1()), ['w']); assert.deepEqual(getOwnPropertyNames(new F2()), ['toString']); assert.true(includes(getOwnPropertyNames(Array.prototype), 'toString')); assert.true(includes(getOwnPropertyNames(Object.prototype), 'toString')); assert.true(includes(getOwnPropertyNames(Object.prototype), 'constructor')); assert.deepEqual(getOwnPropertyNames(freeze({})), [], 'frozen'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyNames(value), `accept ${ typeof value }`); } assert.throws(() => { getOwnPropertyNames(null); }, TypeError, 'throws on null'); assert.throws(() => { getOwnPropertyNames(undefined); }, TypeError, 'throws on undefined'); /* Chakra bug if (typeof document != 'undefined' && document.createElement) { assert.notThrows(() => { const iframe = document.createElement('iframe'); iframe.src = 'http://example.com'; document.documentElement.appendChild(iframe); const window = iframe.contentWindow; document.documentElement.removeChild(iframe); return getOwnPropertyNames(window); }, 'IE11 bug with iframe and window'); } */ }); core-js-3.33.2/tests/unit-global/es.object.get-own-property-symbols.js000066400000000000000000000022631451776221300256770ustar00rootroot00000000000000const { getOwnPropertyNames, getOwnPropertySymbols, create, } = Object; QUnit.test('Object.getOwnPropertySymbols', assert => { assert.isFunction(getOwnPropertySymbols); assert.nonEnumerable(Object, 'getOwnPropertySymbols'); assert.same(getOwnPropertySymbols.length, 1, 'arity is 1'); assert.name(getOwnPropertySymbols, 'getOwnPropertySymbols'); assert.looksNative(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; prototype[Symbol('getOwnPropertySymbols test 1')] = 42; prototype[Symbol('getOwnPropertySymbols test 2')] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.same(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; object[Symbol('getOwnPropertySymbols test 3')] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.same(getOwnPropertySymbols(object).length, 1); assert.same(getOwnPropertySymbols(Object.prototype).length, 0); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertySymbols(value), `accept ${ typeof value }`); } }); core-js-3.33.2/tests/unit-global/es.object.get-prototype-of.js000066400000000000000000000027431451776221300241760ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants.js'; QUnit.test('Object.getPrototypeOf', assert => { const { create, getPrototypeOf } = Object; assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.name(getPrototypeOf, 'getPrototypeOf'); assert.looksNative(getPrototypeOf); assert.nonEnumerable(Object, 'getPrototypeOf'); assert.same(getPrototypeOf({}), Object.prototype); assert.same(getPrototypeOf([]), Array.prototype); function F() { /* empty */ } assert.same(getPrototypeOf(new F()), F.prototype); const object = { q: 1 }; assert.same(getPrototypeOf(create(object)), object); assert.same(getPrototypeOf(create(null)), null); assert.same(getPrototypeOf(getPrototypeOf({})), null); function Foo() { /* empty */ } Foo.prototype.foo = 'foo'; function Bar() { /* empty */ } Bar.prototype = create(Foo.prototype); Bar.prototype.constructor = Bar; assert.same(getPrototypeOf(Bar.prototype).foo, 'foo'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getPrototypeOf(value), `accept ${ typeof value }`); } assert.throws(() => getPrototypeOf(null), TypeError, 'throws on null'); assert.throws(() => getPrototypeOf(undefined), TypeError, 'throws on undefined'); assert.same(getPrototypeOf('foo'), String.prototype); }); QUnit.test('Object.getPrototypeOf.sham flag', assert => { assert.same(Object.getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.object.has-own.js000066400000000000000000000013411451776221300223170ustar00rootroot00000000000000QUnit.test('Object.hasOwn', assert => { const { create, hasOwn } = Object; assert.isFunction(hasOwn); assert.arity(hasOwn, 2); assert.name(hasOwn, 'hasOwn'); assert.looksNative(hasOwn); assert.nonEnumerable(Object, 'hasOwn'); assert.true(hasOwn({ q: 42 }, 'q')); assert.false(hasOwn({ q: 42 }, 'w')); assert.false(hasOwn(create({ q: 42 }), 'q')); assert.true(hasOwn(Object.prototype, 'hasOwnProperty')); let called = false; try { hasOwn(null, { toString() { called = true; } }); } catch { /* empty */ } assert.false(called, 'modern behaviour'); assert.throws(() => hasOwn(null, 'foo'), TypeError, 'throws on null'); assert.throws(() => hasOwn(undefined, 'foo'), TypeError, 'throws on undefined'); }); core-js-3.33.2/tests/unit-global/es.object.is-extensible.js000066400000000000000000000012731451776221300235220ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Object.isExtensible', assert => { const { preventExtensions, isExtensible } = Object; assert.isFunction(isExtensible); assert.arity(isExtensible, 1); assert.name(isExtensible, 'isExtensible'); assert.nonEnumerable(Object, 'isExtensible'); assert.looksNative(isExtensible); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isExtensible(value) || true, `accept ${ value }`); assert.false(isExtensible(value), `returns true on ${ value }`); } assert.true(isExtensible({})); if (NATIVE) assert.false(isExtensible(preventExtensions({}))); }); core-js-3.33.2/tests/unit-global/es.object.is-frozen.js000066400000000000000000000011631451776221300226610ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Object.isFrozen', assert => { const { freeze, isFrozen } = Object; assert.isFunction(isFrozen); assert.arity(isFrozen, 1); assert.name(isFrozen, 'isFrozen'); assert.looksNative(isFrozen); assert.nonEnumerable(Object, 'isFrozen'); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isFrozen(value) || true, `accept ${ value }`); assert.true(isFrozen(value), `returns true on ${ value }`); } assert.false(isFrozen({})); if (NATIVE) assert.true(isFrozen(freeze({}))); }); core-js-3.33.2/tests/unit-global/es.object.is-sealed.js000066400000000000000000000011571451776221300226160ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Object.isSealed', assert => { const { seal, isSealed } = Object; assert.isFunction(isSealed); assert.arity(isSealed, 1); assert.name(isSealed, 'isSealed'); assert.looksNative(isSealed); assert.nonEnumerable(Object, 'isSealed'); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isSealed(value) || true, `accept ${ value }`); assert.true(isSealed(value), `returns true on ${ value }`); } assert.false(isSealed({})); if (NATIVE) assert.true(isSealed(seal({}))); }); core-js-3.33.2/tests/unit-global/es.object.is.js000066400000000000000000000005521451776221300213610ustar00rootroot00000000000000QUnit.test('Object.is', assert => { const { is } = Object; assert.isFunction(is); assert.arity(is, 2); assert.name(is, 'is'); assert.looksNative(is); assert.nonEnumerable(Object, 'is'); assert.true(is(1, 1), '1 is 1'); assert.true(is(NaN, NaN), '1 is 1'); assert.false(is(0, -0), '0 is not -0'); assert.false(is({}, {}), '{} is not {}'); }); core-js-3.33.2/tests/unit-global/es.object.keys.js000066400000000000000000000015641451776221300217250ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; QUnit.test('Object.keys', assert => { const { keys } = Object; assert.isFunction(keys); assert.arity(keys, 1); assert.name(keys, 'keys'); assert.looksNative(keys); assert.nonEnumerable(Object, 'keys'); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; assert.deepEqual(keys([1, 2, 3]), ['0', '1', '2']); assert.deepEqual(keys(new F1()), ['w']); assert.deepEqual(keys(new F2()), ['toString']); assert.false(includes(keys(Array.prototype), 'push')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => keys(value), `accept ${ typeof value }`); } assert.throws(() => keys(null), TypeError, 'throws on null'); assert.throws(() => keys(undefined), TypeError, 'throws on undefined'); }); core-js-3.33.2/tests/unit-global/es.object.lookup-getter.js000066400000000000000000000023261451776221300235500ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('Object#__lookupGetter__', assert => { const { __lookupGetter__ } = Object.prototype; const { create } = Object; assert.isFunction(__lookupGetter__); assert.arity(__lookupGetter__, 1); assert.name(__lookupGetter__, '__lookupGetter__'); assert.looksNative(__lookupGetter__); assert.nonEnumerable(Object.prototype, '__lookupGetter__'); assert.same({}.__lookupGetter__('key'), undefined, 'empty object'); assert.same({ key: 42 }.__lookupGetter__('key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } object.__defineGetter__('key', setter); assert.same(object.__lookupGetter__('key'), setter, 'own getter'); assert.same(create(object).__lookupGetter__('key'), setter, 'proto getter'); assert.same(create(object).__lookupGetter__('foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupGetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupGetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-global/es.object.lookup-setter.js000066400000000000000000000023261451776221300235640ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('Object#__lookupSetter__', assert => { const { __lookupSetter__ } = Object.prototype; const { create } = Object; assert.isFunction(__lookupSetter__); assert.arity(__lookupSetter__, 1); assert.name(__lookupSetter__, '__lookupSetter__'); assert.looksNative(__lookupSetter__); assert.nonEnumerable(Object.prototype, '__lookupSetter__'); assert.same({}.__lookupSetter__('key'), undefined, 'empty object'); assert.same({ key: 42 }.__lookupSetter__('key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } object.__defineSetter__('key', setter); assert.same(object.__lookupSetter__('key'), setter, 'own getter'); assert.same(create(object).__lookupSetter__('key'), setter, 'proto getter'); assert.same(create(object).__lookupSetter__('foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupSetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupSetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-global/es.object.prevent-extensions.js000066400000000000000000000024001451776221300246200ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants.js'; QUnit.test('Object.preventExtensions', assert => { const { preventExtensions, keys, isExtensible, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); assert.name(preventExtensions, 'preventExtensions'); assert.looksNative(preventExtensions); assert.nonEnumerable(Object, 'preventExtensions'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => preventExtensions(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(preventExtensions(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.false(isExtensible(preventExtensions({}))); const results = []; for (const key in preventExtensions({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(preventExtensions({})), []); assert.arrayEqual(getOwnPropertyNames(preventExtensions({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(preventExtensions({})), []); if (ownKeys) assert.arrayEqual(ownKeys(preventExtensions({})), []); }); core-js-3.33.2/tests/unit-global/es.object.proto.js000066400000000000000000000010751451776221300221120ustar00rootroot00000000000000/* eslint-disable no-proto -- required for testing */ import { DESCRIPTORS, PROTO } from '../helpers/constants.js'; if (PROTO && DESCRIPTORS) QUnit.test('Object.prototype.__proto__', assert => { assert.true('__proto__' in Object.prototype, 'in Object.prototype'); const O = {}; assert.same(O.__proto__, Object.prototype); O.__proto__ = Array.prototype; assert.same(O.__proto__, Array.prototype); assert.same(Object.getPrototypeOf(O), Array.prototype); assert.true(O instanceof Array); O.__proto__ = null; assert.same(Object.getPrototypeOf(O), null); }); core-js-3.33.2/tests/unit-global/es.object.seal.js000066400000000000000000000020471451776221300216730ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants.js'; QUnit.test('Object.seal', assert => { const { seal, isSealed, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(seal); assert.arity(seal, 1); assert.name(seal, 'seal'); assert.looksNative(seal); assert.nonEnumerable(Object, 'seal'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => seal(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(seal(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.true(isSealed(seal({}))); const results = []; for (const key in seal({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(seal({})), []); assert.arrayEqual(getOwnPropertyNames(seal({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(seal({})), []); if (ownKeys) assert.arrayEqual(ownKeys(seal({})), []); }); core-js-3.33.2/tests/unit-global/es.object.set-prototype-of.js000066400000000000000000000014301451776221300242020ustar00rootroot00000000000000import { PROTO } from '../helpers/constants.js'; if (PROTO) QUnit.test('Object.setPrototypeOf', assert => { const { setPrototypeOf } = Object; assert.isFunction(setPrototypeOf); assert.arity(setPrototypeOf, 2); assert.name(setPrototypeOf, 'setPrototypeOf'); assert.looksNative(setPrototypeOf); assert.nonEnumerable(Object, 'setPrototypeOf'); assert.true('apply' in setPrototypeOf({}, Function.prototype), 'Parent properties in target'); assert.same(setPrototypeOf({ a: 2 }, { b() { return this.a ** 2; }, }).b(), 4, 'Child and parent properties in target'); const object = {}; assert.same(setPrototypeOf(object, { a: 1 }), object, 'setPrototypeOf return target'); assert.false(('toString' in setPrototypeOf({}, null)), 'Can set null as prototype'); }); core-js-3.33.2/tests/unit-global/es.object.to-string.js000066400000000000000000000065731451776221300227050ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants.js'; QUnit.test('Object#toString', assert => { const { toString } = Object.prototype; const Symbol = GLOBAL.Symbol || {}; assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(Object.prototype, 'toString'); if (STRICT) { assert.same(toString.call(null), '[object Null]', 'null -> `Null`'); assert.same(toString.call(undefined), '[object Undefined]', 'undefined -> `Undefined`'); } assert.same(toString.call(true), '[object Boolean]', 'bool -> `Boolean`'); assert.same(toString.call('string'), '[object String]', 'string -> `String`'); assert.same(toString.call(7), '[object Number]', 'number -> `Number`'); assert.same(`${ {} }`, '[object Object]', '{} -> `Object`'); assert.same(toString.call([]), '[object Array]', ' [] -> `Array`'); assert.same(toString.call(() => { /* empty */ }), '[object Function]', 'function -> `Function`'); assert.same(toString.call(/./), '[object RegExp]', 'regexp -> `RegExp`'); assert.same(toString.call(new TypeError()), '[object Error]', 'new TypeError -> `Error`'); assert.same(toString.call(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }()), '[object Arguments]', 'arguments -> `Arguments`'); const constructors = [ 'Array', 'RegExp', 'Boolean', 'String', 'Number', 'Error', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'ArrayBuffer', ]; for (const name of constructors) { const Constructor = GLOBAL[name]; if (Constructor) { assert.same(toString.call(new Constructor(1)), `[object ${ name }]`, `new ${ name }(1) -> \`${ name }\``); } } if (GLOBAL.DataView) { assert.same(`${ new DataView(new ArrayBuffer(1)) }`, '[object DataView]', 'dataview -> `DataView`'); } if (GLOBAL.Set) { assert.same(`${ new Set() }`, '[object Set]', 'set -> `Set`'); } if (GLOBAL.Map) { assert.same(`${ new Map() }`, '[object Map]', 'map -> `Map`'); } if (GLOBAL.WeakSet) { assert.same(`${ new WeakSet() }`, '[object WeakSet]', 'weakset -> `WeakSet`'); } if (GLOBAL.WeakMap) { assert.same(`${ new WeakMap() }`, '[object WeakMap]', 'weakmap -> `WeakMap`'); } if (GLOBAL.Promise) { assert.same(`${ new Promise((() => { /* empty */ })) }`, '[object Promise]', 'promise -> `Promise`'); } if (''[Symbol.iterator]) { assert.same(`${ ''[Symbol.iterator]() }`, '[object String Iterator]', 'String Iterator -> `String Iterator`'); } if ([].entries) { assert.same(`${ [].entries() }`, '[object Array Iterator]', 'Array Iterator -> `Array Iterator`'); } if (GLOBAL.Set && Set.entries) { assert.same(`${ new Set().entries() }`, '[object Set Iterator]', 'Set Iterator -> `Set Iterator`'); } if (GLOBAL.Map && Map.entries) { assert.same(`${ new Map().entries() }`, '[object Map Iterator]', 'Map Iterator -> `Map Iterator`'); } assert.same(`${ Math }`, '[object Math]', 'Math -> `Math`'); if (GLOBAL.JSON) { assert.same(`${ JSON }`, '[object JSON]', 'JSON -> `JSON`'); } function Class() { /* empty */ } Class.prototype[Symbol.toStringTag] = 'Class'; assert.same(`${ new Class() }`, '[object Class]', 'user class instance -> [Symbol.toStringTag]'); }); core-js-3.33.2/tests/unit-global/es.object.values.js000066400000000000000000000017751451776221300222550ustar00rootroot00000000000000QUnit.test('Object.values', assert => { const { values, create, assign } = Object; assert.isFunction(values); assert.arity(values, 1); assert.name(values, 'values'); assert.looksNative(values); assert.nonEnumerable(Object, 'values'); assert.deepEqual(values({ q: 1, w: 2, e: 3 }), [1, 2, 3]); assert.deepEqual(values(new String('qwe')), ['q', 'w', 'e']); assert.deepEqual(values(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [4, 5, 6]); assert.deepEqual(values({ valueOf: 42 }), [42], 'IE enum keys bug'); try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } }); core-js-3.33.2/tests/unit-global/es.parse-float.js000066400000000000000000000016131451776221300217150ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants.js'; QUnit.test('parseFloat', assert => { assert.isFunction(parseFloat); assert.name(parseFloat, 'parseFloat'); assert.arity(parseFloat, 1); assert.looksNative(parseFloat); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('parseFloat test'); assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.parse-int.js000066400000000000000000000037671451776221300214160ustar00rootroot00000000000000/* eslint-disable prefer-numeric-literals -- required for testing */ import { WHITESPACES } from '../helpers/constants.js'; /* eslint-disable radix -- required for testing */ QUnit.test('parseInt', assert => { assert.isFunction(parseInt); assert.name(parseInt, 'parseInt'); assert.arity(parseInt, 2); assert.looksNative(parseInt); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('parseInt test'); assert.throws(() => parseInt(symbol), 'throws on symbol argument'); assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.promise.all-settled.js000066400000000000000000000016561451776221300233760ustar00rootroot00000000000000QUnit.test('Promise.allSettled', assert => { assert.isFunction(Promise.allSettled); assert.arity(Promise.allSettled, 1); assert.looksNative(Promise.allSettled); assert.nonEnumerable(Promise, 'allSettled'); assert.true(Promise.allSettled([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.allSettled, resolved', assert => { return Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.deepEqual(it, [ { value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }, ], 'resolved with a correct value'); }); }); QUnit.test('Promise.allSettled, rejected', assert => { // eslint-disable-next-line promise/valid-params -- required for testing return Promise.allSettled().then(() => { assert.avoid(); }, () => { assert.required('rejected as expected'); }); }); core-js-3.33.2/tests/unit-global/es.promise.all.js000066400000000000000000000043531451776221300217310ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Promise.all', assert => { let FakePromise1, FakePromise2; const { all, resolve } = Promise; assert.isFunction(all); assert.arity(all, 1); assert.name(all, 'all'); assert.looksNative(all); assert.nonEnumerable(Promise, 'all'); const iterable = createIterable([1, 2, 3]); Promise.all(iterable).catch(() => { /* empty */ }); assert.true(iterable.received, 'works with iterables: iterator received'); assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; Promise.all(array); assert.true(done); assert.throws(() => { all.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.all(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch { /* empty */ } Promise.resolve = resolve; assert.true(done, 'iteration closing'); FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = resolve.bind(Promise); assert.true(all.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = resolve.bind(Promise); assert.throws(() => { all.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { all.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { all.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-global/es.promise.any.js000066400000000000000000000025641451776221300217520ustar00rootroot00000000000000QUnit.test('Promise.any', assert => { assert.isFunction(Promise.any); assert.arity(Promise.any, 1); assert.looksNative(Promise.any); assert.nonEnumerable(Promise, 'any'); assert.true(Promise.any([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.any, resolved', assert => { return Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.same(it, 1, 'resolved with a correct value'); }); }); QUnit.test('Promise.any, rejected #1', assert => { return Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).then(() => { assert.avoid(); }, error => { assert.true(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [1, 2, 3], 'rejected with a correct value'); }); }); QUnit.test('Promise.any, rejected #2', assert => { // eslint-disable-next-line promise/valid-params -- required for testing return Promise.any().then(() => { assert.avoid(); }, () => { assert.required('rejected as expected'); }); }); QUnit.test('Promise.any, rejected #3', assert => { return Promise.any([]).then(() => { assert.avoid(); }, error => { assert.true(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [], 'rejected with a correct value'); }); }); core-js-3.33.2/tests/unit-global/es.promise.catch.js000066400000000000000000000040471451776221300222430ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Promise#catch', assert => { assert.isFunction(Promise.prototype.catch); if (NATIVE) assert.arity(Promise.prototype.catch, 1); if (NATIVE) assert.name(Promise.prototype.catch, 'catch'); assert.looksNative(Promise.prototype.catch); assert.nonEnumerable(Promise.prototype, 'catch'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.catch(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.catch(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); assert.same(Promise.prototype.catch.call({ // eslint-disable-next-line unicorn/no-thenable -- required for testing then(x, y) { return y; }, }, 42), 42, 'calling `.then`'); }); core-js-3.33.2/tests/unit-global/es.promise.constructor.js000066400000000000000000000204111451776221300235370ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, PROTO, STRICT } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; const { setPrototypeOf, create } = Object; QUnit.test('Promise', assert => { assert.isFunction(Promise); assert.arity(Promise, 1); assert.name(Promise, 'Promise'); assert.looksNative(Promise); assert.throws(() => { Promise(); }, 'throws w/o `new`'); new Promise(function (resolve, reject) { assert.isFunction(resolve, 'resolver is function'); assert.isFunction(reject, 'rejector is function'); if (STRICT) assert.same(this, undefined, 'correct executor context'); }); }); if (DESCRIPTORS) QUnit.test('Promise operations order', assert => { let $resolve, $resolve2; assert.expect(1); const EXPECTED_ORDER = 'DEHAFGBC'; const async = assert.async(); let result = ''; const promise1 = new Promise(resolve => { $resolve = resolve; }); $resolve({ // eslint-disable-next-line unicorn/no-thenable -- required for testing then() { result += 'A'; throw new Error(); }, }); promise1.catch(() => { result += 'B'; }); promise1.catch(() => { result += 'C'; assert.same(result, EXPECTED_ORDER); async(); }); const promise2 = new Promise(resolve => { $resolve2 = resolve; }); // eslint-disable-next-line unicorn/no-thenable -- required for testing $resolve2(Object.defineProperty({}, 'then', { get() { result += 'D'; throw new Error(); }, })); result += 'E'; promise2.catch(() => { result += 'F'; }); promise2.catch(() => { result += 'G'; }); result += 'H'; setTimeout(() => { if (!~result.indexOf('C')) { assert.same(result, EXPECTED_ORDER); async(); } }, 1e3); }); QUnit.test('Promise#then', assert => { assert.isFunction(Promise.prototype.then); if (NATIVE) assert.arity(Promise.prototype.then, 2); assert.name(Promise.prototype.then, 'then'); assert.looksNative(Promise.prototype.then); assert.nonEnumerable(Promise.prototype, 'then'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.then(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.then(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise#@@toStringTag', assert => { assert.same(Promise.prototype[Symbol.toStringTag], 'Promise', 'Promise::@@toStringTag is `Promise`'); assert.same(String(new Promise(() => { /* empty */ })), '[object Promise]', 'correct stringification'); }); if (PROTO) QUnit.test('Promise subclassing', assert => { function SubPromise(executor) { const self = new Promise(executor); setPrototypeOf(self, SubPromise.prototype); self.mine = 'subclass'; return self; } setPrototypeOf(SubPromise, Promise); SubPromise.prototype = create(Promise.prototype); SubPromise.prototype.constructor = SubPromise; let promise1 = SubPromise.resolve(5); assert.same(promise1.mine, 'subclass'); promise1 = promise1.then(it => { assert.same(it, 5); }); assert.same(promise1.mine, 'subclass'); let promise2 = new SubPromise(resolve => { resolve(6); }); assert.same(promise2.mine, 'subclass'); promise2 = promise2.then(it => { assert.same(it, 6); }); assert.same(promise2.mine, 'subclass'); const promise3 = SubPromise.all([promise1, promise2]); assert.same(promise3.mine, 'subclass'); assert.true(promise3 instanceof Promise); assert.true(promise3 instanceof SubPromise); promise3.then(assert.async(), error => { assert.avoid(error); }); }); // qunit@2.5 strange bug QUnit.skip('Unhandled rejection tracking', assert => { let done = false; const resume = assert.async(); if (GLOBAL.process) { assert.expect(3); function onunhandledrejection(reason, promise) { process.removeListener('unhandledRejection', onunhandledrejection); assert.same(promise, $promise, 'unhandledRejection, promise'); assert.same(reason, 42, 'unhandledRejection, reason'); $promise.catch(() => { // empty }); } function onrejectionhandled(promise) { process.removeListener('rejectionHandled', onrejectionhandled); assert.same(promise, $promise, 'rejectionHandled, promise'); done || resume(); done = true; } process.on('unhandledRejection', onunhandledrejection); process.on('rejectionHandled', onrejectionhandled); } else { if (GLOBAL.addEventListener) { assert.expect(8); function onunhandledrejection(it) { assert.same(it.promise, $promise, 'addEventListener(unhandledrejection), promise'); assert.same(it.reason, 42, 'addEventListener(unhandledrejection), reason'); GLOBAL.removeEventListener('unhandledrejection', onunhandledrejection); } GLOBAL.addEventListener('rejectionhandled', onunhandledrejection); function onrejectionhandled(it) { assert.same(it.promise, $promise, 'addEventListener(rejectionhandled), promise'); assert.same(it.reason, 42, 'addEventListener(rejectionhandled), reason'); GLOBAL.removeEventListener('rejectionhandled', onrejectionhandled); } GLOBAL.addEventListener('rejectionhandled', onrejectionhandled); } else assert.expect(4); GLOBAL.onunhandledrejection = function (it) { assert.same(it.promise, $promise, 'onunhandledrejection, promise'); assert.same(it.reason, 42, 'onunhandledrejection, reason'); setTimeout(() => { $promise.catch(() => { // empty }); }, 1); GLOBAL.onunhandledrejection = null; }; GLOBAL.onrejectionhandled = function (it) { assert.same(it.promise, $promise, 'onrejectionhandled, promise'); assert.same(it.reason, 42, 'onrejectionhandled, reason'); GLOBAL.onrejectionhandled = null; done || resume(); done = true; }; } Promise.reject(43).catch(() => { // empty }); const $promise = Promise.reject(42); setTimeout(() => { done || resume(); done = true; }, 3e3); }); const promise = (() => { try { return Function('return (async function () { /* empty */ })()')(); } catch { /* empty */ } })(); if (promise && promise.constructor !== Promise) QUnit.test('Native Promise, patched', assert => { assert.isFunction(promise.then); assert.arity(promise.then, 2); assert.looksNative(promise.then); assert.nonEnumerable(promise.constructor.prototype, 'then'); function empty() { /* empty */ } assert.true(promise.then(empty) instanceof Promise, '`.then` returns `Promise` instance #1'); assert.true(new promise.constructor(empty).then(empty) instanceof Promise, '`.then` returns `Promise` instance #2'); assert.true(promise.catch(empty) instanceof Promise, '`.catch` returns `Promise` instance #1'); assert.true(new promise.constructor(empty).catch(empty) instanceof Promise, '`.catch` returns `Promise` instance #2'); assert.true(promise.finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #1'); assert.true(new promise.constructor(empty).finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #2'); }); core-js-3.33.2/tests/unit-global/es.promise.finally.js000066400000000000000000000034541451776221300226200ustar00rootroot00000000000000QUnit.test('Promise#finally', assert => { assert.isFunction(Promise.prototype.finally); assert.arity(Promise.prototype.finally, 1); assert.looksNative(Promise.prototype.finally); assert.nonEnumerable(Promise.prototype, 'finally'); assert.true(Promise.resolve(42).finally(() => { /* empty */ }) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise#finally, resolved', assert => { let called = 0; let argument = null; return Promise.resolve(42).finally(it => { called++; argument = it; }).then(it => { assert.same(it, 42, 'resolved with a correct value'); assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); }); }); QUnit.test('Promise#finally, rejected', assert => { let called = 0; let argument = null; return Promise.reject(42).finally(it => { called++; argument = it; }).then(() => { assert.avoid(); }, () => { assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); }); }); const promise = (() => { try { return Function('return (async function () { /* empty */ })()')(); } catch { /* empty */ } })(); if (promise && promise.constructor !== Promise) QUnit.test('Native Promise, patched', assert => { assert.isFunction(promise.finally); assert.arity(promise.finally, 1); assert.looksNative(promise.finally); assert.nonEnumerable(promise.constructor.prototype, 'finally'); function empty() { /* empty */ } assert.true(promise.finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #1'); assert.true(new promise.constructor(empty).finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #2'); }); core-js-3.33.2/tests/unit-global/es.promise.race.js000066400000000000000000000043731451776221300220750ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Promise.race', assert => { let FakePromise1, FakePromise2; const { race, resolve } = Promise; assert.isFunction(race); assert.arity(race, 1); assert.name(race, 'race'); assert.looksNative(race); assert.nonEnumerable(Promise, 'race'); const iterable = createIterable([1, 2, 3]); Promise.race(iterable).catch(() => { /* empty */ }); assert.true(iterable.received, 'works with iterables: iterator received'); assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; Promise.race(array); assert.true(done); assert.throws(() => { race.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.race(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch { /* empty */ } Promise.resolve = resolve; assert.true(done, 'iteration closing'); FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = resolve.bind(Promise); assert.true(race.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = resolve.bind(Promise); assert.throws(() => { race.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { race.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { race.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-global/es.promise.reject.js000066400000000000000000000022231451776221300224270ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Promise.reject', assert => { const { reject } = Promise; assert.isFunction(reject); if (NATIVE) assert.arity(reject, 1); assert.name(reject, 'reject'); assert.looksNative(reject); assert.nonEnumerable(Promise, 'reject'); assert.throws(() => { reject.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(reject.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { reject.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { reject.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { reject.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-global/es.promise.resolve.js000066400000000000000000000022401451776221300226310ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Promise.resolve', assert => { const { resolve } = Promise; assert.isFunction(resolve); if (NATIVE) assert.arity(resolve, 1); assert.name(resolve, 'resolve'); assert.looksNative(resolve); assert.nonEnumerable(Promise, 'resolve'); assert.throws(() => { resolve.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(resolve.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { resolve.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { resolve.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { resolve.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-global/es.reflect.apply.js000066400000000000000000000013651451776221300222540ustar00rootroot00000000000000QUnit.test('Reflect.apply', assert => { const { apply } = Reflect; assert.isFunction(apply); assert.arity(apply, 3); assert.name(apply, 'apply'); assert.looksNative(apply); assert.nonEnumerable(Reflect, 'apply'); assert.same(apply(Array.prototype.push, [1, 2], [3, 4, 5]), 5); function f(a, b, c) { return a + b + c; } f.apply = 42; assert.same(apply(f, null, ['foo', 'bar', 'baz']), 'foobarbaz', 'works with redefined apply'); assert.throws(() => apply(42, null, []), TypeError, 'throws on primitive'); assert.throws(() => apply(() => { /* empty */ }, null), TypeError, 'throws without third argument'); assert.throws(() => apply(() => { /* empty */ }, null, '123'), TypeError, 'throws on primitive as third argument'); }); core-js-3.33.2/tests/unit-global/es.reflect.construct.js000066400000000000000000000022561451776221300231530ustar00rootroot00000000000000QUnit.test('Reflect.construct', assert => { const { construct } = Reflect; const { getPrototypeOf } = Object; assert.isFunction(construct); assert.arity(construct, 2); assert.name(construct, 'construct'); assert.looksNative(construct); assert.nonEnumerable(Reflect, 'construct'); function A(a, b, c) { this.qux = a + b + c; } assert.same(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'basic'); A.apply = 42; assert.same(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'works with redefined apply'); const instance = construct(function () { this.x = 42; }, [], Array); assert.same(instance.x, 42, 'constructor with newTarget'); assert.true(instance instanceof Array, 'prototype with newTarget'); assert.throws(() => construct(42, []), TypeError, 'throws on primitive'); function B() { /* empty */ } B.prototype = 42; assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype); assert.notThrows(() => typeof construct(Date, []).getTime() == 'number', 'works with native constructors with 2 arguments'); assert.throws(() => construct(() => { /* empty */ }), 'throws when the second argument is not an object'); }); core-js-3.33.2/tests/unit-global/es.reflect.define-property.js000066400000000000000000000024221451776221300242360ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Reflect.defineProperty', assert => { const { defineProperty } = Reflect; const { getOwnPropertyDescriptor, create } = Object; assert.isFunction(defineProperty); assert.arity(defineProperty, 3); assert.name(defineProperty, 'defineProperty'); assert.looksNative(defineProperty); assert.nonEnumerable(Reflect, 'defineProperty'); let object = {}; assert.true(defineProperty(object, 'foo', { value: 123 })); assert.same(object.foo, 123); if (DESCRIPTORS) { object = {}; defineProperty(object, 'foo', { value: 123, enumerable: true, }); assert.deepEqual(getOwnPropertyDescriptor(object, 'foo'), { value: 123, enumerable: true, configurable: false, writable: false, }); assert.false(defineProperty(object, 'foo', { value: 42, })); } assert.throws(() => defineProperty(42, 'foo', { value: 42, }), TypeError, 'throws on primitive'); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Reflect.defineProperty.sham flag', assert => { assert.same(Reflect.defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.reflect.delete-property.js000066400000000000000000000013171451776221300242500ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Reflect.deleteProperty', assert => { const { deleteProperty } = Reflect; const { defineProperty, keys } = Object; assert.isFunction(deleteProperty); assert.arity(deleteProperty, 2); assert.name(deleteProperty, 'deleteProperty'); assert.looksNative(deleteProperty); assert.nonEnumerable(Reflect, 'deleteProperty'); const object = { bar: 456 }; assert.true(deleteProperty(object, 'bar')); assert.same(keys(object).length, 0); if (DESCRIPTORS) { assert.false(deleteProperty(defineProperty({}, 'foo', { value: 42, }), 'foo')); } assert.throws(() => deleteProperty(42, 'foo'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.get-own-property-descriptor.js000066400000000000000000000014761451776221300265500ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Reflect.getOwnPropertyDescriptor', assert => { const { getOwnPropertyDescriptor } = Reflect; assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); assert.looksNative(getOwnPropertyDescriptor); assert.nonEnumerable(Reflect, 'getOwnPropertyDescriptor'); const object = { baz: 789 }; const descriptor = getOwnPropertyDescriptor(object, 'baz'); assert.same(descriptor.value, 789); assert.throws(() => getOwnPropertyDescriptor(42, 'constructor'), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getOwnPropertyDescriptor.sham flag', assert => { assert.same(Reflect.getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.reflect.get-prototype-of.js000066400000000000000000000012141451776221300243440ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants.js'; QUnit.test('Reflect.getPrototypeOf', assert => { const { getPrototypeOf } = Reflect; assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.name(getPrototypeOf, 'getPrototypeOf'); assert.looksNative(getPrototypeOf); assert.nonEnumerable(Reflect, 'getPrototypeOf'); assert.same(getPrototypeOf([]), Array.prototype); assert.throws(() => getPrototypeOf(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getPrototypeOf.sham flag', assert => { assert.same(Reflect.getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.reflect.get.js000066400000000000000000000020271451776221300217020ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants.js'; QUnit.test('Reflect.get', assert => { const { defineProperty, create } = Object; const { get } = Reflect; assert.isFunction(get); if (NATIVE) assert.arity(get, 2); assert.name(get, 'get'); assert.looksNative(get); assert.nonEnumerable(Reflect, 'get'); assert.same(get({ qux: 987 }, 'qux'), 987); if (DESCRIPTORS) { const target = create(defineProperty({ z: 3 }, 'w', { get() { return this; }, }), { x: { value: 1, }, y: { get() { return this; }, }, }); const receiver = {}; assert.same(get(target, 'x', receiver), 1, 'get x'); assert.same(get(target, 'y', receiver), receiver, 'get y'); assert.same(get(target, 'z', receiver), 3, 'get z'); assert.same(get(target, 'w', receiver), receiver, 'get w'); assert.same(get(target, 'u', receiver), undefined, 'get u'); } assert.throws(() => get(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.has.js000066400000000000000000000006641451776221300217030ustar00rootroot00000000000000QUnit.test('Reflect.has', assert => { const { has } = Reflect; assert.isFunction(has); assert.arity(has, 2); assert.name(has, 'has'); assert.looksNative(has); assert.nonEnumerable(Reflect, 'has'); const object = { qux: 987 }; assert.true(has(object, 'qux')); assert.false(has(object, 'qwe')); assert.true(has(object, 'toString')); assert.throws(() => has(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.is-extensible.js000066400000000000000000000010721451776221300236750ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Reflect.isExtensible', assert => { const { isExtensible } = Reflect; const { preventExtensions } = Object; assert.isFunction(isExtensible); assert.arity(isExtensible, 1); assert.name(isExtensible, 'isExtensible'); assert.looksNative(isExtensible); assert.nonEnumerable(Reflect, 'isExtensible'); assert.true(isExtensible({})); if (DESCRIPTORS) { assert.false(isExtensible(preventExtensions({}))); } assert.throws(() => isExtensible(42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.own-keys.js000066400000000000000000000016731451776221300227050ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; QUnit.test('Reflect.ownKeys', assert => { const { ownKeys } = Reflect; const { defineProperty, create } = Object; const symbol = Symbol('c'); assert.isFunction(ownKeys); assert.arity(ownKeys, 1); assert.name(ownKeys, 'ownKeys'); assert.looksNative(ownKeys); assert.nonEnumerable(Reflect, 'ownKeys'); const object = { a: 1 }; defineProperty(object, 'b', { value: 2, }); object[symbol] = 3; let keys = ownKeys(object); assert.same(keys.length, 3, 'ownKeys return all own keys'); assert.true(includes(keys, 'a'), 'ownKeys return all own keys: simple'); assert.true(includes(keys, 'b'), 'ownKeys return all own keys: hidden'); assert.same(object[keys[2]], 3, 'ownKeys return all own keys: symbol'); keys = ownKeys(create(object)); assert.same(keys.length, 0, 'ownKeys return only own keys'); assert.throws(() => ownKeys(42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.prevent-extensions.js000066400000000000000000000014111451776221300247770ustar00rootroot00000000000000import { DESCRIPTORS, FREEZING } from '../helpers/constants.js'; QUnit.test('Reflect.preventExtensions', assert => { const { preventExtensions } = Reflect; const { isExtensible } = Object; assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); assert.name(preventExtensions, 'preventExtensions'); assert.looksNative(preventExtensions); assert.nonEnumerable(Reflect, 'preventExtensions'); const object = {}; assert.true(preventExtensions(object)); if (DESCRIPTORS) { assert.false(isExtensible(object)); } assert.throws(() => preventExtensions(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.preventExtensions.sham flag', assert => { assert.same(Reflect.preventExtensions.sham, FREEZING ? undefined : true); }); core-js-3.33.2/tests/unit-global/es.reflect.set-prototype-of.js000066400000000000000000000013331451776221300243620ustar00rootroot00000000000000import { NATIVE, PROTO } from '../helpers/constants.js'; if (PROTO) QUnit.test('Reflect.setPrototypeOf', assert => { const { setPrototypeOf } = Reflect; assert.isFunction(setPrototypeOf); if (NATIVE) assert.arity(setPrototypeOf, 2); assert.name(setPrototypeOf, 'setPrototypeOf'); assert.looksNative(setPrototypeOf); assert.nonEnumerable(Reflect, 'setPrototypeOf'); let object = {}; assert.true(setPrototypeOf(object, Array.prototype)); assert.true(object instanceof Array); assert.throws(() => setPrototypeOf({}, 42), TypeError); assert.throws(() => setPrototypeOf(42, {}), TypeError, 'throws on primitive'); object = {}; assert.false(setPrototypeOf(object, object), 'false on recursive __proto__'); }); core-js-3.33.2/tests/unit-global/es.reflect.set.js000066400000000000000000000052041451776221300217160ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants.js'; QUnit.test('Reflect.set', assert => { const { set } = Reflect; const { defineProperty, getOwnPropertyDescriptor, create, getPrototypeOf } = Object; assert.isFunction(set); if (NATIVE) assert.arity(set, 3); assert.name(set, 'set'); assert.looksNative(set); assert.nonEnumerable(Reflect, 'set'); const object = {}; assert.true(set(object, 'quux', 654)); assert.same(object.quux, 654); let target = {}; const receiver = {}; set(target, 'foo', 1, receiver); assert.same(target.foo, undefined, 'target.foo === undefined'); assert.same(receiver.foo, 1, 'receiver.foo === 1'); if (DESCRIPTORS) { defineProperty(receiver, 'bar', { value: 0, writable: true, enumerable: false, configurable: true, }); set(target, 'bar', 1, receiver); assert.same(receiver.bar, 1, 'receiver.bar === 1'); assert.false(getOwnPropertyDescriptor(receiver, 'bar').enumerable, 'enumerability not overridden'); let out = null; target = create(defineProperty({ z: 3 }, 'w', { set() { out = this; }, }), { x: { value: 1, writable: true, configurable: true, }, y: { set() { out = this; }, }, c: { value: 1, writable: false, configurable: false, }, }); assert.true(set(target, 'x', 2, target), 'set x'); assert.same(target.x, 2, 'set x'); out = null; assert.true(set(target, 'y', 2, target), 'set y'); assert.same(out, target, 'set y'); assert.true(set(target, 'z', 4, target)); assert.same(target.z, 4, 'set z'); out = null; assert.true(set(target, 'w', 1, target), 'set w'); assert.same(out, target, 'set w'); assert.true(set(target, 'u', 0, target), 'set u'); assert.same(target.u, 0, 'set u'); assert.false(set(target, 'c', 2, target), 'set c'); assert.same(target.c, 1, 'set c'); // https://github.com/zloirock/core-js/issues/392 let o = defineProperty({}, 'test', { writable: false, configurable: true, }); assert.false(set(getPrototypeOf(o), 'test', 1, o)); // https://github.com/zloirock/core-js/issues/393 o = defineProperty({}, 'test', { get() { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); o = defineProperty({}, 'test', { // eslint-disable-next-line no-unused-vars -- required for testing set(v) { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); } assert.throws(() => set(42, 'q', 42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-global/es.reflect.to-string-tag.js000066400000000000000000000002231451776221300236160ustar00rootroot00000000000000QUnit.test('Reflect[@@toStringTag]', assert => { assert.same(Reflect[Symbol.toStringTag], 'Reflect', 'Reflect[@@toStringTag] is `Reflect`'); }); core-js-3.33.2/tests/unit-global/es.regexp.constructor.js000066400000000000000000000113531451776221300233600ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals, regexp/no-invalid-regexp, regexp/sort-flags -- required for testing */ /* eslint-disable regexp/no-useless-character-class, regexp/no-useless-flag -- required for testing */ import { DESCRIPTORS, GLOBAL } from '../helpers/constants.js'; import { nativeSubclass } from '../helpers/helpers.js'; if (DESCRIPTORS) { QUnit.test('RegExp constructor', assert => { const Symbol = GLOBAL.Symbol || {}; assert.isFunction(RegExp); assert.arity(RegExp, 2); assert.name(RegExp, 'RegExp'); assert.looksNative(RegExp); assert.same({}.toString.call(RegExp()).slice(8, -1), 'RegExp'); assert.same({}.toString.call(new RegExp()).slice(8, -1), 'RegExp'); let regexp = /a/g; assert.notSame(regexp, new RegExp(regexp), 'new RegExp(regexp) is not regexp'); assert.same(regexp, RegExp(regexp), 'RegExp(regexp) is regexp'); regexp[Symbol.match] = false; assert.notSame(regexp, RegExp(regexp), 'RegExp(regexp) is not regexp, changed Symbol.match'); const object = {}; assert.notSame(object, RegExp(object), 'RegExp(O) is not O'); object[Symbol.match] = true; object.constructor = RegExp; assert.same(object, RegExp(object), 'RegExp(O) is O, changed Symbol.match'); assert.same(String(regexp), '/a/g', 'b is /a/g'); assert.same(String(new RegExp(/a/g, 'mi')), '/a/im', 'Allows a regex with flags'); assert.true(new RegExp(/a/g, 'im') instanceof RegExp, 'Works with instanceof'); assert.same(new RegExp(/a/g, 'im').constructor, RegExp, 'Has the right constructor'); const orig = /^https?:\/\//i; regexp = new RegExp(orig); assert.notSame(regexp, orig, 'new + re + no flags #1'); assert.same(String(regexp), '/^https?:\\/\\//i', 'new + re + no flags #2'); let result = regexp.exec('http://github.com'); assert.deepEqual(result, ['http://'], 'new + re + no flags #3'); /(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)/.exec('abcdefghijklmnopq'); result = true; const characters = 'bcdefghij'; for (let i = 0, { length } = characters; i < length; ++i) { const chr = characters[i]; if (RegExp[`$${ i + 1 }`] !== chr) { result = false; } } assert.true(result, 'Updates RegExp globals'); if (nativeSubclass) { const Subclass = nativeSubclass(RegExp); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof RegExp, 'correct subclassing with native classes #2'); assert.true(new Subclass('^abc$').test('abc'), 'correct subclassing with native classes #3'); } assert.throws(() => RegExp(Symbol(1)), 'throws on symbol argument'); }); QUnit.test('RegExp dotAll', assert => { assert.false(RegExp('.', '').test('\n'), 'dotAll missed'); assert.true(RegExp('.', 's').test('\n'), 'dotAll basic'); assert.false(RegExp('[.]', 's').test('\n'), 'dotAll brackets #1'); assert.false(RegExp('[.].', '').test('.\n'), 'dotAll brackets #2'); assert.true(RegExp('[.].', 's').test('.\n'), 'dotAll brackets #3'); assert.true(RegExp('[[].', 's').test('[\n'), 'dotAll brackets #4'); assert.same(RegExp('.[.[].\\..', 's').source, '.[.[].\\..', 'dotAll correct source'); const string = '123\n456789\n012'; const re = RegExp('(\\d{3}).\\d{3}', 'sy'); let match = re.exec(string); assert.same(match[1], '123', 's with y #1'); assert.same(re.lastIndex, 7, 's with y #2'); match = re.exec(string); assert.same(match[1], '789', 's with y #3'); assert.same(re.lastIndex, 14, 's with y #4'); }); QUnit.test('RegExp NCG', assert => { assert.same(RegExp('(?
b)').exec('b').groups?.a, 'b', 'NCG #1'); // eslint-disable-next-line regexp/no-unused-capturing-group -- required for testing assert.same(RegExp('(b)').exec('b').groups, undefined, 'NCG #2'); const { groups } = RegExp('foo:(?\\w+),bar:(?\\w+)').exec('foo:abc,bar:def'); assert.deepEqual(groups, { foo: 'abc', bar: 'def' }, 'NCG #3'); // fails in Safari // assert.same(Object.getPrototypeOf(groups), null, 'NCG #4'); assert.same('foo:abc,bar:def'.replace(RegExp('foo:(?\\w+),bar:(?\\w+)'), '$,$'), 'def,abc', 'replace #1'); assert.same('foo:abc,bar:def'.replace(RegExp('foo:(?\\w+),bar:(?\\w+)'), (...args) => { const { foo, bar } = args.pop(); return `${ bar },${ foo }`; }), 'def,abc', 'replace #2'); assert.same('12345'.replaceAll(RegExp('(?[2-4])', 'g'), '$$'), '12233445', 'replaceAll'); assert.throws(() => RegExp('(?<1a>b)'), SyntaxError, 'incorrect group name #1'); assert.throws(() => RegExp('(?b)'), SyntaxError, 'incorrect group name #2'); assert.throws(() => RegExp('(?< a >b)'), SyntaxError, 'incorrect group name #3'); }); } core-js-3.33.2/tests/unit-global/es.regexp.dot-all.js000066400000000000000000000022341451776221300223250ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('RegExp#dotAll', assert => { const re = RegExp('.', 's'); assert.true(re.dotAll, '.dotAll is true'); assert.same(re.flags, 's', '.flags contains s'); assert.false(RegExp('.').dotAll, 'no'); assert.false(/a/.dotAll, 'no in literal'); const dotAllGetter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get; if (typeof dotAllGetter == 'function') { assert.throws(() => { dotAllGetter.call({}); }, undefined, '.dotAll getter can only be called on RegExp instances'); try { dotAllGetter.call(/a/); assert.required('.dotAll getter works on literals'); } catch { assert.avoid('.dotAll getter works on literals'); } try { dotAllGetter.call(new RegExp('a')); assert.required('.dotAll getter works on instances'); } catch { assert.avoid('.dotAll getter works on instances'); } assert.true(Object.hasOwn(RegExp.prototype, 'dotAll'), 'prototype has .dotAll property'); } }); } core-js-3.33.2/tests/unit-global/es.regexp.exec.js000066400000000000000000000056401451776221300217210ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('RegExp#exec lastIndex updating', assert => { let re = /b/; assert.same(re.lastIndex, 0, '.lastIndex starts at 0 for non-global regexps'); re.exec('abc'); assert.same(re.lastIndex, 0, '.lastIndex is not updated for non-global regexps'); re = /b/g; assert.same(re.lastIndex, 0, '.lastIndex starts at 0 for global regexps'); re.exec('abc'); assert.same(re.lastIndex, 2, '.lastIndex is updated for global regexps'); re = /b*/; re.exec('a'); assert.same(re.lastIndex, 0, '.lastIndex is not updated for non-global regexps if the match is empty'); re = /b*/g; re.exec('a'); assert.same(re.lastIndex, 0, '.lastIndex is not updated for global regexps if the match is empty'); }); QUnit.test('RegExp#exec capturing groups', assert => { assert.deepEqual(/(a?)/.exec('x'), ['', ''], '/(a?)/.exec("x") returns ["", ""]'); assert.deepEqual(/(a)?/.exec('x'), ['', undefined], '/(a)?/.exec("x") returns ["", undefined]'); // @nicolo-ribaudo: I don't know how to fix this in IE8. For the `/(a)?/` case it is fixed using // #replace, but here also #replace is buggy :( // assert.deepEqual(/(a?)?/.exec('x'), ['', undefined], '/(a?)?/.exec("x") returns ["", undefined]'); }); if (DESCRIPTORS) { QUnit.test('RegExp#exec regression', assert => { assert.throws(() => /l/.exec(Symbol('RegExp#exec test')), 'throws on symbol argument'); }); QUnit.test('RegExp#exec sticky', assert => { const re = new RegExp('a', 'y'); const str = 'bbabaab'; assert.same(re.lastIndex, 0, '#1'); assert.same(re.exec(str), null, '#2'); assert.same(re.lastIndex, 0, '#3'); re.lastIndex = 1; assert.same(re.exec(str), null, '#4'); assert.same(re.lastIndex, 0, '#5'); re.lastIndex = 2; const result = re.exec(str); assert.deepEqual(result, ['a'], '#6'); assert.same(result.index, 2, '#7'); assert.same(re.lastIndex, 3, '#8'); assert.same(re.exec(str), null, '#9'); assert.same(re.lastIndex, 0, '#10'); re.lastIndex = 4; assert.deepEqual(re.exec(str), ['a'], '#11'); assert.same(re.lastIndex, 5, '#12'); assert.deepEqual(re.exec(str), ['a'], '#13'); assert.same(re.lastIndex, 6, '#14'); assert.same(re.exec(str), null, '#15'); assert.same(re.lastIndex, 0, '#16'); }); QUnit.test('RegExp#exec sticky anchored', assert => { const regex = new RegExp('^foo', 'y'); assert.deepEqual(regex.exec('foo'), ['foo'], '#1'); regex.lastIndex = 2; assert.same(regex.exec('..foo'), null, '#2'); regex.lastIndex = 2; assert.same(regex.exec('.\nfoo'), null, '#3'); const regex2 = new RegExp('^foo', 'my'); regex2.lastIndex = 2; assert.same(regex2.exec('..foo'), null, '#4'); regex2.lastIndex = 2; assert.deepEqual(regex2.exec('.\nfoo'), ['foo'], '#5'); assert.same(regex2.lastIndex, 5, '#6'); }); } core-js-3.33.2/tests/unit-global/es.regexp.flags.js000066400000000000000000000031321451776221300220630ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals, regexp/sort-flags, regexp/no-useless-flag -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('RegExp#flags', assert => { assert.nonEnumerable(RegExp.prototype, 'flags'); assert.same(/./g.flags, 'g', '/./g.flags is "g"'); assert.same(/./.flags, '', '/./.flags is ""'); assert.same(RegExp('.', 'gim').flags, 'gim', 'RegExp(".", "gim").flags is "gim"'); assert.same(RegExp('.').flags, '', 'RegExp(".").flags is ""'); assert.same(/./gim.flags, 'gim', '/./gim.flags is "gim"'); assert.same(/./gmi.flags, 'gim', '/./gmi.flags is "gim"'); assert.same(/./mig.flags, 'gim', '/./mig.flags is "gim"'); assert.same(/./mgi.flags, 'gim', '/./mgi.flags is "gim"'); let INDICES_SUPPORT = true; try { RegExp('.', 'd'); } catch { INDICES_SUPPORT = false; } const O = {}; // modern V8 bug let calls = ''; const expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; function addGetter(key, chr) { Object.defineProperty(O, key, { get() { calls += chr; return true; } }); } const pairs = { dotAll: 's', global: 'g', ignoreCase: 'i', multiline: 'm', sticky: 'y', }; if (INDICES_SUPPORT) pairs.hasIndices = 'd'; for (const key in pairs) addGetter(key, pairs[key]); const result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O); assert.same(result, expected, 'proper order, result'); assert.same(calls, expected, 'proper order, calls'); }); } core-js-3.33.2/tests/unit-global/es.regexp.sticky.js000066400000000000000000000026661451776221300223100ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) { QUnit.test('RegExp#sticky', assert => { const re = new RegExp('a', 'y'); assert.true(re.sticky, '.sticky is true'); assert.same(re.flags, 'y', '.flags contains y'); assert.false(/a/.sticky); const stickyGetter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get; if (typeof stickyGetter == 'function') { // Old firefox versions set a non-configurable non-writable .sticky property // It works correctly, but it isn't a getter and it can't be polyfilled. // We need to skip these tests. assert.throws(() => { stickyGetter.call({}); }, undefined, '.sticky getter can only be called on RegExp instances'); try { stickyGetter.call(/a/); assert.required('.sticky getter works on literals'); } catch { assert.avoid('.sticky getter works on literals'); } try { stickyGetter.call(new RegExp('a')); assert.required('.sticky getter works on instances'); } catch { assert.avoid('.sticky getter works on instances'); } assert.true(Object.hasOwn(RegExp.prototype, 'sticky'), 'prototype has .sticky property'); // relaxed for early implementations // assert.same(RegExp.prototype.sticky, undefined, '.sticky is undefined on prototype'); } }); } core-js-3.33.2/tests/unit-global/es.regexp.test.js000066400000000000000000000010161451776221300217450ustar00rootroot00000000000000 QUnit.test('RegExp#test delegates to exec', assert => { const exec = function (...args) { execCalled = true; return /./.exec.apply(this, args); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.true(re.test('abc'), '#1'); assert.true(execCalled, '#2'); re = /a/; // Not a function, should be ignored re.exec = 3; assert.true(re.test('abc'), '#3'); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re.test('abc', '#4')); }); core-js-3.33.2/tests/unit-global/es.regexp.to-string.js000066400000000000000000000027731451776221300227270ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals, regexp/sort-flags, regexp/no-useless-flag -- required for testing */ import { STRICT } from '../helpers/constants.js'; QUnit.test('RegExp#toString', assert => { const { toString } = RegExp.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(RegExp.prototype, 'toString'); assert.same(String(/pattern/), '/pattern/'); assert.same(String(/pattern/i), '/pattern/i'); assert.same(String(/pattern/mi), '/pattern/im'); assert.same(String(/pattern/im), '/pattern/im'); assert.same(String(/pattern/mgi), '/pattern/gim'); assert.same(String(new RegExp('pattern')), '/pattern/'); assert.same(String(new RegExp('pattern', 'i')), '/pattern/i'); assert.same(String(new RegExp('pattern', 'mi')), '/pattern/im'); assert.same(String(new RegExp('pattern', 'im')), '/pattern/im'); assert.same(String(new RegExp('pattern', 'mgi')), '/pattern/gim'); assert.same(toString.call({ source: 'foo', flags: 'bar', }), '/foo/bar'); assert.same(toString.call({}), '/undefined/undefined'); if (STRICT) { assert.throws(() => toString.call(7)); assert.throws(() => toString.call('a')); assert.throws(() => toString.call(false)); assert.throws(() => toString.call(null)); assert.throws(() => toString.call(undefined)); } assert.throws(() => toString.call({ source: Symbol('RegExp#toString test'), flags: 'g', }), 'throws on symbol'); }); core-js-3.33.2/tests/unit-global/es.set.js000066400000000000000000000301661451776221300203000ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite -- required for testing */ import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; import { createIterable, is, nativeSubclass } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const { getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols, freeze } = Object; const { ownKeys } = GLOBAL.Reflect || {}; const { from } = Array; QUnit.test('Set', assert => { assert.isFunction(Set); assert.name(Set, 'Set'); assert.arity(Set, 0); assert.looksNative(Set); assert.true('add' in Set.prototype, 'add in Set.prototype'); assert.true('clear' in Set.prototype, 'clear in Set.prototype'); assert.true('delete' in Set.prototype, 'delete in Set.prototype'); assert.true('forEach' in Set.prototype, 'forEach in Set.prototype'); assert.true('has' in Set.prototype, 'has in Set.prototype'); assert.true(new Set() instanceof Set, 'new Set instanceof Set'); let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); assert.same(set.size, 3); const result = []; set.forEach(val => { result.push(val); }); assert.deepEqual(result, [1, 2, 3]); assert.same(new Set(createIterable([1, 2, 3])).size, 3, 'Init from iterable'); assert.same(new Set([freeze({}), 1]).size, 2, 'Support frozen objects'); assert.same(new Set([NaN, NaN, NaN]).size, 1); assert.deepEqual(from(new Set([3, 4]).add(2).add(1)), [3, 4, 2, 1]); let done = false; const { add } = Set.prototype; // eslint-disable-next-line no-extend-native -- required for testing Set.prototype.add = function () { throw new Error(); }; try { new Set(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } // eslint-disable-next-line no-extend-native -- required for testing Set.prototype.add = add; assert.true(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new Set(array); assert.true(done); const object = {}; new Set().add(object); if (DESCRIPTORS) { const results = []; for (const key in results) keys.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Set); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof Set, 'correct subclassing with native classes #2'); assert.true(new Subclass().add(2).has(2), 'correct subclassing with native classes #3'); } const buffer = new ArrayBuffer(8); set = new Set([buffer]); assert.true(set.has(buffer), 'works with ArrayBuffer keys'); }); QUnit.test('Set#add', assert => { assert.isFunction(Set.prototype.add); assert.name(Set.prototype.add, 'add'); assert.arity(Set.prototype.add, 1); assert.looksNative(Set.prototype.add); assert.nonEnumerable(Set.prototype, 'add'); const array = []; let set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.same(set.size, 5); const chain = set.add(NaN); assert.same(chain, set); assert.same(set.size, 5); set.add(2); assert.same(set.size, 5); set.add(array); assert.same(set.size, 5); set.add([]); assert.same(set.size, 6); set.add(4); assert.same(set.size, 7); const frozen = freeze({}); set = new Set(); set.add(frozen); assert.true(set.has(frozen)); }); QUnit.test('Set#clear', assert => { assert.isFunction(Set.prototype.clear); assert.name(Set.prototype.clear, 'clear'); assert.arity(Set.prototype.clear, 0); assert.looksNative(Set.prototype.clear); assert.nonEnumerable(Set.prototype, 'clear'); let set = new Set(); set.clear(); assert.same(set.size, 0); set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.clear(); assert.same(set.size, 0); assert.false(set.has(1)); assert.false(set.has(2)); assert.false(set.has(3)); const frozen = freeze({}); set = new Set(); set.add(1); set.add(frozen); set.clear(); assert.same(set.size, 0, 'Support frozen objects'); assert.false(set.has(1)); assert.false(set.has(frozen)); }); QUnit.test('Set#delete', assert => { assert.isFunction(Set.prototype.delete); if (NATIVE) assert.name(Set.prototype.delete, 'delete'); assert.arity(Set.prototype.delete, 1); assert.looksNative(Set.prototype.delete); assert.nonEnumerable(Set.prototype, 'delete'); const array = []; const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.same(set.size, 5); assert.true(set.delete(NaN)); assert.same(set.size, 4); assert.false(set.delete(4)); assert.same(set.size, 4); set.delete([]); assert.same(set.size, 4); set.delete(array); assert.same(set.size, 3); const frozen = freeze({}); set.add(frozen); assert.same(set.size, 4); set.delete(frozen); assert.same(set.size, 3); }); QUnit.test('Set#forEach', assert => { assert.isFunction(Set.prototype.forEach); assert.name(Set.prototype.forEach, 'forEach'); assert.arity(Set.prototype.forEach, 1); assert.looksNative(Set.prototype.forEach); assert.nonEnumerable(Set.prototype, 'forEach'); let result = []; let count = 0; let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.forEach(value => { count++; result.push(value); }); assert.same(count, 3); assert.deepEqual(result, [1, 2, 3]); set = new Set(); set.add('0'); set.add('1'); set.add('2'); set.add('3'); result = ''; set.forEach(it => { result += it; if (it === '2') { set.delete('2'); set.delete('3'); set.delete('1'); set.add('4'); } }); assert.same(result, '0124'); set = new Set(); set.add('0'); result = ''; set.forEach(it => { set.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.same(result, '0'); assert.throws(() => { Set.prototype.forEach.call(new Map(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Set#has', assert => { assert.isFunction(Set.prototype.has); assert.name(Set.prototype.has, 'has'); assert.arity(Set.prototype.has, 1); assert.looksNative(Set.prototype.has); assert.nonEnumerable(Set.prototype, 'has'); const array = []; const frozen = freeze({}); const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(frozen); set.add(array); assert.true(set.has(NaN)); assert.true(set.has(array)); assert.true(set.has(frozen)); assert.true(set.has(2)); assert.false(set.has(4)); assert.false(set.has([])); }); QUnit.test('Set#size', assert => { assert.nonEnumerable(Set.prototype, 'size'); const set = new Set(); set.add(1); const { size } = set; assert.same(typeof size, 'number', 'size is number'); assert.same(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Set.prototype, 'size'); const getter = sizeDescriptor && sizeDescriptor.get; const setter = sizeDescriptor && sizeDescriptor.set; assert.same(typeof getter, 'function', 'size is getter'); assert.same(typeof setter, 'undefined', 'size is not setter'); assert.throws(() => Set.prototype.size, TypeError); } }); QUnit.test('Set & -0', assert => { let set = new Set(); set.add(-0); assert.same(set.size, 1); assert.true(set.has(0)); assert.true(set.has(-0)); set.forEach(it => { assert.false(is(it, -0)); }); set.delete(-0); assert.same(set.size, 0); set = new Set([-0]); set.forEach(key => { assert.false(is(key, -0)); }); set = new Set(); set.add(4); set.add(3); set.add(2); set.add(1); set.add(0); assert.true(set.has(-0)); }); QUnit.test('Set#@@toStringTag', assert => { assert.same(Set.prototype[Symbol.toStringTag], 'Set', 'Set::@@toStringTag is `Set`'); assert.same(String(new Set()), '[object Set]', 'correct stringification'); }); QUnit.test('Set Iterator', assert => { const set = new Set(); set.add('a'); set.add('b'); set.add('c'); set.add('d'); const results = []; const iterator = set.keys(); results.push(iterator.next().value); assert.true(set.delete('a')); assert.true(set.delete('b')); assert.true(set.delete('c')); set.add('e'); results.push(iterator.next().value, iterator.next().value); assert.true(iterator.next().done); set.add('f'); assert.true(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Set#keys', assert => { assert.isFunction(Set.prototype.keys); assert.name(Set.prototype.keys, 'values'); assert.arity(Set.prototype.keys, 0); assert.looksNative(Set.prototype.keys); assert.same(Set.prototype.keys, Set.prototype.values); assert.nonEnumerable(Set.prototype, 'keys'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#values', assert => { assert.isFunction(Set.prototype.values); assert.name(Set.prototype.values, 'values'); assert.arity(Set.prototype.values, 0); assert.looksNative(Set.prototype.values); assert.nonEnumerable(Set.prototype, 'values'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#entries', assert => { assert.isFunction(Set.prototype.entries); assert.name(Set.prototype.entries, 'entries'); assert.arity(Set.prototype.entries, 0); assert.looksNative(Set.prototype.entries); assert.nonEnumerable(Set.prototype, 'entries'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['w', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['e', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#@@iterator', assert => { assert.isIterable(Set.prototype); assert.name(Set.prototype[Symbol.iterator], 'values'); assert.arity(Set.prototype[Symbol.iterator], 0); assert.looksNative(Set.prototype[Symbol.iterator]); assert.same(Set.prototype[Symbol.iterator], Set.prototype.values); assert.nonEnumerable(Set.prototype, 'values'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.same(String(iterator), '[object Set Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-global/es.string.anchor.js000066400000000000000000000012171451776221300222570ustar00rootroot00000000000000QUnit.test('String#anchor', assert => { const { anchor } = String.prototype; assert.isFunction(anchor); assert.arity(anchor, 1); assert.name(anchor, 'anchor'); assert.looksNative(anchor); assert.nonEnumerable(String.prototype, 'anchor'); assert.same('a'.anchor('b'), 'a', 'lower case'); assert.same('a'.anchor('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('anchor test'); assert.throws(() => anchor.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => anchor.call('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.string.at-alternative.js000066400000000000000000000022141451776221300237230ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#at', assert => { const { at } = String.prototype; assert.isFunction(at); assert.arity(at, 1); assert.name(at, 'at'); assert.looksNative(at); assert.nonEnumerable(String.prototype, 'at'); assert.same('1', '123'.at(0)); assert.same('2', '123'.at(1)); assert.same('3', '123'.at(2)); assert.same(undefined, '123'.at(3)); assert.same('3', '123'.at(-1)); assert.same('2', '123'.at(-2)); assert.same('1', '123'.at(-3)); assert.same(undefined, '123'.at(-4)); assert.same('1', '123'.at(0.4)); assert.same('1', '123'.at(0.5)); assert.same('1', '123'.at(0.6)); assert.same('1', '1'.at(NaN)); assert.same('1', '1'.at()); assert.same('1', '123'.at(-0)); // TODO: disabled by default because of the conflict with old proposal // assert.same('\uD842', '𠮷'.at()); assert.same('1', at.call({ toString() { return '123'; } }, 0)); assert.throws(() => at.call(Symbol('at-alternative test'), 0), 'throws on symbol context'); if (STRICT) { assert.throws(() => at.call(null, 0), TypeError); assert.throws(() => at.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.big.js000066400000000000000000000006531451776221300215510ustar00rootroot00000000000000QUnit.test('String#big', assert => { const { big } = String.prototype; assert.isFunction(big); assert.arity(big, 0); assert.name(big, 'big'); assert.looksNative(big); assert.nonEnumerable(String.prototype, 'big'); assert.same('a'.big(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => big.call(Symbol('big test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.blink.js000066400000000000000000000007051451776221300221050ustar00rootroot00000000000000QUnit.test('String#blink', assert => { const { blink } = String.prototype; assert.isFunction(blink); assert.arity(blink, 0); assert.name(blink, 'blink'); assert.looksNative(blink); assert.nonEnumerable(String.prototype, 'blink'); assert.same('a'.blink(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => blink.call(Symbol('blink test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.bold.js000066400000000000000000000006621451776221300217300ustar00rootroot00000000000000QUnit.test('String#bold', assert => { const { bold } = String.prototype; assert.isFunction(bold); assert.arity(bold, 0); assert.name(bold, 'bold'); assert.looksNative(bold); assert.nonEnumerable(String.prototype, 'bold'); assert.same('a'.bold(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => bold.call(Symbol('bold test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.code-point-at.js000066400000000000000000000066611451776221300234600ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#codePointAt', assert => { const { codePointAt } = String.prototype; assert.isFunction(codePointAt); assert.arity(codePointAt, 1); assert.name(codePointAt, 'codePointAt'); assert.looksNative(codePointAt); assert.nonEnumerable(String.prototype, 'codePointAt'); assert.same('abc\uD834\uDF06def'.codePointAt(''), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt('_'), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(-Infinity), undefined); assert.same('abc\uD834\uDF06def'.codePointAt(-1), undefined); assert.same('abc\uD834\uDF06def'.codePointAt(-0), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(0), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(3), 0x1D306); assert.same('abc\uD834\uDF06def'.codePointAt(4), 0xDF06); assert.same('abc\uD834\uDF06def'.codePointAt(5), 0x64); assert.same('abc\uD834\uDF06def'.codePointAt(42), undefined); assert.same('abc\uD834\uDF06def'.codePointAt(Infinity), undefined); assert.same('abc\uD834\uDF06def'.codePointAt(Infinity), undefined); assert.same('abc\uD834\uDF06def'.codePointAt(NaN), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(false), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(null), 0x61); assert.same('abc\uD834\uDF06def'.codePointAt(undefined), 0x61); assert.same('\uD834\uDF06def'.codePointAt(''), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt('1'), 0xDF06); assert.same('\uD834\uDF06def'.codePointAt('_'), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(-1), undefined); assert.same('\uD834\uDF06def'.codePointAt(-0), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(0), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(1), 0xDF06); assert.same('\uD834\uDF06def'.codePointAt(42), undefined); assert.same('\uD834\uDF06def'.codePointAt(false), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(null), 0x1D306); assert.same('\uD834\uDF06def'.codePointAt(undefined), 0x1D306); assert.same('\uD834abc'.codePointAt(''), 0xD834); assert.same('\uD834abc'.codePointAt('_'), 0xD834); assert.same('\uD834abc'.codePointAt(), 0xD834); assert.same('\uD834abc'.codePointAt(-1), undefined); assert.same('\uD834abc'.codePointAt(-0), 0xD834); assert.same('\uD834abc'.codePointAt(0), 0xD834); assert.same('\uD834abc'.codePointAt(false), 0xD834); assert.same('\uD834abc'.codePointAt(NaN), 0xD834); assert.same('\uD834abc'.codePointAt(null), 0xD834); assert.same('\uD834abc'.codePointAt(undefined), 0xD834); assert.same('\uDF06abc'.codePointAt(''), 0xDF06); assert.same('\uDF06abc'.codePointAt('_'), 0xDF06); assert.same('\uDF06abc'.codePointAt(), 0xDF06); assert.same('\uDF06abc'.codePointAt(-1), undefined); assert.same('\uDF06abc'.codePointAt(-0), 0xDF06); assert.same('\uDF06abc'.codePointAt(0), 0xDF06); assert.same('\uDF06abc'.codePointAt(false), 0xDF06); assert.same('\uDF06abc'.codePointAt(NaN), 0xDF06); assert.same('\uDF06abc'.codePointAt(null), 0xDF06); assert.same('\uDF06abc'.codePointAt(undefined), 0xDF06); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => codePointAt.call(Symbol('codePointAt test'), 1), 'throws on symbol context'); } if (STRICT) { assert.throws(() => codePointAt.call(null, 0), TypeError); assert.throws(() => codePointAt.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.ends-with.js000066400000000000000000000031611451776221300227070ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#endsWith', assert => { const { endsWith } = String.prototype; assert.isFunction(endsWith); assert.arity(endsWith, 1); assert.name(endsWith, 'endsWith'); assert.looksNative(endsWith); assert.nonEnumerable(String.prototype, 'endsWith'); assert.true('undefined'.endsWith()); assert.false('undefined'.endsWith(null)); assert.true('abc'.endsWith('')); assert.true('abc'.endsWith('c')); assert.true('abc'.endsWith('bc')); assert.false('abc'.endsWith('ab')); assert.true('abc'.endsWith('', NaN)); assert.false('abc'.endsWith('c', -1)); assert.true('abc'.endsWith('a', 1)); assert.true('abc'.endsWith('c', Infinity)); assert.true('abc'.endsWith('a', true)); assert.false('abc'.endsWith('c', 'x')); assert.false('abc'.endsWith('a', 'x')); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('endsWith test'); assert.throws(() => endsWith.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => endsWith.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => endsWith.call(null, '.'), TypeError); assert.throws(() => endsWith.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.endsWith(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.endsWith(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.endsWith(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.endsWith(object), TypeError); }); core-js-3.33.2/tests/unit-global/es.string.fixed.js000066400000000000000000000006771451776221300221150ustar00rootroot00000000000000QUnit.test('String#fixed', assert => { const { fixed } = String.prototype; assert.isFunction(fixed); assert.arity(fixed, 0); assert.name(fixed, 'fixed'); assert.looksNative(fixed); assert.nonEnumerable(String.prototype, 'fixed'); assert.same('a'.fixed(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => fixed.call(Symbol('fixed test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.fontcolor.js000066400000000000000000000011211451776221300230040ustar00rootroot00000000000000QUnit.test('String#fontcolor', assert => { const { fontcolor } = String.prototype; assert.isFunction(fontcolor); assert.arity(fontcolor, 1); assert.name(fontcolor, 'fontcolor'); assert.looksNative(fontcolor); assert.nonEnumerable(String.prototype, 'fontcolor'); assert.same('a'.fontcolor('b'), 'a', 'lower case'); assert.same('a'.fontcolor('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => fontcolor.call(Symbol('fontcolor test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.fontsize.js000066400000000000000000000012651451776221300226510ustar00rootroot00000000000000QUnit.test('String#fontsize', assert => { const { fontsize } = String.prototype; assert.isFunction(fontsize); assert.arity(fontsize, 1); assert.name(fontsize, 'fontsize'); assert.looksNative(fontsize); assert.nonEnumerable(String.prototype, 'fontsize'); assert.same('a'.fontsize('b'), 'a', 'lower case'); assert.same('a'.fontsize('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('fontsize test'); assert.throws(() => fontsize.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => fontsize.call('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.string.from-code-point.js000066400000000000000000000037521451776221300240150ustar00rootroot00000000000000/* eslint-disable prefer-spread -- required for testing */ QUnit.test('String.fromCodePoint', assert => { const { fromCodePoint } = String; assert.isFunction(fromCodePoint); assert.arity(fromCodePoint, 1); assert.name(fromCodePoint, 'fromCodePoint'); assert.looksNative(fromCodePoint); assert.nonEnumerable(String, 'fromCodePoint'); assert.same(fromCodePoint(''), '\0'); assert.same(fromCodePoint(), ''); assert.same(fromCodePoint(-0), '\0'); assert.same(fromCodePoint(0), '\0'); assert.same(fromCodePoint(0x1D306), '\uD834\uDF06'); assert.same(fromCodePoint(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07'); assert.same(fromCodePoint(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07'); assert.same(fromCodePoint(false), '\0'); assert.same(fromCodePoint(null), '\0'); assert.throws(() => fromCodePoint('_'), RangeError); assert.throws(() => fromCodePoint('+Infinity'), RangeError); assert.throws(() => fromCodePoint('-Infinity'), RangeError); assert.throws(() => fromCodePoint(-1), RangeError); assert.throws(() => fromCodePoint(0x10FFFF + 1), RangeError); assert.throws(() => fromCodePoint(3.14), RangeError); assert.throws(() => fromCodePoint(3e-2), RangeError); assert.throws(() => fromCodePoint(-Infinity), RangeError); assert.throws(() => fromCodePoint(Infinity), RangeError); assert.throws(() => fromCodePoint(NaN), RangeError); assert.throws(() => fromCodePoint(undefined), RangeError); assert.throws(() => fromCodePoint({}), RangeError); assert.throws(() => fromCodePoint(/./), RangeError); let number = 0x60; assert.same(fromCodePoint({ valueOf() { return ++number; }, }), 'a'); assert.same(number, 0x61); // one code unit per symbol let counter = 2 ** 15 * 3 / 2; let result = []; while (--counter >= 0) result.push(0); // should not throw fromCodePoint.apply(null, result); counter = 2 ** 15 * 3 / 2; result = []; while (--counter >= 0) result.push(0xFFFF + 1); // should not throw fromCodePoint.apply(null, result); }); core-js-3.33.2/tests/unit-global/es.string.includes.js000066400000000000000000000024041451776221300226120ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#includes', assert => { const { includes } = String.prototype; assert.isFunction(includes); assert.arity(includes, 1); assert.name(includes, 'includes'); assert.looksNative(includes); assert.nonEnumerable(String.prototype, 'includes'); assert.false('abc'.includes()); assert.true('aundefinedb'.includes()); assert.true('abcd'.includes('b', 1)); assert.false('abcd'.includes('b', 2)); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('includes test'); assert.throws(() => includes.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => includes.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => includes.call(null, '.'), TypeError); assert.throws(() => includes.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.includes(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.includes(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.includes(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.includes(object), TypeError); }); core-js-3.33.2/tests/unit-global/es.string.is-well-formed.js000066400000000000000000000031141451776221300236310ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#isWellFormed', assert => { const { isWellFormed } = String.prototype; assert.isFunction(isWellFormed); assert.arity(isWellFormed, 0); assert.name(isWellFormed, 'isWellFormed'); assert.looksNative(isWellFormed); assert.nonEnumerable(String.prototype, 'isWellFormed'); assert.true(isWellFormed.call('a'), 'a'); assert.true(isWellFormed.call('abc'), 'abc'); assert.true(isWellFormed.call('💩'), '💩'); assert.true(isWellFormed.call('💩b'), '💩b'); assert.true(isWellFormed.call('a💩'), '💩'); assert.true(isWellFormed.call('a💩b'), 'a💩b'); assert.true(isWellFormed.call('💩a💩'), '💩a💩'); assert.true(!isWellFormed.call('\uD83D'), '\uD83D'); assert.true(!isWellFormed.call('\uDCA9'), '\uDCA9'); assert.true(!isWellFormed.call('\uDCA9\uD83D'), '\uDCA9\uD83D'); assert.true(!isWellFormed.call('a\uD83D'), 'a\uD83D'); assert.true(!isWellFormed.call('\uDCA9a'), '\uDCA9a'); assert.true(!isWellFormed.call('a\uD83Da'), 'a\uD83Da'); assert.true(!isWellFormed.call('a\uDCA9a'), 'a\uDCA9a'); assert.true(isWellFormed.call({ toString() { return 'abc'; }, }), 'conversion #1'); assert.true(!isWellFormed.call({ toString() { return '\uD83D'; }, }), 'conversion #2'); if (STRICT) { assert.throws(() => isWellFormed.call(null), TypeError, 'coercible #1'); assert.throws(() => isWellFormed.call(undefined), TypeError, 'coercible #2'); } assert.throws(() => isWellFormed.call(Symbol('isWellFormed test')), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-global/es.string.italics.js000066400000000000000000000007231451776221300224360ustar00rootroot00000000000000QUnit.test('String#italics', assert => { const { italics } = String.prototype; assert.isFunction(italics); assert.arity(italics, 0); assert.name(italics, 'italics'); assert.looksNative(italics); assert.nonEnumerable(String.prototype, 'italics'); assert.same('a'.italics(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => italics.call(Symbol('italics test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.iterator.js000066400000000000000000000024171451776221300226410ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#@@iterator', assert => { assert.isIterable(String.prototype); let iterator = 'qwe'[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'String Iterator'); assert.same(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.same(Array.from('𠮷𠮷𠮷').length, 3); iterator = '𠮷𠮷𠮷'[Symbol.iterator](); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); // early FF case with native method, but polyfilled `Symbol` // assert.throws(() => ''[Symbol.iterator].call(Symbol()), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-global/es.string.link.js000066400000000000000000000011651451776221300217440ustar00rootroot00000000000000QUnit.test('String#link', assert => { const { link } = String.prototype; assert.isFunction(link); assert.arity(link, 1); assert.name(link, 'link'); assert.looksNative(link); assert.nonEnumerable(String.prototype, 'link'); assert.same('a'.link('b'), 'a', 'lower case'); assert.same('a'.link('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('link test'); assert.throws(() => link.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => link.call('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.string.match-all.js000066400000000000000000000073761451776221300226630ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; QUnit.test('String#matchAll', assert => { const { matchAll } = String.prototype; const { assign } = Object; assert.isFunction(matchAll); assert.arity(matchAll, 1); assert.name(matchAll, 'matchAll'); assert.looksNative(matchAll); assert.nonEnumerable(String.prototype, 'matchAll'); let data = ['aabc', { toString() { return 'aabc'; } }]; for (const target of data) { const iterator = matchAll.call(target, /[ac]/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 0, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['c'], { input: 'aabc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); } let iterator = '1111a2b3cccc'.matchAll(/(\d)(\D)/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'RegExp String Iterator'); assert.same(String(iterator), '[object RegExp String Iterator]'); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); // eslint-disable-next-line regexp/no-missing-g-flag -- required for testing assert.throws(() => '1111a2b3cccc'.matchAll(/(\d)(\D)/), TypeError); iterator = '1111a2b3cccc'.matchAll('(\\d)(\\D)'); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* IE8- issue iterator = 'abc'.matchAll(/\B/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 2, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); */ data = [null, undefined, NaN, 42, {}, []]; for (const target of data) { assert.notThrows(() => ''.matchAll(target), `Not throws on ${ target } as the first argument`); } if (DESCRIPTORS && typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('matchAll test'); assert.throws(() => matchAll.call(symbol, /./), 'throws on symbol context'); assert.throws(() => matchAll.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => matchAll.call(null, /./g), TypeError, 'Throws on null as `this`'); assert.throws(() => matchAll.call(undefined, /./g), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.33.2/tests/unit-global/es.string.match.js000066400000000000000000000256041451776221300221070ustar00rootroot00000000000000// TODO: fix escaping in regexps /* eslint-disable prefer-regex-literals, regexp/prefer-regexp-exec -- required for testing */ import { GLOBAL, NATIVE, STRICT } from '../helpers/constants.js'; import { patchRegExp$exec } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.match); assert.arity(''.match, 1); assert.name(''.match, 'match'); assert.looksNative(''.match); assert.nonEnumerable(String.prototype, 'match'); let instance = Object(true); instance.match = String.prototype.match; assert.same(instance.match(true)[0], 'true', 'S15.5.4.10_A1_T1'); instance = Object(false); instance.match = String.prototype.match; assert.same(instance.match(false)[0], 'false', 'S15.5.4.10_A1_T2'); let matched = ''.match(); let expected = RegExp().exec(''); assert.same(matched.length, expected.length, 'S15.5.4.10_A1_T4 #1'); assert.same(matched.index, expected.index, 'S15.5.4.10_A1_T4 #2'); assert.same(matched.input, expected.input, 'S15.5.4.10_A1_T4 #3'); assert.same('gnulluna'.match(null)[0], 'null', 'S15.5.4.10_A1_T5'); matched = Object('undefined').match(undefined); expected = RegExp(undefined).exec('undefined'); assert.same(matched.length, expected.length, 'S15.5.4.10_A1_T6 #1'); assert.same(matched.index, expected.index, 'S15.5.4.10_A1_T6 #2'); assert.same(matched.input, expected.input, 'S15.5.4.10_A1_T6 #3'); let object = { toString() { /* empty */ } }; matched = String(object).match(undefined); expected = RegExp(undefined).exec('undefined'); assert.same(matched.length, expected.length, 'S15.5.4.10_A1_T8 #1'); assert.same(matched.index, expected.index, 'S15.5.4.10_A1_T8 #2'); assert.same(matched.input, expected.input, 'S15.5.4.10_A1_T8 #3'); object = { toString() { return '\u0041B'; } }; let string = 'ABB\u0041BABAB'; assert.same(string.match(object)[0], 'AB', 'S15.5.4.10_A1_T10'); object = { toString() { throw new Error('intostr'); } }; string = 'ABB\u0041BABAB'; try { string.match(object); assert.avoid('S15.5.4.10_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intostr', `S15.5.4.10_A1_T11 #1.1: Exception === "intostr". Actual: ${ error }`); } object = { toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }; string = 'ABB\u0041BABAB'; try { string.match(object); assert.avoid('S15.5.4.10_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intostr', `S15.5.4.10_A1_T12 #1.1: Exception === "intostr". Actual: ${ error }`); } object = { toString() { return {}; }, valueOf() { return 1; }, }; assert.same('ABB\u0041B\u0031ABAB\u0031BBAA'.match(object)[0], '1', 'S15.5.4.10_A1_T13 #1'); assert.same('ABB\u0041B\u0031ABAB\u0031BBAA'.match(object).length, 1, 'S15.5.4.10_A1_T13 #2'); let regexp = RegExp('77'); assert.same('ABB\u0041BABAB\u0037\u0037BBAA'.match(regexp)[0], '77', 'S15.5.4.10_A1_T14'); string = '1234567890'; assert.same(string.match(3)[0], '3', 'S15.5.4.10_A2_T1 #1'); assert.same(string.match(3).length, 1, 'S15.5.4.10_A2_T1 #2'); assert.same(string.match(3).index, 2, 'S15.5.4.10_A2_T1 #3'); assert.same(string.match(3).input, string, 'S15.5.4.10_A2_T1 #4'); let matches = ['34', '34', '34']; string = '343443444'; assert.same(string.match(/34/g).length, 3, 'S15.5.4.10_A2_T2 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(/34/g)[i], matches[i], 'S15.5.4.10_A2_T2 #2'); } matches = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']; string = '123456abcde7890'; assert.same(string.match(/\d/g).length, 10, 'S15.5.4.10_A2_T3 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(/\d/g)[i], matches[i], 'S15.5.4.10_A2_T3 #2'); } matches = ['12', '34', '56', '78', '90']; string = '123456abcde7890'; assert.same(string.match(/\d{2}/g).length, 5, 'S15.5.4.10_A2_T4 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(/\d{2}/g)[i], matches[i], 'S15.5.4.10_A2_T4 #2'); } matches = ['ab', 'cd']; string = '123456abcde7890'; assert.same(string.match(/\D{2}/g).length, 2, 'S15.5.4.10_A2_T5 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(/\D{2}/g)[i], matches[i], 'S15.5.4.10_A2_T5 #2'); } string = 'Boston, Mass. 02134'; assert.same(string.match(/(\d{5})([ -]?\d{4})?$/)[0], '02134', 'S15.5.4.10_A2_T6 #1'); assert.same(string.match(/(\d{5})([ -]?\d{4})?$/)[1], '02134', 'S15.5.4.10_A2_T6 #2'); if (NATIVE) assert.same(string.match(/(\d{5})([ -]?\d{4})?$/)[2], undefined, 'S15.5.4.10_A2_T6 #3'); assert.same(string.match(/(\d{5})([ -]?\d{4})?$/).length, 3, 'S15.5.4.10_A2_T6 #4'); assert.same(string.match(/(\d{5})([ -]?\d{4})?$/).index, 14, 'S15.5.4.10_A2_T6 #5'); assert.same(string.match(/(\d{5})([ -]?\d{4})?$/).input, string, 'S15.5.4.10_A2_T6 #6'); string = 'Boston, Mass. 02134'; assert.same(string.match(/(\d{5})([ -]?\d{4})?$/g).length, 1, 'S15.5.4.10_A2_T7 #1'); assert.same(string.match(/(\d{5})([ -]?\d{4})?$/g)[0], '02134', 'S15.5.4.10_A2_T7 #2'); /* IE8- buggy here (empty string instead of `undefined`), but we don't polyfill base `.match` logic matches = ['02134', '02134', undefined]; string = 'Boston, MA 02134'; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = 0; assert.same(string.match(regexp).length, 3, 'S15.5.4.10_A2_T8 #1'); assert.same(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T8 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T8 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.length; assert.same(string.match(regexp).length, 3, 'S15.5.4.10_A2_T9 #1'); assert.same(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T9 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T9 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.lastIndexOf('0'); assert.same(string.match(regexp).length, 3, 'S15.5.4.10_A2_T10 #1'); assert.same(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T10 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T10 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.lastIndexOf('0') + 1; assert.same(string.match(regexp).length, 3, 'S15.5.4.10_A2_T11 #1'); assert.same(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T11 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T11 #3'); } */ string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; assert.same(string.match(regexp).length, 1, 'S15.5.4.10_A2_T12 #1'); assert.same(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T12 #2'); regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = 0; string = 'Boston, MA 02134'; assert.same(string.match(regexp).length, 1, 'S15.5.4.10_A2_T13 #1'); assert.same(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T13 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.length; assert.same(string.match(regexp).length, 1, 'S15.5.4.10_A2_T14 #1'); assert.same(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T14 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.lastIndexOf('0'); assert.same(string.match(regexp).length, 1, 'S15.5.4.10_A2_T15 #1'); assert.same(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T15 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.lastIndexOf('0') + 1; assert.same(string.match(regexp).length, 1, 'S15.5.4.10_A2_T16 #1'); assert.same(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T16 #2'); regexp = /0./; let number = 10203040506070809000; assert.same(''.match.call(number, regexp)[0], '02', 'S15.5.4.10_A2_T17 #1'); assert.same(''.match.call(number, regexp).length, 1, 'S15.5.4.10_A2_T17 #2'); assert.same(''.match.call(number, regexp).index, 1, 'S15.5.4.10_A2_T17 #3'); assert.same(''.match.call(number, regexp).input, String(number), 'S15.5.4.10_A2_T17 #4'); regexp = /0./; regexp.lastIndex = 0; number = 10203040506070809000; assert.same(''.match.call(number, regexp)[0], '02', 'S15.5.4.10_A2_T18 #1'); assert.same(''.match.call(number, regexp).length, 1, 'S15.5.4.10_A2_T18 #2'); assert.same(''.match.call(number, regexp).index, 1, 'S15.5.4.10_A2_T18 #3'); assert.same(''.match.call(number, regexp).input, String(number), 'S15.5.4.10_A2_T18 #4'); assert.throws(() => ''.match.call(Symbol('match test'), /./), 'throws on symbol context'); }; QUnit.test('String#match regression', run); QUnit.test('RegExp#@@match appearance', assert => { const match = /./[Symbol.match]; assert.isFunction(match); // assert.name(match, '[Symbol.match]'); assert.arity(match, 1); assert.looksNative(match); assert.nonEnumerable(RegExp.prototype, Symbol.match); }); QUnit.test('RegExp#@@match basic behavior', assert => { const string = '123456abcde7890'; const matches = ['12', '34', '56', '78', '90']; assert.same(/\d{2}/g[Symbol.match](string).length, 5); for (let i = 0, { length } = matches; i < length; ++i) { assert.same(/\d{2}/g[Symbol.match](string)[i], matches[i]); } }); QUnit.test('String#match delegates to @@match', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.match] = function (it) { return { value: it }; }; assert.same(string.match(object).value, string); assert.same(''.match.call(number, object).value, number); const regexp = /./; regexp[Symbol.match] = function (it) { return { value: it }; }; assert.same(string.match(regexp).value, string); assert.same(''.match.call(number, regexp).value, number); }); QUnit.test('RegExp#@@match delegates to exec', assert => { const exec = function (...args) { execCalled = true; return /./.exec.apply(this, args); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.deepEqual(re[Symbol.match]('abc'), ['a']); assert.true(execCalled); re = /a/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.match]('abc'), ['a']); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.match]('abc')); }); QUnit.test('RegExp#@@match implementation', patchRegExp$exec(run)); core-js-3.33.2/tests/unit-global/es.string.pad-end.js000066400000000000000000000016511451776221300223170ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#padEnd', assert => { const { padEnd } = String.prototype; assert.isFunction(padEnd); assert.arity(padEnd, 1); assert.name(padEnd, 'padEnd'); assert.looksNative(padEnd); assert.nonEnumerable(String.prototype, 'padEnd'); assert.same('abc'.padEnd(5), 'abc '); assert.same('abc'.padEnd(4, 'de'), 'abcd'); assert.same('abc'.padEnd(), 'abc'); assert.same('abc'.padEnd(5, '_'), 'abc__'); assert.same(''.padEnd(0), ''); assert.same('foo'.padEnd(1), 'foo'); assert.same('foo'.padEnd(5, ''), 'foo'); const symbol = Symbol('padEnd test'); assert.throws(() => padEnd.call(symbol, 10, 'a'), 'throws on symbol context'); assert.throws(() => padEnd.call('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padEnd.call(null, 0), TypeError); assert.throws(() => padEnd.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.pad-start.js000066400000000000000000000017211451776221300227040ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#padStart', assert => { const { padStart } = String.prototype; assert.isFunction(padStart); assert.arity(padStart, 1); assert.name(padStart, 'padStart'); assert.looksNative(padStart); assert.nonEnumerable(String.prototype, 'padStart'); assert.same('abc'.padStart(5), ' abc'); assert.same('abc'.padStart(4, 'de'), 'dabc'); assert.same('abc'.padStart(), 'abc'); assert.same('abc'.padStart(5, '_'), '__abc'); assert.same(''.padStart(0), ''); assert.same('foo'.padStart(1), 'foo'); assert.same('foo'.padStart(5, ''), 'foo'); const symbol = Symbol('padStart test'); assert.throws(() => padStart.call(symbol, 10, 'a'), 'throws on symbol context'); assert.throws(() => padStart.call('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padStart.call(null, 0), TypeError); assert.throws(() => padStart.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.raw.js000066400000000000000000000015351451776221300216010ustar00rootroot00000000000000QUnit.test('String.raw', assert => { const { raw } = String; assert.isFunction(raw); assert.arity(raw, 1); assert.name(raw, 'raw'); assert.looksNative(raw); assert.nonEnumerable(String, 'raw'); assert.same(raw({ raw: ['Hi\\n', '!'] }, 'Bob'), 'Hi\\nBob!', 'raw is array'); assert.same(raw({ raw: 'test' }, 0, 1, 2), 't0e1s2t', 'raw is string'); assert.same(raw({ raw: 'test' }, 0), 't0est', 'lacks substituting'); assert.same(raw({ raw: [] }), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('raw test'); assert.throws(() => raw({ raw: [symbol] }, 0), TypeError, 'throws on symbol #1'); assert.throws(() => raw({ raw: 'test' }, symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => raw({}), TypeError); assert.throws(() => raw({ raw: null }), TypeError); }); core-js-3.33.2/tests/unit-global/es.string.repeat.js000066400000000000000000000014331451776221300222650ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#repeat', assert => { const { repeat } = String.prototype; assert.isFunction(repeat); assert.arity(repeat, 1); assert.name(repeat, 'repeat'); assert.looksNative(repeat); assert.nonEnumerable(String.prototype, 'repeat'); assert.same('qwe'.repeat(3), 'qweqweqwe'); assert.same('qwe'.repeat(2.5), 'qweqwe'); assert.throws(() => 'qwe'.repeat(-1), RangeError); assert.throws(() => 'qwe'.repeat(Infinity), RangeError); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => repeat.call(Symbol('repeat test')), 'throws on symbol context'); } if (STRICT) { assert.throws(() => repeat.call(null, 1), TypeError); assert.throws(() => repeat.call(undefined, 1), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.replace-all.js000066400000000000000000000046071451776221300231740ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#replaceAll', assert => { const { replaceAll } = String.prototype; assert.isFunction(replaceAll); assert.arity(replaceAll, 2); assert.name(replaceAll, 'replaceAll'); assert.looksNative(replaceAll); assert.nonEnumerable(String.prototype, 'replaceAll'); assert.same('q=query+string+parameters'.replaceAll('+', ' '), 'q=query string parameters'); assert.same('foo'.replaceAll('o', {}), 'f[object Object][object Object]'); assert.same('[object Object]x[object Object]'.replaceAll({}, 'y'), 'yxy'); assert.same(replaceAll.call({}, 'bject', 'lolo'), '[ololo Ololo]'); assert.same('aba'.replaceAll('b', (search, i, string) => { assert.same(search, 'b', '`search` is `b`'); assert.same(i, 1, '`i` is 1'); assert.same(string, 'aba', '`string` is `aba`'); return 'c'; }), 'aca'); const searcher = { [Symbol.replace](O, replaceValue) { assert.same(this, searcher, '`this` is `searcher`'); assert.same(String(O), 'aba', '`O` is `aba`'); assert.same(String(replaceValue), 'c', '`replaceValue` is `c`'); return 'foo'; }, }; assert.same('aba'.replaceAll(searcher, 'c'), 'foo'); assert.same('aba'.replaceAll('b'), 'aundefineda'); assert.same('xxx'.replaceAll('', '_'), '_x_x_x_'); assert.same('121314'.replaceAll('1', '$$'), '$2$3$4', '$$'); assert.same('121314'.replaceAll('1', '$&'), '121314', '$&'); assert.same('121314'.replaceAll('1', '$`'), '212312134', '$`'); assert.same('121314'.replaceAll('1', "$'"), '213142314344', "$'"); const symbol = Symbol('replaceAll test'); assert.throws(() => replaceAll.call(symbol, 'a', 'b'), 'throws on symbol context'); assert.throws(() => replaceAll.call('a', symbol, 'b'), 'throws on symbol argument 1'); assert.throws(() => replaceAll.call('a', 'b', symbol), 'throws on symbol argument 2'); if (STRICT) { assert.throws(() => replaceAll.call(null, 'a', 'b'), TypeError); assert.throws(() => replaceAll.call(undefined, 'a', 'b'), TypeError); } // eslint-disable-next-line regexp/no-missing-g-flag -- required for testing assert.throws(() => 'b.b.b.b.b'.replaceAll(/\./, 'a'), TypeError); // eslint-disable-next-line unicorn/prefer-string-replace-all -- required for testing assert.same('b.b.b.b.b'.replaceAll(/\./g, 'a'), 'babababab'); const object = {}; assert.same('[object Object]'.replaceAll(object, 'a'), 'a'); }); core-js-3.33.2/tests/unit-global/es.string.replace.js000066400000000000000000000224741451776221300224300ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals, regexp/no-unused-capturing-group, unicorn/prefer-string-replace-all -- required for testing */ import { GLOBAL, NATIVE, STRICT } from '../helpers/constants.js'; import { patchRegExp$exec } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.replace); assert.arity(''.replace, 2); assert.name(''.replace, 'replace'); assert.looksNative(''.replace); assert.nonEnumerable(String.prototype, 'replace'); let instance = Object(true); instance.replace = String.prototype.replace; assert.same(instance.replace(true, 1), '1', 'S15.5.4.11_A1_T1'); instance = Object(false); instance.replace = String.prototype.replace; assert.same(instance.replace(false, undefined), 'undefined', 'S15.5.4.11_A1_T2'); assert.same('gnulluna'.replace(null, (a1, a2) => `${ a2 }`), 'g1una', 'S15.5.4.11_A1_T4'); assert.same('gnulluna'.replace(null, () => { /* empty */ }), 'gundefineduna', 'S15.5.4.11_A1_T5'); assert.same(Object('undefined').replace(undefined, (a1, a2) => a2 + 42), '42', 'S15.5.4.11_A1_T6'); assert.same('undefined'.replace('e', undefined), 'undundefinedfined', 'S15.5.4.11_A1_T7'); assert.same(String({ toString() { /* empty */ }, }).replace(/e/g, undefined), 'undundefinedfinundefinedd', 'S15.5.4.11_A1_T8'); assert.same(new String({ valueOf() { /* empty */ }, toString: undefined, }).replace(function () { /* empty */ }(), (a1, a2, a3) => a1 + a2 + a3), 'undefined0undefined', 'S15.5.4.11_A1_T9'); assert.same('ABB\u0041BABAB'.replace({ toString() { return '\u0041B'; }, }, () => { /* empty */ }), 'undefinedBABABAB', 'S15.5.4.11_A1_T10'); if (NATIVE) { try { 'ABB\u0041BABAB'.replace({ toString() { throw new Error('insearchValue'); }, }, { toString() { throw new Error('inreplaceValue'); }, }); assert.avoid('S15.5.4.11_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'insearchValue', 'S15.5.4.11_A1_T11 #2'); } try { Object('ABB\u0041BABAB').replace({ toString() { return {}; }, valueOf() { throw new Error('insearchValue'); }, }, { toString() { throw new Error('inreplaceValue'); }, }); assert.avoid('S15.5.4.11_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'insearchValue', 'S15.5.4.11_A1_T12 #2'); } } try { 'ABB\u0041BABAB\u0031BBAA'.replace({ toString() { return {}; }, valueOf() { throw new Error('insearchValue'); }, }, { toString() { return 1; }, }); assert.avoid('S15.5.4.11_A1_T13 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'insearchValue', 'S15.5.4.11_A1_T13 #2'); } assert.same('ABB\u0041BABAB\u0037\u0037BBAA'.replace(new RegExp('77'), 1), 'ABBABABAB\u0031BBAA', 'S15.5.4.11_A1_T14'); instance = Object(1100.00777001); instance.replace = String.prototype.replace; try { instance.replace({ toString() { return /77/; }, }, 1); assert.avoid('S15.5.4.11_A1_T15 #1 lead to throwing exception'); } catch (error) { assert.true(error instanceof TypeError, 'S15.5.4.11_A1_T15 #2'); } instance = Object(1100.00777001); instance.replace = String.prototype.replace; try { instance.replace(/77/, { toString() { return (a1, a2) => `${ a2 }z`; }, }); assert.avoid('S15.5.4.11_A1_T16 #1 lead to throwing exception'); } catch (error) { assert.true(error instanceof TypeError, 'S15.5.4.11_A1_T16 #2'); } assert.same('asdf'.replace(RegExp('', 'g'), '1'), '1a1s1d1f1', 'S15.5.4.11_A1_T17'); assert.same('She sells seashells by the seashore.'.replace(/sh/g, 'sch'), 'She sells seaschells by the seaschore.', 'S15.5.4.11_A2_T1'); assert.same('She sells seashells by the seashore.'.replace(/sh/g, '$$sch'), 'She sells sea$schells by the sea$schore.', 'S15.5.4.11_A2_T2'); assert.same('She sells seashells by the seashore.'.replace(/sh/g, '$&sch'), 'She sells seashschells by the seashschore.', 'S15.5.4.11_A2_T3'); assert.same('She sells seashells by the seashore.'.replace(/sh/g, '$`sch'), 'She sells seaShe sells seaschells by the seaShe sells seashells by the seaschore.', 'S15.5.4.11_A2_T4'); assert.same('She sells seashells by the seashore.'.replace(/sh/g, "$'sch"), 'She sells seaells by the seashore.schells by the seaore.schore.', 'S15.5.4.11_A2_T5'); assert.same('She sells seashells by the seashore.'.replace(/sh/, 'sch'), 'She sells seaschells by the seashore.', 'S15.5.4.11_A2_T6'); assert.same('She sells seashells by the seashore.'.replace(/sh/, '$$sch'), 'She sells sea$schells by the seashore.', 'S15.5.4.11_A2_T7'); assert.same('She sells seashells by the seashore.'.replace(/sh/, '$&sch'), 'She sells seashschells by the seashore.', 'S15.5.4.11_A2_T8'); assert.same('She sells seashells by the seashore.'.replace(/sh/, '$`sch'), 'She sells seaShe sells seaschells by the seashore.', 'S15.5.4.11_A2_T9'); assert.same('She sells seashells by the seashore.'.replace(/sh/, "$'sch"), 'She sells seaells by the seashore.schells by the seashore.', 'S15.5.4.11_A2_T10'); assert.same('uid=31'.replace(/(uid=)(\d+)/, '$1115'), 'uid=115', 'S15.5.4.11_A3_T1'); assert.same('uid=31'.replace(/(uid=)(\d+)/, '$11A15'), 'uid=1A15', 'S15.5.4.11_A3_T3'); assert.same('abc12 def34'.replace(/([a-z]+)(\d+)/, (a, b, c) => c + b), '12abc def34', 'S15.5.4.11_A4_T1'); // eslint-disable-next-line regexp/optimal-quantifier-concatenation -- required for testing assert.same('aaaaaaaaaa,aaaaaaaaaaaaaaa'.replace(/^(a+)\1*,\1+$/, '$1'), 'aaaaa', 'S15.5.4.11_A5_T1'); // https://github.com/zloirock/core-js/issues/471 // eslint-disable-next-line regexp/no-useless-dollar-replacements, regexp/strict -- required for testing assert.same('{price} Retail'.replace(/{price}/g, '$25.00'), '$25.00 Retail'); // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing assert.same('a'.replace(/(.)/, '$0'), '$0'); assert.throws(() => ''.replace.call(Symbol('replace test'), /./, ''), 'throws on symbol context'); }; QUnit.test('String#replace regression', run); QUnit.test('RegExp#@@replace appearance', assert => { const replace = /./[Symbol.replace]; assert.isFunction(replace); // assert.name(replace, '[Symbol.replace]'); assert.arity(replace, 2); assert.looksNative(replace); assert.nonEnumerable(RegExp.prototype, Symbol.replace); }); QUnit.test('RegExp#@@replace basic behavior', assert => { assert.same(/([a-z]+)(\d+)/[Symbol.replace]('abc12 def34', (a, b, c) => c + b), '12abc def34'); }); QUnit.test('String.replace delegates to @@replace', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.replace] = function (a, b) { return { a, b }; }; assert.same(string.replace(object, 42).a, string); assert.same(string.replace(object, 42).b, 42); assert.same(''.replace.call(number, object, 42).a, number); assert.same(''.replace.call(number, object, 42).b, 42); const regexp = /./; regexp[Symbol.replace] = function (a, b) { return { a, b }; }; assert.same(string.replace(regexp, 42).a, string); assert.same(string.replace(regexp, 42).b, 42); assert.same(''.replace.call(number, regexp, 42).a, number); assert.same(''.replace.call(number, regexp, 42).b, 42); }); QUnit.test('RegExp#@@replace delegates to exec', assert => { const exec = function (...args) { execCalled = true; return /./.exec.apply(this, args); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbc'); assert.true(execCalled); assert.same(re.lastIndex, 0); execCalled = false; re = /[ac]/g; re.exec = exec; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbf'); assert.true(execCalled); assert.same(re.lastIndex, 0); re = /a/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbc'); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.replace]('abc', 'f')); }); QUnit.test('RegExp#@@replace correctly handles substitutions', assert => { const re = /./; re.exec = function () { const result = ['23', '7']; result.groups = { '!!!': '7' }; result.index = 1; return result; }; // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive assert.same('1234'.replace(re, '$1'), '174'); // eslint-disable-next-line regexp/no-useless-dollar-replacements -- required for testing assert.same('1234'.replace(re, '$'), '174'); assert.same('1234'.replace(re, '$`'), '114'); assert.same('1234'.replace(re, "$'"), '144'); assert.same('1234'.replace(re, '$$'), '1$4'); assert.same('1234'.replace(re, '$&'), '1234'); // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing assert.same('1234'.replace(re, '$x'), '1$x4'); let args; assert.same('1234'.replace(re, (...$args) => { args = $args; return 'x'; }), '1x4'); assert.deepEqual(args, ['23', '7', 1, '1234', { '!!!': '7' }]); }); QUnit.test('RegExp#@@replace implementation', patchRegExp$exec(run)); core-js-3.33.2/tests/unit-global/es.string.search.js000066400000000000000000000115341451776221300222550ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals -- required for testing */ import { GLOBAL, STRICT } from '../helpers/constants.js'; import { patchRegExp$exec } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.search); assert.arity(''.search, 1); assert.name(''.search, 'search'); assert.looksNative(''.search); assert.nonEnumerable(String.prototype, 'search'); let instance = Object(true); instance.search = String.prototype.search; assert.same(instance.search(true), 0, 'S15.5.4.12_A1_T1'); instance = Object(false); instance.search = String.prototype.search; assert.same(instance.search(false), 0, 'S15.5.4.12_A1_T2'); assert.same(''.search(), 0, 'S15.5.4.12_A1_T4 #1'); assert.same('--undefined--'.search(), 0, 'S15.5.4.12_A1_T4 #2'); assert.same('gnulluna'.search(null), 1, 'S15.5.4.12_A1_T5'); assert.same(Object('undefined').search(undefined), 0, 'S15.5.4.12_A1_T6'); assert.same('undefined'.search(undefined), 0, 'S15.5.4.12_A1_T7'); assert.same(String({ toString() { /* empty */ }, }).search(undefined), 0, 'S15.5.4.12_A1_T8'); assert.same('ssABB\u0041BABAB'.search({ toString() { return '\u0041B'; }, }), 2, 'S15.5.4.12_A1_T10'); try { 'ABB\u0041BABAB'.search({ toString() { throw new Error('intostr'); }, }); assert.avoid('S15.5.4.12_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intostr', 'S15.5.4.12_A1_T11 #2'); } try { Object('ABB\u0041BABAB').search({ toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }); assert.avoid('S15.5.4.12_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intostr', 'S15.5.4.12_A1_T12 #2'); } assert.same('ABB\u0041B\u0031ABAB\u0031BBAA'.search({ toString() { return {}; }, valueOf() { return 1; }, }), 5, 'S15.5.4.12_A1_T13'); assert.same('ABB\u0041BABAB\u0037\u0037BBAA'.search(RegExp('77')), 9, 'S15.5.4.12_A1_T14'); assert.same(Object('test string').search('string'), 5, 'S15.5.4.12_A2_T1'); assert.same(Object('test string').search('String'), -1, 'S15.5.4.12_A2_T2'); assert.same(Object('test string').search(/string/i), 5, 'S15.5.4.12_A2_T3'); assert.same(Object('test string').search(/Four/), -1, 'S15.5.4.12_A2_T4'); assert.same(Object('one two three four five').search(/four/), 14, 'S15.5.4.12_A2_T5'); assert.same(Object('test string').search('nonexistent'), -1, 'S15.5.4.12_A2_T6'); assert.same(Object('test string probe').search('string pro'), 5, 'S15.5.4.12_A2_T7'); let string = Object('power of the power of the power of the power of the power of the power of the great sword'); assert.same(string.search(/the/), string.search(/the/g), 'S15.5.4.12_A3_T1'); string = Object('power \u006F\u0066 the power of the power \u006F\u0066 the power of the power \u006F\u0066 the power of the great sword'); assert.same(string.search(/of/), string.search(/of/g), 'S15.5.4.12_A3_T2'); assert.throws(() => ''.search.call(Symbol('search test'), /./), 'throws on symbol context'); }; QUnit.test('String#search regression', run); QUnit.test('RegExp#@@search appearance', assert => { const search = /./[Symbol.search]; assert.isFunction(search); // assert.name(search, '[Symbol.search]'); assert.arity(search, 1); assert.looksNative(search); assert.nonEnumerable(RegExp.prototype, Symbol.search); }); QUnit.test('RegExp#@@search basic behavior', assert => { assert.same(/four/[Symbol.search]('one two three four five'), 14); assert.same(/Four/[Symbol.search]('one two three four five'), -1); }); QUnit.test('String#search delegates to @@search', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.search] = function (it) { return { value: it }; }; assert.same(string.search(object).value, string); assert.same(''.search.call(number, object).value, number); const regexp = /./; regexp[Symbol.search] = function (it) { return { value: it }; }; assert.same(string.search(regexp).value, string); assert.same(''.search.call(number, regexp).value, number); }); QUnit.test('RegExp#@@search delegates to exec', assert => { let execCalled = false; let re = /b/; re.lastIndex = 7; re.exec = function (...args) { execCalled = true; return /./.exec.apply(this, args); }; assert.deepEqual(re[Symbol.search]('abc'), 1); assert.true(execCalled); assert.same(re.lastIndex, 7); re = /b/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.search]('abc'), 1); re = /b/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.search]('abc')); }); QUnit.test('RegExp#@@search implementation', patchRegExp$exec(run)); core-js-3.33.2/tests/unit-global/es.string.small.js000066400000000000000000000007051451776221300221160ustar00rootroot00000000000000QUnit.test('String#small', assert => { const { small } = String.prototype; assert.isFunction(small); assert.arity(small, 0); assert.name(small, 'small'); assert.looksNative(small); assert.nonEnumerable(String.prototype, 'small'); assert.same('a'.small(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => small.call(Symbol('small test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.split.js000066400000000000000000001147211451776221300221450ustar00rootroot00000000000000/* eslint-disable prefer-regex-literals -- required for testing */ /* eslint-disable regexp/no-empty-group, regexp/no-empty-capturing-group -- required for testing */ /* eslint-disable regexp/optimal-lookaround-quantifier, regexp/no-lazy-ends -- required for testing */ import { GLOBAL, NATIVE, STRICT } from '../helpers/constants.js'; import { patchRegExp$exec } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.split); assert.arity(''.split, 2); assert.name(''.split, 'split'); assert.looksNative(''.split); assert.nonEnumerable(String.prototype, 'split'); assert.arrayEqual('ab'.split(), ['ab'], 'If "separator" is undefined must return Array with one String - "this" string'); assert.arrayEqual('ab'.split(undefined), ['ab'], 'If "separator" is undefined must return Array with one String - "this" string'); assert.arrayEqual('ab'.split(undefined, 0), [], 'If "separator" is undefined and "limit" set to 0 must return Array[]'); assert.arrayEqual(''.split(), [''], "''.split() results in ['']"); assert.arrayEqual(''.split(/./), [''], "''.split(/./) results in ['']"); assert.arrayEqual(''.split(/.?/), [], "''.split(/.?/) results in []"); assert.arrayEqual(''.split(/.??/), [], "''.split(/.??/) results in []"); assert.arrayEqual('ab'.split(/a*/), ['', 'b'], "'ab'.split(/a*/) results in ['', 'b']"); assert.arrayEqual('ab'.split(/a*?/), ['a', 'b'], "'ab'.split(/a*?/) results in ['a', 'b']"); // eslint-disable-next-line regexp/no-useless-non-capturing-group -- required for testing assert.arrayEqual('ab'.split(/(?:ab)/), ['', ''], "'ab'.split(/(?:ab)/) results in ['', '']"); assert.arrayEqual('ab'.split(/(?:ab)*/), ['', ''], "'ab'.split(/(?:ab)*/) results in ['', '']"); assert.arrayEqual('ab'.split(/(?:ab)*?/), ['a', 'b'], "'ab'.split(/(?:ab)*?/) results in ['a', 'b']"); assert.arrayEqual('test'.split(''), ['t', 'e', 's', 't'], "'test'.split('') results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(), ['test'], "'test'.split() results in ['test']"); assert.arrayEqual('111'.split(1), ['', '', '', ''], "'111'.split(1) results in ['', '', '', '']"); assert.arrayEqual('test'.split(/(?:)/, 2), ['t', 'e'], "'test'.split(/(?:)/, 2) results in ['t', 'e']"); assert.arrayEqual('test'.split(/(?:)/, -1), ['t', 'e', 's', 't'], "'test'.split(/(?:)/, -1) results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(/(?:)/, undefined), ['t', 'e', 's', 't'], "'test'.split(/(?:)/, undefined) results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(/(?:)/, null), [], "'test'.split(/(?:)/, null) results in []"); assert.arrayEqual('test'.split(/(?:)/, NaN), [], "'test'.split(/(?:)/, NaN) results in []"); assert.arrayEqual('test'.split(/(?:)/, true), ['t'], "'test'.split(/(?:)/, true) results in ['t']"); assert.arrayEqual('test'.split(/(?:)/, '2'), ['t', 'e'], "'test'.split(/(?:)/, '2') results in ['t', 'e']"); assert.arrayEqual('test'.split(/(?:)/, 'two'), [], "'test'.split(/(?:)/, 'two') results in []"); assert.arrayEqual('a'.split(/-/), ['a'], "'a'.split(/-/) results in ['a']"); assert.arrayEqual('a'.split(/-?/), ['a'], "'a'.split(/-?/) results in ['a']"); assert.arrayEqual('a'.split(/-??/), ['a'], "'a'.split(/-??/) results in ['a']"); assert.arrayEqual('a'.split(/a/), ['', ''], "'a'.split(/a/) results in ['', '']"); assert.arrayEqual('a'.split(/a?/), ['', ''], "'a'.split(/a?/) results in ['', '']"); assert.arrayEqual('a'.split(/a??/), ['a'], "'a'.split(/a??/) results in ['a']"); assert.arrayEqual('ab'.split(/-/), ['ab'], "'ab'.split(/-/) results in ['ab']"); assert.arrayEqual('ab'.split(/-?/), ['a', 'b'], "'ab'.split(/-?/) results in ['a', 'b']"); assert.arrayEqual('ab'.split(/-??/), ['a', 'b'], "'ab'.split(/-??/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-/), ['a', 'b'], "'a-b'.split(/-/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-?/), ['a', 'b'], "'a-b'.split(/-?/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-??/), ['a', '-', 'b'], "'a-b'.split(/-??/) results in ['a', '-', 'b']"); assert.arrayEqual('a--b'.split(/-/), ['a', '', 'b'], "'a--b'.split(/-/) results in ['a', '', 'b']"); assert.arrayEqual('a--b'.split(/-?/), ['a', '', 'b'], "'a--b'.split(/-?/) results in ['a', '', 'b']"); assert.arrayEqual('a--b'.split(/-??/), ['a', '-', '-', 'b'], "'a--b'.split(/-??/) results in ['a', '-', '-', 'b']"); assert.arrayEqual(''.split(/()()/), [], "''.split(/()()/) results in []"); assert.arrayEqual('.'.split(/()()/), ['.'], "'.'.split(/()()/) results in ['.']"); assert.arrayEqual('.'.split(/(.?)(.?)/), ['', '.', '', ''], "'.'.split(/(.?)(.?)/) results in ['', '.', '', '']"); assert.arrayEqual('.'.split(/(.??)(.??)/), ['.'], "'.'.split(/(.??)(.??)/) results in ['.']"); // eslint-disable-next-line regexp/optimal-quantifier-concatenation -- ignore assert.arrayEqual('.'.split(/(.)?(.)?/), ['', '.', undefined, ''], "'.'.split(/(.)?(.)?/) results in ['', '.', undefined, '']"); assert.arrayEqual('Aboldandcoded'.split(/<(\/)?([^<>]+)>/), ['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', ''], "'Aboldandcoded'.split(/<(\\/)?([^<>]+)>/) results in ['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', '']"); assert.arrayEqual('tesst'.split(/(s)*/), ['t', undefined, 'e', 's', 't'], "'tesst'.split(/(s)*/) results in ['t', undefined, 'e', 's', 't']"); assert.arrayEqual('tesst'.split(/(s)*?/), ['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't'], "'tesst'.split(/(s)*?/) results in ['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't']"); assert.arrayEqual('tesst'.split(/(s*)/), ['t', '', 'e', 'ss', 't'], "'tesst'.split(/(s*)/) results in ['t', '', 'e', 'ss', 't']"); assert.arrayEqual('tesst'.split(/(s*?)/), ['t', '', 'e', '', 's', '', 's', '', 't'], "'tesst'.split(/(s*?)/) results in ['t', '', 'e', '', 's', '', 's', '', 't']"); assert.arrayEqual('tesst'.split(/s*/), ['t', 'e', 't'], "'tesst'.split(/(?:s)*/) results in ['t', 'e', 't']"); assert.arrayEqual('tesst'.split(/(?=s+)/), ['te', 's', 'st'], "'tesst'.split(/(?=s+)/) results in ['te', 's', 'st']"); assert.arrayEqual('test'.split('t'), ['', 'es', ''], "'test'.split('t') results in ['', 'es', '']"); assert.arrayEqual('test'.split('es'), ['t', 't'], "'test'.split('es') results in ['t', 't']"); assert.arrayEqual('test'.split(/t/), ['', 'es', ''], "'test'.split(/t/) results in ['', 'es', '']"); assert.arrayEqual('test'.split(/es/), ['t', 't'], "'test'.split(/es/) results in ['t', 't']"); assert.arrayEqual('test'.split(/(t)/), ['', 't', 'es', 't', ''], "'test'.split(/(t)/) results in ['', 't', 'es', 't', '']"); assert.arrayEqual('test'.split(/(es)/), ['t', 'es', 't'], "'test'.split(/(es)/) results in ['t', 'es', 't']"); assert.arrayEqual('test'.split(/(t)(e)(s)(t)/), ['', 't', 'e', 's', 't', ''], "'test'.split(/(t)(e)(s)(t)/) results in ['', 't', 'e', 's', 't', '']"); assert.arrayEqual('.'.split(/(((.((.??)))))/), ['', '.', '.', '.', '', '', ''], "'.'.split(/(((.((.??)))))/) results in ['', '.', '.', '.', '', '', '']"); assert.arrayEqual('.'.split(/(((((.??)))))/), ['.'], "'.'.split(/(((((.??)))))/) results in ['.']"); assert.arrayEqual('a b c d'.split(/ /, -(2 ** 32) + 1), ['a'], "'a b c d'.split(/ /, -(2 ** 32) + 1) results in ['a']"); assert.arrayEqual('a b c d'.split(/ /, 2 ** 32 + 1), ['a'], "'a b c d'.split(/ /, 2 ** 32 + 1) results in ['a']"); assert.arrayEqual('a b c d'.split(/ /, Infinity), [], "'a b c d'.split(/ /, Infinity) results in []"); let instance = Object(true); instance.split = String.prototype.split; let split = instance.split(true, false); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T1 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T1 #2'); assert.same(split.length, 0, 'S15.5.4.14_A1_T1 #3'); instance = Object(false); instance.split = String.prototype.split; split = instance.split(false, 0, null); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T2 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T2 #2'); assert.same(split.length, 0, 'S15.5.4.14_A1_T2 #3'); split = ''.split(); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T4 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T4 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T4 #3'); assert.same(split[0], '', 'S15.5.4.14_A1_T4 #4'); split = 'gnulluna'.split(null); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T5 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T5 #2'); assert.same(split.length, 2, 'S15.5.4.14_A1_T5 #3'); assert.same(split[0], 'g', 'S15.5.4.14_A1_T5 #4'); assert.same(split[1], 'una', 'S15.5.4.14_A1_T5 #5'); if (NATIVE) { split = Object('1undefined').split(undefined); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T6 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T6 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T6 #3'); assert.same(split[0], '1undefined', 'S15.5.4.14_A1_T6 #4'); split = 'undefinedd'.split(undefined); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T7 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T7 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T7 #3'); assert.same(split[0], 'undefinedd', 'S15.5.4.14_A1_T7 #4'); split = String({ toString() { /* empty */ }, }).split(undefined); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T8 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T8 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T8 #3'); assert.same(split[0], 'undefined', 'S15.5.4.14_A1_T8 #4'); } split = new String({ valueOf() { /* empty */ }, toString: undefined, }).split(() => { /* empty */ }); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T9 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T9 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T9 #3'); assert.same(split[0], 'undefined', 'S15.5.4.14_A1_T9 #4'); split = 'ABB\u0041BABAB'.split({ toString() { return '\u0042B'; }, }, { valueOf() { return true; }, }); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T10 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T10 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T10 #3'); assert.same(split[0], 'A', 'S15.5.4.14_A1_T10 #4'); try { 'ABB\u0041BABAB'.split({ toString() { return '\u0041B'; }, }, { valueOf() { throw new Error('intointeger'); }, }); assert.avoid('S15.5.4.14_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intointeger', 'S15.5.4.14_A1_T11 #2'); } if (NATIVE) { try { new String('ABB\u0041BABAB').split({ toString() { return '\u0041B'; }, }, { valueOf() { return {}; }, toString() { throw new Error('intointeger'); }, }); assert.avoid('S15.5.4.14_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intointeger', 'S15.5.4.14_A1_T12 #2'); } } split = 'ABB\u0041BABAB\u0042cc^^\u0042Bvv%%B\u0042xxx'.split({ toString() { return '\u0042\u0042'; }, }, { valueOf() { return {}; }, toString() { return '2'; }, }); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T13 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T13 #2'); assert.same(split.length, 2, 'S15.5.4.14_A1_T13 #3'); assert.same(split[0], 'A', 'S15.5.4.14_A1_T13 #4'); assert.same(split[1], 'ABABA', 'S15.5.4.14_A1_T13 #5'); if (NATIVE) { try { instance = Object(10001.10001); instance.split = String.prototype.split; instance.split({ toString() { throw new Error('intostr'); }, }, { valueOf() { throw new Error('intoint'); }, }); assert.avoid('S15.5.4.14_A1_T14 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intoint', 'S15.5.4.14_A1_T14 #2'); } try { class F { constructor(value) { this.value = value; } valueOf() { return `${ this.value }`; } toString() { return new Number(); } } F.prototype.split = String.prototype.split; new F().split({ toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }, { valueOf() { throw new Error('intoint'); }, }); assert.avoid('S15.5.4.14_A1_T15 #1 lead to throwing exception'); } catch (error) { assert.same(error.message, 'intoint', 'S15.5.4.14_A1_T15 #2'); } } try { String.prototype.split.call(6776767677.006771, { toString() { return /77/g; }, }); assert.avoid('S15.5.4.14_A1_T16 #1 lead to throwing exception'); } catch (error) { assert.true(error instanceof TypeError, 'S15.5.4.14_A1_T16 #2'); } split = String.prototype.split.call(6776767677.006771, /77/g); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T17 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T17 #2'); assert.same(split.length, 4, 'S15.5.4.14_A1_T17 #3'); assert.same(split[0], '6', 'S15.5.4.14_A1_T17 #4'); assert.same(split[1], '67676', 'S15.5.4.14_A1_T17 #5'); assert.same(split[2], '.006', 'S15.5.4.14_A1_T17 #6'); assert.same(split[3], '1', 'S15.5.4.14_A1_T17 #7'); split = String.prototype.split.call(6776767677.006771, /00/, 1); assert.same(typeof split, 'object', 'S15.5.4.14_A1_T18 #1'); assert.same(split.constructor, Array, 'S15.5.4.14_A1_T18 #2'); assert.same(split.length, 1, 'S15.5.4.14_A1_T18 #3'); assert.same(split[0], '6776767677.', 'S15.5.4.14_A1_T18 #4'); split = Object('one,two,three,four,five').split(','); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T1 #1'); assert.same(split.length, 5, 'S15.5.4.14_A2_T1 #2'); assert.same(split[0], 'one', 'S15.5.4.14_A2_T1 #3'); assert.same(split[1], 'two', 'S15.5.4.14_A2_T1 #4'); assert.same(split[2], 'three', 'S15.5.4.14_A2_T1 #5'); assert.same(split[3], 'four', 'S15.5.4.14_A2_T1 #6'); assert.same(split[4], 'five', 'S15.5.4.14_A2_T1 #7'); split = Object('one two three four five').split(' '); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T2 #1'); assert.same(split.length, 5, 'S15.5.4.14_A2_T2 #2'); assert.same(split[0], 'one', 'S15.5.4.14_A2_T2 #3'); assert.same(split[1], 'two', 'S15.5.4.14_A2_T2 #4'); assert.same(split[2], 'three', 'S15.5.4.14_A2_T2 #5'); assert.same(split[3], 'four', 'S15.5.4.14_A2_T2 #6'); assert.same(split[4], 'five', 'S15.5.4.14_A2_T2 #7'); split = Object('one two three four five').split(RegExp(' '), 2); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T3 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T3 #2'); assert.same(split[0], 'one', 'S15.5.4.14_A2_T3 #3'); assert.same(split[1], 'two', 'S15.5.4.14_A2_T3 #4'); split = Object('one two three').split(''); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T4 #1'); assert.same(split.length, 'one two three'.length, 'S15.5.4.14_A2_T4 #2'); assert.same(split[0], 'o', 'S15.5.4.14_A2_T4 #3'); assert.same(split[1], 'n', 'S15.5.4.14_A2_T4 #4'); assert.same(split[11], 'e', 'S15.5.4.14_A2_T4 #5'); assert.same(split[12], 'e', 'S15.5.4.14_A2_T4 #6'); split = Object('one-1,two-2,four-4').split(/,/); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T5 #1'); assert.same(split.length, 3, 'S15.5.4.14_A2_T5 #2'); assert.same(split[0], 'one-1', 'S15.5.4.14_A2_T5 #3'); assert.same(split[1], 'two-2', 'S15.5.4.14_A2_T5 #4'); assert.same(split[2], 'four-4', 'S15.5.4.14_A2_T5 #5'); let string = Object('one-1 two-2 three-3'); split = string.split(''); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T6 #1'); assert.same(split.length, string.length, 'S15.5.4.14_A2_T6 #2'); for (let i = 0, { length } = split; i < length; ++i) { assert.same(split[i], string.charAt(i), `S15.5.4.14_A2_T6 #${ i + 3 }`); } if (NATIVE) { string = 'thisundefinedisundefinedaundefinedstringundefinedobject'; split = string.split(undefined); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T7 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T7 #2'); assert.same(split[0], string, 'S15.5.4.14_A2_T7 #3'); } string = 'thisnullisnullanullstringnullobject'; let expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(null); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T8 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T8 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T8 #${ i + 3 }`); } string = 'thistrueistrueatruestringtrueobject'; expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(true); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T9 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T9 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T9 #${ i + 3 }`); } string = 'this123is123a123string123object'; expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(123); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T10 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T10 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T10 #${ i + 3 }`); } split = Object('one-1,two-2,four-4').split(':'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T11 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T11 #2'); assert.same(split[0], 'one-1,two-2,four-4', 'S15.5.4.14_A2_T11 #3'); split = Object('one-1 two-2 four-4').split('r-42'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T12 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T12 #2'); assert.same(split[0], 'one-1 two-2 four-4', 'S15.5.4.14_A2_T12 #3'); split = Object('one-1 two-2 four-4').split('-4'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T13 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T13 #2'); assert.same(split[0], 'one-1 two-2 four', 'S15.5.4.14_A2_T13 #3'); assert.same(split[1], '', 'S15.5.4.14_A2_T13 #4'); split = Object('one-1 two-2 four-4').split('on'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T14 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T14 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T14 #3'); assert.same(split[1], 'e-1 two-2 four-4', 'S15.5.4.14_A2_T14 #4'); split = new String().split(''); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T15 #1'); assert.same(split.length, 0, 'S15.5.4.14_A2_T15 #2'); assert.same(split[0], undefined, 'S15.5.4.14_A2_T15 #3'); split = new String().split(' '); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T16 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T16 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T16 #3'); split = Object(' ').split(''); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T18 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T18 #2'); assert.same(split[0], ' ', 'S15.5.4.14_A2_T18 #3'); split = Object(' ').split(' '); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T19 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T19 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T19 #3'); assert.same(split[1], '', 'S15.5.4.14_A2_T19 #4'); split = ''.split('x'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T19 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T19 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T19 #3'); string = Object('one-1 two-2 three-3'); split = string.split(new RegExp()); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T20 #1'); assert.same(split.length, string.length, 'S15.5.4.14_A2_T20 #2'); for (let i = 0, { length } = split; i < length; ++i) { assert.same(split[i], string.charAt(i), `S15.5.4.14_A2_T20 #${ i + 3 }`); } split = Object('hello').split('ll'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T21 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T21 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A2_T21 #3'); assert.same(split[1], 'o', 'S15.5.4.14_A2_T21 #4'); split = Object('hello').split('l'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T22 #1'); assert.same(split.length, 3, 'S15.5.4.14_A2_T22 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A2_T22 #3'); assert.same(split[1], '', 'S15.5.4.14_A2_T22 #4'); assert.same(split[2], 'o', 'S15.5.4.14_A2_T22 #5'); split = Object('hello').split('x'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T23 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T23 #2'); assert.same(split[0], 'hello', 'S15.5.4.14_A2_T23 #3'); split = Object('hello').split('h'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T24 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T24 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T24 #3'); assert.same(split[1], 'ello', 'S15.5.4.14_A2_T24 #4'); split = Object('hello').split('o'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T25 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T25 #2'); assert.same(split[0], 'hell', 'S15.5.4.14_A2_T25 #3'); assert.same(split[1], '', 'S15.5.4.14_A2_T25 #4'); split = Object('hello').split('hello'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T26 #1'); assert.same(split.length, 2, 'S15.5.4.14_A2_T26 #2'); assert.same(split[0], '', 'S15.5.4.14_A2_T26 #3'); assert.same(split[1], '', 'S15.5.4.14_A2_T26 #4'); split = Object('hello').split(undefined); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T27 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T27 #2'); assert.same(split[0], 'hello', 'S15.5.4.14_A2_T27 #3'); split = Object('hello').split('hellothere'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T28 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T28 #2'); assert.same(split[0], 'hello', 'S15.5.4.14_A2_T28 #3'); instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T29 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T29 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T29 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 1); expected = ['']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T30 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T30 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T30 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 2); expected = ['', '00']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T31 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T31 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T31 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 0); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T32 #1'); assert.same(split.length, 0, 'S15.5.4.14_A2_T32 #2'); instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 100); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T33 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T33 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T33 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, undefined); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T34 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T34 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T34 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 2 ** 32 - 1); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T35 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T35 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T35 #${ i + 3 }`); } instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, 'boo'); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T36 #1'); assert.same(split.length, 0, 'S15.5.4.14_A2_T36 #2'); instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, -(2 ** 32) + 1); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T37 #1'); assert.arrayEqual(split, [''], 'S15.5.4.14_A2_T37 #2'); instance = Object(100111122133144160); instance.split = String.prototype.split; split = instance.split(1, NaN); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T38 #1'); assert.same(split.length, 0, 'S15.5.4.14_A2_T38 #2'); instance = Object('hello').split('l', 0); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T39 #1'); assert.same(split.length, 0, 'S15.5.4.14_A2_T39 #2'); split = Object('hello').split('l', 1); assert.same(split.constructor, Array, 'S15.5.4.14_A2_T40 #1'); assert.same(split.length, 1, 'S15.5.4.14_A2_T40 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A2_T40 #3'); split = Object('hello').split('l', 2); expected = ['he', '']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T41 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T41 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T41 #${ i + 3 }`); } split = Object('hello').split('l', 3); expected = ['he', '', 'o']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T42 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T42 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T42 #${ i + 3 }`); } split = Object('hello').split('l', 4); expected = ['he', '', 'o']; assert.same(split.constructor, Array, 'S15.5.4.14_A2_T43 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A2_T43 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A2_T43 #${ i + 3 }`); } split = Object('one,two,three,four,five').split(); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T1 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T1 #2'); assert.same(split[0], 'one,two,three,four,five', 'S15.5.4.14_A3_T1 #3'); split = String.prototype.split.call({}); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T2 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T2 #2'); assert.same(split[0], '[object Object]', 'S15.5.4.14_A3_T2 #3'); split = String.prototype.split.call({ toString() { return 'function(){}'; }, }); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T3 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T3 #2'); assert.same(split[0], 'function(){}', 'S15.5.4.14_A3_T3 #3'); split = String.prototype.split.call(Object(NaN)); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T4 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T4 #2'); assert.same(split[0], 'NaN', 'S15.5.4.14_A3_T4 #3'); split = String.prototype.split.call(Object(-1234567890)); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T5 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T5 #2'); assert.same(split[0], '-1234567890', 'S15.5.4.14_A3_T5 #3'); instance = Object(-1e21); split = String.prototype.split.call(instance); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T6 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T6 #2'); assert.same(split[0], instance.toString(), 'S15.5.4.14_A3_T6 #3'); split = String.prototype.split.call(Math); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T7 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T7 #2'); assert.same(split[0], '[object Math]', 'S15.5.4.14_A3_T7 #3'); split = String.prototype.split.call([1, 2, 3, 4, 5]); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T8 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T8 #2'); assert.same(split[0], '1,2,3,4,5', 'S15.5.4.14_A3_T8 #3'); split = String.prototype.split.call(Object(false)); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T9 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T9 #2'); assert.same(split[0], 'false', 'S15.5.4.14_A3_T9 #3'); split = String.prototype.split.call(new String()); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T10 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T10 #2'); assert.same(split[0], '', 'S15.5.4.14_A3_T10 #3'); split = String.prototype.split.call(Object(' ')); assert.same(split.constructor, Array, 'S15.5.4.14_A3_T11 #1'); assert.same(split.length, 1, 'S15.5.4.14_A3_T11 #2'); assert.same(split[0], ' ', 'S15.5.4.14_A3_T11 #3'); if (NATIVE) { split = Object('hello').split(/l/); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T1 #1'); assert.same(split.length, 3, 'S15.5.4.14_A4_T1 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T1 #3'); assert.same(split[1], '', 'S15.5.4.14_A4_T1 #4'); assert.same(split[2], 'o', 'S15.5.4.14_A4_T1 #5'); } split = Object('hello').split(/l/, 0); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T2 #1'); assert.same(split.length, 0, 'S15.5.4.14_A4_T2 #2'); split = Object('hello').split(/l/, 1); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T3 #1'); assert.same(split.length, 1, 'S15.5.4.14_A4_T3 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T3 #3'); if (NATIVE) { split = Object('hello').split(/l/, 2); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T4 #1'); assert.same(split.length, 2, 'S15.5.4.14_A4_T4 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T4 #3'); assert.same(split[1], '', 'S15.5.4.14_A4_T4 #4'); split = Object('hello').split(/l/, 3); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T5 #1'); assert.same(split.length, 3, 'S15.5.4.14_A4_T5 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T5 #3'); assert.same(split[1], '', 'S15.5.4.14_A4_T5 #4'); assert.same(split[2], 'o', 'S15.5.4.14_A4_T5 #5'); split = Object('hello').split(/l/, 4); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T6 #1'); assert.same(split.length, 3, 'S15.5.4.14_A4_T6 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T6 #3'); assert.same(split[1], '', 'S15.5.4.14_A4_T6 #4'); assert.same(split[2], 'o', 'S15.5.4.14_A4_T6 #5'); split = Object('hello').split(/l/, undefined); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T7 #1'); assert.same(split.length, 3, 'S15.5.4.14_A4_T7 #2'); assert.same(split[0], 'he', 'S15.5.4.14_A4_T7 #3'); assert.same(split[1], '', 'S15.5.4.14_A4_T7 #4'); assert.same(split[2], 'o', 'S15.5.4.14_A4_T7 #5'); } split = Object('hello').split(/l/, 'hi'); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T8 #1'); assert.same(split.length, 0, 'S15.5.4.14_A4_T8 #2'); split = Object('hello').split(new RegExp()); expected = ['h', 'e', 'l', 'l', 'o']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T10 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T10 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T10 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 0); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T11 #1'); assert.same(split.length, 0, 'S15.5.4.14_A4_T11 #2'); split = Object('hello').split(new RegExp(), 1); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T12 #1'); assert.same(split.length, 1, 'S15.5.4.14_A4_T12 #2'); assert.same(split[0], 'h', 'S15.5.4.14_A4_T12 #3'); split = Object('hello').split(new RegExp(), 2); expected = ['h', 'e']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T13 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T13 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T13 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 3); expected = ['h', 'e', 'l']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T14 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T14 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T14 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 4); expected = ['h', 'e', 'l', 'l']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T15 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T15 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T15 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), undefined); expected = ['h', 'e', 'l', 'l', 'o']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T16 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T16 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T16 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 'hi'); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T18 #1'); assert.same(split.length, 0, 'S15.5.4.14_A4_T18 #2'); split = Object('a b c de f').split(/\s/); expected = ['a', 'b', 'c', 'de', 'f']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T19 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T19 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T19 #${ i + 3 }`); } split = Object('a b c de f').split(/\s/, 3); expected = ['a', 'b', 'c']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T20 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T20 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T20 #${ i + 3 }`); } split = Object('a b c de f').split(/X/); assert.same(split.constructor, Array, 'S15.5.4.14_A4_T21 #1'); assert.same(split.length, 1, 'S15.5.4.14_A4_T21 #2'); assert.same(split[0], 'a b c de f', 'S15.5.4.14_A4_T21 #3'); split = Object('dfe23iu 34 =+65--').split(/\d+/); expected = ['dfe', 'iu ', ' =+', '--']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T22 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T22 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T22 #${ i + 3 }`); } if (NATIVE) { split = Object('abc').split(/[a-z]/); expected = ['', '', '', '']; assert.same(split.constructor, Array, 'S15.5.4.14_A4_T24 #1'); assert.same(split.length, expected.length, 'S15.5.4.14_A4_T24 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.same(expected[i], split[i], `S15.5.4.14_A4_T24 #${ i + 3 }`); } } assert.throws(() => ''.split.call(Symbol('aplit test'), /./), 'throws on symbol context'); }; QUnit.test('String#split regression', run); QUnit.test('RegExp#@@split appearance', assert => { const split = /./[Symbol.split]; assert.isFunction(split); // assert.name(split, '[Symbol.split]'); assert.arity(split, 2); assert.looksNative(split); assert.nonEnumerable(RegExp.prototype, Symbol.split); }); QUnit.test('RegExp#@@split basic behavior', assert => { assert.same(/\s/[Symbol.split]('a b c de f').length, 5); assert.same(/\s/[Symbol.split]('a b c de f', undefined).length, 5); assert.same(/\s/[Symbol.split]('a b c de f', 1).length, 1); assert.same(/\s/[Symbol.split]('a b c de f', 10).length, 5); }); QUnit.test('String#split delegates to @@split', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.split] = function (a, b) { return { a, b }; }; assert.same(string.split(object, 42).a, string); assert.same(string.split(object, 42).b, 42); assert.same(''.split.call(number, object, 42).a, number); assert.same(''.split.call(number, object, 42).b, 42); const regexp = /./; regexp[Symbol.split] = function (a, b) { return { a, b }; }; assert.same(string.split(regexp, 42).a, string); assert.same(string.split(regexp, 42).b, 42); assert.same(''.split.call(number, regexp, 42).a, number); assert.same(''.split.call(number, regexp, 42).b, 42); }); QUnit.test('RegExp#@@split delegates to exec', assert => { let execCalled = false; let speciesCalled = false; let execSpeciesCalled = false; const re = /[24]/; re.exec = function (...args) { execCalled = true; return /./.exec.apply(this, args); }; re.constructor = { // eslint-disable-next-line object-shorthand -- constructor [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); speciesCalled = true; re2.exec = function (...args) { execSpeciesCalled = true; return /./.exec.apply(this, args); }; return re2; }, }; assert.deepEqual(re[Symbol.split]('123451234'), ['1', '3', '51', '3', '']); assert.false(execCalled); assert.true(speciesCalled); assert.true(execSpeciesCalled); re.constructor = { // eslint-disable-next-line object-shorthand -- constructor [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); // Not a function, should be ignored re2.exec = 3; return re2; }, }; assert.deepEqual(re[Symbol.split]('123451234'), ['1', '3', '51', '3', '']); re.constructor = { // eslint-disable-next-line object-shorthand -- constructor [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); // Does not return an object, should throw re2.exec = () => 3; return re2; }, }; assert.throws(() => re[Symbol.split]('123451234')); }); QUnit.test('RegExp#@@split implementation', patchRegExp$exec(run)); core-js-3.33.2/tests/unit-global/es.string.starts-with.js000066400000000000000000000032011451776221300232710ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#startsWith', assert => { const { startsWith } = String.prototype; assert.isFunction(startsWith); assert.arity(startsWith, 1); assert.name(startsWith, 'startsWith'); assert.looksNative(startsWith); assert.nonEnumerable(String.prototype, 'startsWith'); assert.true('undefined'.startsWith()); assert.false('undefined'.startsWith(null)); assert.true('abc'.startsWith('')); assert.true('abc'.startsWith('a')); assert.true('abc'.startsWith('ab')); assert.false('abc'.startsWith('bc')); assert.true('abc'.startsWith('', NaN)); assert.true('abc'.startsWith('a', -1)); assert.false('abc'.startsWith('a', 1)); assert.false('abc'.startsWith('a', Infinity)); assert.true('abc'.startsWith('b', true)); assert.true('abc'.startsWith('a', 'x')); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('startsWith test'); assert.throws(() => startsWith.call(symbol, 'b'), 'throws on symbol context'); assert.throws(() => startsWith.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => startsWith.call(null, '.'), TypeError); assert.throws(() => startsWith.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.startsWith(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.startsWith(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.startsWith(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.startsWith(object), TypeError); }); core-js-3.33.2/tests/unit-global/es.string.strike.js000066400000000000000000000007221451776221300223060ustar00rootroot00000000000000QUnit.test('String#strike', assert => { const { strike } = String.prototype; assert.isFunction(strike); assert.arity(strike, 0); assert.name(strike, 'strike'); assert.looksNative(strike); assert.nonEnumerable(String.prototype, 'strike'); assert.same('a'.strike(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => strike.call(Symbol('strike test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.sub.js000066400000000000000000000006531451776221300216010ustar00rootroot00000000000000QUnit.test('String#sub', assert => { const { sub } = String.prototype; assert.isFunction(sub); assert.arity(sub, 0); assert.name(sub, 'sub'); assert.looksNative(sub); assert.nonEnumerable(String.prototype, 'sub'); assert.same('a'.sub(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => sub.call(Symbol('sub test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.substr.js000066400000000000000000000013561451776221300223330ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#substr', assert => { const { substr } = String.prototype; assert.isFunction(substr); assert.arity(substr, 2); assert.name(substr, 'substr'); assert.looksNative(substr); assert.nonEnumerable(String.prototype, 'substr'); assert.same('12345'.substr(1, 3), '234'); assert.same('ab'.substr(-1), 'b'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => substr.call(Symbol('substr test'), 1, 3), 'throws on symbol context'); } if (STRICT) { assert.throws(() => substr.call(null, 1, 3), TypeError, 'Throws on null as `this`'); assert.throws(() => substr.call(undefined, 1, 3), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.33.2/tests/unit-global/es.string.sup.js000066400000000000000000000006531451776221300216170ustar00rootroot00000000000000QUnit.test('String#sup', assert => { const { sup } = String.prototype; assert.isFunction(sup); assert.arity(sup, 0); assert.name(sup, 'sup'); assert.looksNative(sup); assert.nonEnumerable(String.prototype, 'sup'); assert.same('a'.sup(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => sup.call(Symbol('sup test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-global/es.string.to-well-formed.js000066400000000000000000000032371451776221300236460ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#toWellFormed', assert => { const { toWellFormed } = String.prototype; assert.isFunction(toWellFormed); assert.arity(toWellFormed, 0); assert.name(toWellFormed, 'toWellFormed'); assert.looksNative(toWellFormed); assert.nonEnumerable(String.prototype, 'toWellFormed'); assert.same(toWellFormed.call('a'), 'a', 'a'); assert.same(toWellFormed.call('abc'), 'abc', 'abc'); assert.same(toWellFormed.call('💩'), '💩', '💩'); assert.same(toWellFormed.call('💩b'), '💩b', '💩b'); assert.same(toWellFormed.call('a💩'), 'a💩', '💩'); assert.same(toWellFormed.call('a💩b'), 'a💩b', 'a💩b'); assert.same(toWellFormed.call('💩a💩'), '💩a💩'); assert.same(toWellFormed.call('\uD83D'), '\uFFFD', '\uD83D'); assert.same(toWellFormed.call('\uDCA9'), '\uFFFD', '\uDCA9'); assert.same(toWellFormed.call('\uDCA9\uD83D'), '\uFFFD\uFFFD', '\uDCA9\uD83D'); assert.same(toWellFormed.call('a\uD83D'), 'a\uFFFD', 'a\uFFFD'); assert.same(toWellFormed.call('\uDCA9a'), '\uFFFDa', '\uDCA9a'); assert.same(toWellFormed.call('a\uD83Da'), 'a\uFFFDa', 'a\uD83Da'); assert.same(toWellFormed.call('a\uDCA9a'), 'a\uFFFDa', 'a\uDCA9a'); assert.same(toWellFormed.call({ toString() { return 'abc'; }, }), 'abc', 'conversion #1'); assert.same(toWellFormed.call(1), '1', 'conversion #2'); if (STRICT) { assert.throws(() => toWellFormed.call(null), TypeError, 'coercible #1'); assert.throws(() => toWellFormed.call(undefined), TypeError, 'coercible #2'); } assert.throws(() => toWellFormed.call(Symbol('toWellFormed test')), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-global/es.string.trim-end.js000066400000000000000000000015711451776221300225270ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; QUnit.test('String#trimEnd', assert => { const { trimEnd, trimRight } = String.prototype; assert.isFunction(trimEnd); assert.arity(trimEnd, 0); assert.name(trimEnd, 'trimEnd'); assert.looksNative(trimEnd); assert.nonEnumerable(String.prototype, 'trimEnd'); assert.same(trimEnd, trimRight, 'same #trimRight'); assert.same(' \n q w e \n '.trimEnd(), ' \n q w e', 'removes whitespaces at right side of string'); assert.same(WHITESPACES.trimEnd(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimEnd(), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimEnd.call(Symbol('trimEnd test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimEnd.call(null, 0), TypeError); assert.throws(() => trimEnd.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.trim-left.js000066400000000000000000000016311451776221300227100ustar00rootroot00000000000000/* eslint-disable unicorn/prefer-string-trim-start-end -- required for testing */ import { STRICT, WHITESPACES } from '../helpers/constants.js'; QUnit.test('String#trimLeft', assert => { const { trimLeft } = String.prototype; assert.isFunction(trimLeft); assert.arity(trimLeft, 0); assert.name(trimLeft, 'trimStart'); assert.looksNative(trimLeft); assert.nonEnumerable(String.prototype, 'trimLeft'); assert.same(' \n q w e \n '.trimLeft(), 'q w e \n ', 'removes whitespaces at left side of string'); assert.same(WHITESPACES.trimLeft(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimLeft(), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimLeft.call(Symbol('trimLeft test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimLeft.call(null, 0), TypeError); assert.throws(() => trimLeft.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.trim-right.js000066400000000000000000000016461451776221300231010ustar00rootroot00000000000000/* eslint-disable unicorn/prefer-string-trim-start-end -- required for testing */ import { STRICT, WHITESPACES } from '../helpers/constants.js'; QUnit.test('String#trimRight', assert => { const { trimRight } = String.prototype; assert.isFunction(trimRight); assert.arity(trimRight, 0); assert.name(trimRight, 'trimEnd'); assert.looksNative(trimRight); assert.nonEnumerable(String.prototype, 'trimRight'); assert.same(' \n q w e \n '.trimRight(), ' \n q w e', 'removes whitespaces at right side of string'); assert.same(WHITESPACES.trimRight(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimRight(), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimRight.call(Symbol('trimRight test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimRight.call(null, 0), TypeError); assert.throws(() => trimRight.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.trim-start.js000066400000000000000000000016251451776221300231160ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; QUnit.test('String#trimStart', assert => { const { trimStart, trimLeft } = String.prototype; assert.isFunction(trimStart); assert.arity(trimStart, 0); assert.name(trimStart, 'trimStart'); assert.looksNative(trimStart); assert.nonEnumerable(String.prototype, 'trimStart'); assert.same(trimStart, trimLeft, 'same #trimLeft'); assert.same(' \n q w e \n '.trimStart(), 'q w e \n ', 'removes whitespaces at left side of string'); assert.same(WHITESPACES.trimStart(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimStart(), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimStart.call(Symbol('trimStart test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimStart.call(null, 0), TypeError); assert.throws(() => trimStart.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.string.trim.js000066400000000000000000000015131451776221300217570ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; QUnit.test('String#trim', assert => { const { trim } = String.prototype; assert.isFunction(''.trim); assert.arity(trim, 0); assert.name(trim, 'trim'); assert.looksNative(trim); assert.nonEnumerable(String.prototype, 'trim'); assert.same(' \n q w e \n '.trim(), 'q w e', 'removes whitespaces at left & right side of string'); assert.same(WHITESPACES.trim(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trim(), '\u200B\u0085', "shouldn't remove this symbols"); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => trim.call(Symbol('trim test')), 'throws on symbol context'); } if (STRICT) { assert.throws(() => trim.call(null, 0), TypeError); assert.throws(() => trim.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.symbol.async-iterator.js000066400000000000000000000011441451776221300237470ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.asyncIterator', assert => { assert.true('asyncIterator' in Symbol, 'Symbol.asyncIterator available'); assert.nonEnumerable(Symbol, 'asyncIterator'); assert.true(Object(Symbol.asyncIterator) instanceof Symbol, 'Symbol.asyncIterator is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncIterator'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/es.symbol.constructor.js000066400000000000000000000171321451776221300233740ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; const { defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, keys, create, } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('Symbol', assert => { assert.isFunction(Symbol); if (NATIVE) assert.same(Symbol.length, 0, 'arity is 0'); assert.name(Symbol, 'Symbol'); assert.looksNative(Symbol); const symbol1 = Symbol('symbol'); const symbol2 = Symbol('symbol'); assert.notSame(symbol1, symbol2, 'Symbol("symbol") !== Symbol("symbol")'); const object = {}; object[symbol1] = 42; assert.same(object[symbol1], 42, 'Symbol() work as key'); assert.notSame(object[symbol2], 42, 'Various symbols from one description are various keys'); // assert.throws(() => Symbol(Symbol('foo')), 'throws on symbol argument'); if (DESCRIPTORS) { let count = 0; // eslint-disable-next-line no-unused-vars -- required for testing for (const key in object) count++; assert.same(count, 0, 'object[Symbol()] is not enumerable'); } }); QUnit.test('Symbol as global key', assert => { const TEXT = 'test global symbol key'; const symbol = Symbol(TEXT); GLOBAL[symbol] = TEXT; assert.same(GLOBAL[symbol], TEXT, TEXT); }); QUnit.test('Well-known Symbols', assert => { const wks = [ 'hasInstance', 'isConcatSpreadable', 'iterator', 'match', 'matchAll', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables', ]; for (const name of wks) { assert.true(name in Symbol, `Symbol.${ name } available`); assert.true(Object(Symbol[name]) instanceof Symbol, `Symbol.${ name } is symbol`); if (DESCRIPTORS) { const descriptor = getOwnPropertyDescriptor(Symbol, name); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } } }); QUnit.test('Symbol#@@toPrimitive', assert => { const symbol = Symbol('Symbol#@@toPrimitive test'); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); QUnit.test('Symbol#@@toStringTag', assert => { assert.same(Symbol.prototype[Symbol.toStringTag], 'Symbol', 'Symbol::@@toStringTag is `Symbol`'); }); if (DESCRIPTORS) { QUnit.test('Symbols & descriptors', assert => { const d = Symbol('d'); const e = Symbol('e'); const f = Symbol('f'); const i = Symbol('i'); const j = Symbol('j'); const prototype = { g: 'g' }; prototype[i] = 'i'; defineProperty(prototype, 'h', { value: 'h', }); defineProperty(prototype, 'j', { value: 'j', }); const object = create(prototype); object.a = 'a'; object[d] = 'd'; defineProperty(object, 'b', { value: 'b', }); defineProperty(object, 'c', { value: 'c', enumerable: true, }); defineProperty(object, e, { configurable: true, writable: true, value: 'e', }); const descriptor = { value: 'f', enumerable: true, }; defineProperty(object, f, descriptor); assert.true(descriptor.enumerable, 'defineProperty not changes descriptor object'); assert.deepEqual(getOwnPropertyDescriptor(object, 'a'), { configurable: true, writable: true, enumerable: true, value: 'a', }, 'getOwnPropertyDescriptor a'); assert.deepEqual(getOwnPropertyDescriptor(object, 'b'), { configurable: false, writable: false, enumerable: false, value: 'b', }, 'getOwnPropertyDescriptor b'); assert.deepEqual(getOwnPropertyDescriptor(object, 'c'), { configurable: false, writable: false, enumerable: true, value: 'c', }, 'getOwnPropertyDescriptor c'); assert.deepEqual(getOwnPropertyDescriptor(object, d), { configurable: true, writable: true, enumerable: true, value: 'd', }, 'getOwnPropertyDescriptor d'); assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: false, value: 'e', }, 'getOwnPropertyDescriptor e'); assert.deepEqual(getOwnPropertyDescriptor(object, f), { configurable: false, writable: false, enumerable: true, value: 'f', }, 'getOwnPropertyDescriptor f'); assert.same(getOwnPropertyDescriptor(object, 'g'), undefined, 'getOwnPropertyDescriptor g'); assert.same(getOwnPropertyDescriptor(object, 'h'), undefined, 'getOwnPropertyDescriptor h'); assert.same(getOwnPropertyDescriptor(object, i), undefined, 'getOwnPropertyDescriptor i'); assert.same(getOwnPropertyDescriptor(object, j), undefined, 'getOwnPropertyDescriptor j'); assert.same(getOwnPropertyDescriptor(object, 'k'), undefined, 'getOwnPropertyDescriptor k'); assert.false(getOwnPropertyDescriptor(Object.prototype, 'toString').enumerable, 'getOwnPropertyDescriptor on Object.prototype'); assert.same(getOwnPropertyDescriptor(Object.prototype, d), undefined, 'getOwnPropertyDescriptor on Object.prototype missed symbol'); assert.same(keys(object).length, 2, 'Object.keys'); assert.same(getOwnPropertyNames(object).length, 3, 'Object.getOwnPropertyNames'); assert.same(getOwnPropertySymbols(object).length, 3, 'Object.getOwnPropertySymbols'); assert.same(ownKeys(object).length, 6, 'Reflect.ownKeys'); delete object[e]; object[e] = 'e'; assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: true, value: 'e', }, 'redefined non-enum key'); }); QUnit.test('Symbols & Object.defineProperties', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = defineProperties({}, descriptors); assert.same(object.a, 'a', 'a'); assert.same(object.b, undefined, 'b'); assert.same(object[c], 'c', 'c'); assert.same(object[d], undefined, 'd'); }); QUnit.test('Symbols & Object.create', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = create(null, descriptors); assert.same(object.a, 'a', 'a'); assert.same(object.b, undefined, 'b'); assert.same(object[c], 'c', 'c'); assert.same(object[d], undefined, 'd'); }); const constructors = ['Map', 'Set', 'Promise']; for (const name of constructors) { QUnit.test(`${ name }@@species`, assert => { assert.same(GLOBAL[name][Symbol.species], GLOBAL[name], `${ name }@@species === ${ name }`); const Subclass = create(GLOBAL[name]); assert.same(Subclass[Symbol.species], Subclass, `${ name } subclass`); }); } QUnit.test('Array@@species', assert => { assert.same(Array[Symbol.species], Array, 'Array@@species === Array'); const Subclass = create(Array); assert.same(Subclass[Symbol.species], Subclass, 'Array subclass'); }); QUnit.test('Symbol.sham flag', assert => { assert.same(Symbol.sham, typeof Symbol('Symbol.sham flag test') == 'symbol' ? undefined : true); }); } core-js-3.33.2/tests/unit-global/es.symbol.description.js000066400000000000000000000024171451776221300233320ustar00rootroot00000000000000/* eslint-disable symbol-description -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol#description', assert => { assert.same(Symbol('foo').description, 'foo'); assert.same(Symbol('').description, ''); assert.same(Symbol(')').description, ')'); assert.same(Symbol({}).description, '[object Object]'); assert.same(Symbol(null).description, 'null'); assert.same(Symbol(undefined).description, undefined); assert.same(Symbol().description, undefined); assert.same(Object(Symbol('foo')).description, 'foo'); assert.same(Object(Symbol()).description, undefined); if (DESCRIPTORS) { assert.false(Object.hasOwn(Symbol('foo'), 'description')); const descriptor = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description'); assert.false(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); } if (typeof Symbol() == 'symbol') { assert.same(Symbol('foo').toString(), 'Symbol(foo)'); assert.same(String(Symbol('foo')), 'Symbol(foo)'); assert.same(Symbol('').toString(), 'Symbol()'); assert.same(String(Symbol('')), 'Symbol()'); assert.same(Symbol().toString(), 'Symbol()'); assert.same(String(Symbol()), 'Symbol()'); } }); core-js-3.33.2/tests/unit-global/es.symbol.for.js000066400000000000000000000011561451776221300215740ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants.js'; QUnit.test('Symbol.for', assert => { assert.isFunction(Symbol.for, 'Symbol.for is function'); assert.nonEnumerable(Symbol, 'for'); assert.arity(Symbol.for, 1, 'Symbol.for arity is 1'); if (NATIVE) assert.name(Symbol.for, 'for', 'Symbol.for.name is "for"'); assert.looksNative(Symbol.for, 'Symbol.for looks like native'); const symbol = Symbol.for('foo'); assert.same(Symbol.for('foo'), symbol, 'registry'); assert.true(Object(symbol) instanceof Symbol, 'returns symbol'); assert.throws(() => Symbol.for(Symbol('foo')), 'throws on symbol argument'); }); core-js-3.33.2/tests/unit-global/es.symbol.key-for.js000066400000000000000000000010341451776221300223550ustar00rootroot00000000000000QUnit.test('Symbol.keyFor', assert => { assert.isFunction(Symbol.keyFor, 'Symbol.keyFor is function'); assert.nonEnumerable(Symbol, 'keyFor'); assert.arity(Symbol.keyFor, 1, 'Symbol.keyFor arity is 1'); assert.name(Symbol.keyFor, 'keyFor', 'Symbol.keyFor.name is "keyFor"'); assert.looksNative(Symbol.keyFor, 'Symbol.keyFor looks like native'); assert.same(Symbol.keyFor(Symbol.for('foo')), 'foo'); assert.same(Symbol.keyFor(Symbol('foo')), undefined); assert.throws(() => Symbol.keyFor('foo'), 'throws on non-symbol'); }); core-js-3.33.2/tests/unit-global/es.typed-array.at.js000066400000000000000000000027611451776221300223510ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.indexOf', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { at } = TypedArray.prototype; assert.isFunction(at, `${ name }::at is function`); assert.arity(at, 1, `${ name }::at arity is 1`); assert.name(at, 'at', `${ name }::at name is 'at'`); assert.looksNative(at, `${ name }::at looks native`); assert.same(1, new TypedArray([1, 2, 3]).at(0)); assert.same(2, new TypedArray([1, 2, 3]).at(1)); assert.same(3, new TypedArray([1, 2, 3]).at(2)); assert.same(undefined, new TypedArray([1, 2, 3]).at(3)); assert.same(3, new TypedArray([1, 2, 3]).at(-1)); assert.same(2, new TypedArray([1, 2, 3]).at(-2)); assert.same(1, new TypedArray([1, 2, 3]).at(-3)); assert.same(undefined, new TypedArray([1, 2, 3]).at(-4)); assert.same(1, new TypedArray([1, 2, 3]).at(0.4)); assert.same(1, new TypedArray([1, 2, 3]).at(0.5)); assert.same(1, new TypedArray([1, 2, 3]).at(0.6)); assert.same(1, new TypedArray([1]).at(NaN)); assert.same(1, new TypedArray([1]).at()); assert.same(1, new TypedArray([1, 2, 3]).at(-0)); assert.throws(() => at.call({ 0: 1, length: 1 }, 0), TypeError); assert.throws(() => at.call(null, 0), TypeError); assert.throws(() => at.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/es.typed-array.constructors.js000066400000000000000000000324461451776221300245200ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, TYPED_ARRAYS } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; const { keys, getOwnPropertyDescriptor, getPrototypeOf, defineProperty, assign } = Object; if (DESCRIPTORS) { for (const { name, TypedArray, bytes } of TYPED_ARRAYS) { QUnit.test(`${ name } constructor`, assert => { assert.isFunction(TypedArray); assert.arity(TypedArray, 3); assert.name(TypedArray, name); // Safari 5 bug if (NATIVE) assert.looksNative(TypedArray); assert.same(TypedArray.BYTES_PER_ELEMENT, bytes, `${ name }.BYTES_PER_ELEMENT`); let array = new TypedArray(4); assert.same(array.BYTES_PER_ELEMENT, bytes, '#BYTES_PER_ELEMENT'); assert.same(array.byteOffset, 0, `${ name }#byteOffset, passed number`); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed number'); assert.arrayEqual(array, [0, 0, 0, 0], 'correct values, passed number'); assert.notThrows(() => { // throws in IE / Edge / FF array = new TypedArray('0x4'); assert.same(array.byteOffset, 0, '#byteOffset, passed string'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed string'); assert.arrayEqual(array, [0, 0, 0, 0], 'correct values, passed string'); return true; }, 'passed string'); assert.notThrows(() => { // throws in IE / Edge / FF array = new TypedArray(true); assert.same(array.byteOffset, 0, '#byteOffset, passed boolean'); assert.same(array.byteLength, 1 * bytes, '#byteLength, passed boolean'); assert.arrayEqual(array, [0], 'correct values, passed boolean'); return true; }, 'passed boolean'); assert.notThrows(() => { array = new TypedArray(); assert.same(array.byteOffset, 0, '#byteOffset, without arguments'); assert.same(array.byteLength, 0, '#byteLength, without arguments'); assert.arrayEqual(array, [], 'correct values, without arguments'); return true; }, 'without arguments'); assert.notThrows(() => { array = new TypedArray(undefined); assert.same(array.byteOffset, 0, '#byteOffset, passed undefined'); assert.same(array.byteLength, 0, '#byteLength, passed undefined'); assert.arrayEqual(array, [], 'correct values, passed undefined'); return true; }, 'passed undefined'); assert.notThrows(() => { array = new TypedArray(-0); assert.same(array.byteOffset, 0, '#byteOffset, passed -0'); assert.same(array.byteLength, 0, '#byteLength, passed -0'); assert.arrayEqual(array, [], 'correct values, passed -0'); return true; }, 'passed -0'); assert.notThrows(() => { array = new TypedArray(NaN); assert.same(array.byteOffset, 0, '#byteOffset, passed NaN'); assert.same(array.byteLength, 0, '#byteLength, passed NaN'); assert.arrayEqual(array, [], 'correct values, passed NaN'); return true; }, 'passed NaN'); assert.notThrows(() => { array = new TypedArray(1.5); assert.same(array.byteOffset, 0, '#byteOffset, passed 1.5'); assert.same(array.byteLength, 1 * bytes, '#byteLength, passed 1.5'); assert.arrayEqual(array, [0], 'correct values, passed 1.5'); return true; }, 'passed 1.5'); if (NATIVE) assert.throws(() => new TypedArray(-1), RangeError, 'throws on -1'); assert.notThrows(() => { array = new TypedArray(null); assert.same(array.byteOffset, 0, '#byteOffset, passed null'); assert.same(array.byteLength, 0, '#byteLength, passed null'); assert.arrayEqual(array, [], 'correct values, passed null'); return true; }, 'passed null'); array = new TypedArray([1, 2, 3, 4]); assert.same(array.byteOffset, 0, '#byteOffset, passed array'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed array'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed array'); array = new TypedArray({ 0: 1, 1: 2, 2: 3, 3: 4, length: 4, }); assert.same(array.byteOffset, 0, '#byteOffset, passed array-like'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed array-like'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed array-like'); assert.notThrows(() => { // throws in IE / Edge array = new TypedArray({}); assert.same(array.byteOffset, 0, '#byteOffset, passed empty object (also array-like case)'); assert.same(array.byteLength, 0, '#byteLength, passed empty object (also array-like case)'); assert.arrayEqual(array, [], 'correct values, passed empty object (also array-like case)'); return true; }, 'passed empty object (also array-like case)'); assert.notThrows(() => { array = new TypedArray(createIterable([1, 2, 3, 4])); assert.same(array.byteOffset, 0, '#byteOffset, passed iterable'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed iterable'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed iterable'); return true; }, 'passed iterable'); assert.notThrows(() => { array = new TypedArray([{ valueOf() { return 2; } }]); assert.same(array.byteOffset, 0, '#byteOffset, passed array with object convertible to primitive'); assert.same(array.byteLength, bytes, '#byteLength, passed array with object convertible to primitive'); assert.arrayEqual(array, [2], 'correct values, passed array with object convertible to primitive'); return true; }, 'passed array with object convertible to primitive'); assert.notThrows(() => { array = new TypedArray(createIterable([{ valueOf() { return 2; } }])); assert.same(array.byteOffset, 0, '#byteOffset, passed iterable with object convertible to primitive'); assert.same(array.byteLength, bytes, '#byteLength, passed iterable with object convertible to primitive'); assert.arrayEqual(array, [2], 'correct values, passed iterable with object convertible to primitive'); return true; }, 'passed iterable with object convertible to primitive'); array = new TypedArray(new TypedArray([1, 2, 3, 4])); assert.same(array.byteOffset, 0, '#byteOffset, passed typed array'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed typed array'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed typed array'); const fake = new TypedArray([1, 2, 3, 4]); fake[Symbol.iterator] = function () { return createIterable([4, 3, 2, 1])[Symbol.iterator](); }; array = new TypedArray(fake); assert.same(array.byteOffset, 0, '#byteOffset, passed typed array with custom iterator'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed typed array with custom iterator'); // https://code.google.com/p/v8/issues/detail?id=4552 assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed typed array with custom iterator'); array = new TypedArray(new ArrayBuffer(8)); assert.same(array.byteOffset, 0, '#byteOffset, passed buffer'); assert.same(array.byteLength, 8, '#byteLength, passed buffer'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer'); array = new TypedArray(new ArrayBuffer(16), 8); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer and byteOffset'); assert.same(array.byteLength, 8, '#byteLength, passed buffer and byteOffset'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer and byteOffset'); array = new TypedArray(new ArrayBuffer(24), 8, 8 / bytes); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and length'); assert.same(array.byteLength, 8, '#byteLength, passed buffer, byteOffset and length'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer, byteOffset and length'); array = new TypedArray(new ArrayBuffer(8), undefined); assert.same(array.byteOffset, 0, '#byteOffset, passed buffer and undefined'); assert.same(array.byteLength, 8, '#byteLength, passed buffer and undefined'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer and undefined'); array = new TypedArray(new ArrayBuffer(16), 8, undefined); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and undefined'); assert.same(array.byteLength, 8, '#byteLength, passed buffer, byteOffset and undefined'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer, byteOffset and undefined'); array = new TypedArray(new ArrayBuffer(8), 8); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer and byteOffset with buffer length'); assert.same(array.byteLength, 0, '#byteLength, passed buffer and byteOffset with buffer length'); assert.arrayEqual(array, [], 'correct values, passed buffer and byteOffset with buffer length'); // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), -1), RangeError, 'If offset < 0, throw a RangeError exception'); if (bytes !== 1) { // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), 3), RangeError, 'If offset modulo elementSize ≠ 0, throw a RangeError exception'); } if (NATIVE) { if (bytes !== 1) { // fails in Opera 12 assert.throws(() => new TypedArray(new ArrayBuffer(9)), RangeError, 'If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception'); } assert.throws(() => new TypedArray(new ArrayBuffer(8), 16), RangeError, 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new TypedArray(new ArrayBuffer(24), 8, 24), RangeError, 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } else { // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), 16), 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new TypedArray(new ArrayBuffer(24), 8, 24), 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } assert.throws(() => TypedArray(1), TypeError, 'throws without `new`'); assert.same(TypedArray[Symbol.species], TypedArray, '@@species'); }); QUnit.test(`${ name } descriptors`, assert => { const array = new TypedArray(2); const descriptor = getOwnPropertyDescriptor(array, 0); const base = NATIVE ? { writable: true, enumerable: true, configurable: false, } : { writable: descriptor.writable, enumerable: true, configurable: descriptor.configurable, }; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: 0, }, base), 'Object.getOwnPropertyDescriptor'); if (NATIVE) { // fails in old WebKit assert.arrayEqual(keys(array), ['0', '1'], 'Object.keys'); const results = []; for (const key in array) results.push(key); // fails in old WebKit assert.arrayEqual(results, ['0', '1'], 'for-in'); defineProperty(array, 0, { value: 1, writable: true, enumerable: true, configurable: false, }); array[0] = array[1] = 2.5; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: array[1], }, base), 'Object.defineProperty, valid descriptor #1'); defineProperty(array, 0, { value: 1, }); array[0] = array[1] = 3.5; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: array[1], }, base), 'Object.defineProperty, valid descriptor #2'); assert.throws(() => defineProperty(array, 0, { value: 2, writable: false, enumerable: true, configurable: false, }), 'Object.defineProperty, invalid descriptor #1'); assert.throws(() => defineProperty(array, 0, { value: 2, writable: true, enumerable: false, configurable: false, }), 'Object.defineProperty, invalid descriptor #2'); assert.throws(() => defineProperty(array, 0, { get() { return 2; }, }), 'Object.defineProperty, invalid descriptor #3'); } assert.throws(() => defineProperty(array, 0, { value: 2, get() { return 2; }, }), 'Object.defineProperty, invalid descriptor #4'); }); QUnit.test(`${ name } @@toStringTag`, assert => { const TypedArrayPrototype = getPrototypeOf(TypedArray.prototype); const descriptor = getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag); const getter = descriptor.get; assert.isFunction(getter); assert.same(getter.call(new Int8Array(1)), 'Int8Array'); assert.same(getter.call(new TypedArray(1)), name); assert.same(getter.call([]), undefined); assert.same(getter.call({}), undefined); assert.same(getter.call(), undefined); }); QUnit.test(`${ name }.sham`, assert => { if (TypedArray.sham) assert.required(`${ name }.sham flag exists`); else assert.required(`${ name }.sham flag missed`); }); } } core-js-3.33.2/tests/unit-global/es.typed-array.copy-within.js000066400000000000000000000036311451776221300242140ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.copyWithin', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { copyWithin } = TypedArray.prototype; assert.isFunction(copyWithin, `${ name }::copyWithin is function`); assert.arity(copyWithin, 2, `${ name }::copyWithin arity is 2`); assert.name(copyWithin, 'copyWithin', `${ name }::copyWithin name is 'copyWithin'`); assert.looksNative(copyWithin, `${ name }::copyWithin looks native`); const array = new TypedArray(5); assert.same(array.copyWithin(0), array, 'return this'); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, 3), [4, 5, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 3), [1, 4, 5, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 2), [1, 3, 4, 5, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(2, 2), [1, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, 3, 4), [4, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 3, 4), [1, 4, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 2, 4), [1, 3, 4, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, -2), [4, 5, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, -2, -1), [4, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3, -2), [1, 3, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3, -1), [1, 3, 4, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3), [1, 3, 4, 5, 5]); assert.throws(() => copyWithin.call([0], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.every.js000066400000000000000000000033361451776221300230760ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.every', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { every } = TypedArray.prototype; assert.isFunction(every, `${ name }::every is function`); assert.arity(every, 1, `${ name }::every arity is 1`); assert.name(every, 'every', `${ name }::every name is 'every'`); assert.looksNative(every, `${ name }::every looks native`); const array = new TypedArray([1]); const context = {}; array.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new TypedArray([1, 2, 3]).every(it => typeof it == 'number')); assert.true(new TypedArray([1, 2, 3]).every(it => it < 4)); assert.false(new TypedArray([1, 2, 3]).every(it => it < 3)); assert.false(new TypedArray([1, 2, 3]).every(it => typeof it == 'string')); assert.true(new TypedArray([1, 2, 3]).every(function () { return +this === 1; }, 1)); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).every((value, key) => { values += value; keys += key; return true; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => every.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.fill.js000066400000000000000000000026751451776221300226770ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.fill', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { fill } = TypedArray.prototype; assert.isFunction(fill, `${ name }::fill is function`); assert.arity(fill, 1, `${ name }::fill arity is 1`); assert.name(fill, 'fill', `${ name }::fill name is 'fill'`); assert.looksNative(fill, `${ name }::fill looks native`); const array = new TypedArray(5); assert.same(array.fill(5), array, 'return this'); assert.arrayEqual(new TypedArray(5).fill(5), [5, 5, 5, 5, 5], 'basic'); assert.arrayEqual(new TypedArray(5).fill(5, 1), [0, 5, 5, 5, 5], 'start index'); assert.arrayEqual(new TypedArray(5).fill(5, 1, 4), [0, 5, 5, 5, 0], 'end index'); assert.arrayEqual(new TypedArray(5).fill(5, 6, 1), [0, 0, 0, 0, 0], 'start > end'); assert.arrayEqual(new TypedArray(5).fill(5, -3, 4), [0, 0, 5, 5, 0], 'negative start index'); assert.throws(() => fill.call([0], 1), "isn't generic"); const checker = createConversionChecker(10); assert.same(new TypedArray(5).fill(checker)[2], 10); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); } }); core-js-3.33.2/tests/unit-global/es.typed-array.filter.js000066400000000000000000000030551451776221300232270ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.filter', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { filter } = TypedArray.prototype; assert.isFunction(filter, `${ name }::filter is function`); assert.arity(filter, 1, `${ name }::filter arity is 1`); assert.name(filter, 'filter', `${ name }::filter name is 'filter'`); assert.looksNative(filter, `${ name }::filter looks native`); const array = new TypedArray([1]); const context = {}; array.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5, 6, 7, 8, 9]).filter(it => it % 2); assert.true(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [1, 3, 5, 7, 9], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).filter((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => filter.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.find-index.js000066400000000000000000000031371451776221300237700ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.findIndex', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { findIndex } = TypedArray.prototype; assert.isFunction(findIndex, `${ name }::findIndex is function`); assert.arity(findIndex, 1, `${ name }::findIndex arity is 1`); assert.name(findIndex, 'findIndex', `${ name }::findIndex name is 'findIndex'`); assert.looksNative(findIndex, `${ name }::findIndex looks native`); const array = new TypedArray([1]); const context = {}; array.findIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).findIndex(it => !(it % 2)), 1); // eslint-disable-next-line unicorn/prefer-array-index-of -- ignore assert.same(new TypedArray([1, 2, 3]).findIndex(it => it === 4), -1); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).findIndex((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => findIndex.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.find-last-index.js000066400000000000000000000031451451776221300247300ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.findLastIndex', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { findLastIndex } = TypedArray.prototype; assert.isFunction(findLastIndex, `${ name }::findLastIndex is function`); assert.arity(findLastIndex, 1, `${ name }::findLastIndex arity is 1`); assert.name(findLastIndex, 'findLastIndex', `${ name }::findLastIndex name is 'findLastIndex'`); assert.looksNative(findLastIndex, `${ name }::findLastIndex looks native`); const array = new TypedArray([1]); const context = {}; array.findLastIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3, 2, 1]).findLastIndex(it => !(it % 2)), 3); assert.same(new TypedArray([1, 2, 3, 2, 1]).findLastIndex(it => it > 3), -1); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).findLastIndex((value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); assert.throws(() => findLastIndex.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.find-last.js000066400000000000000000000030311451776221300236150ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.findLast', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { findLast } = TypedArray.prototype; assert.isFunction(findLast, `${ name }::findLast is function`); assert.arity(findLast, 1, `${ name }::findLast arity is 1`); assert.name(findLast, 'findLast', `${ name }::findLast name is 'findLast'`); assert.looksNative(findLast, `${ name }::findLast looks native`); const array = new TypedArray([1]); const context = {}; array.findLast(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3, 4, 5]).findLast(it => !(it % 2)), 4); assert.same(new TypedArray([1, 2, 3, 4, 5]).findLast(it => it === 6), undefined); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).findLast((value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); assert.throws(() => findLast.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.find.js000066400000000000000000000027111451776221300226600ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.find', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { find } = TypedArray.prototype; assert.isFunction(find, `${ name }::find is function`); assert.arity(find, 1, `${ name }::find arity is 1`); assert.name(find, 'find', `${ name }::find name is 'find'`); assert.looksNative(find, `${ name }::find looks native`); const array = new TypedArray([1]); const context = {}; array.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).find(it => !(it % 2)), 2); assert.same(new TypedArray([1, 2, 3]).find(it => it === 4), undefined); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).find((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => find.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.for-each.js000066400000000000000000000026621451776221300234310ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.forEach', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { forEach } = TypedArray.prototype; assert.isFunction(forEach, `${ name }::forEach is function`); assert.arity(forEach, 1, `${ name }::forEach arity is 1`); assert.name(forEach, 'forEach', `${ name }::forEach name is 'forEach'`); assert.looksNative(forEach, `${ name }::forEach looks native`); const array = new TypedArray([1]); const context = {}; array.forEach(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).forEach(it => it % 2), undefined); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).forEach((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => forEach.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.from.js000066400000000000000000000050641451776221300227070ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, TYPED_ARRAYS_WITH_BIG_INT } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; if (DESCRIPTORS) QUnit.test('%TypedArray%.from', assert => { // we can't implement %TypedArray% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray, $ } of TYPED_ARRAYS_WITH_BIG_INT) { assert.isFunction(TypedArray.from, `${ name }.from is function`); assert.arity(TypedArray.from, 1, `${ name }.from arity is 1`); assert.name(TypedArray.from, 'from', `${ name }.from name is 'from'`); assert.looksNative(TypedArray.from, `${ name }.from looks native`); let instance = TypedArray.from([$(1), $(2), $(3)]); assert.true(instance instanceof TypedArray, 'correct instance with array'); assert.deepEqual(instance, new TypedArray([$(1), $(2), $(3)]), 'correct elements with array'); instance = TypedArray.from({ 0: $(1), 1: $(2), 2: $(3), length: 3, }); assert.true(instance instanceof TypedArray, 'correct instance with array-like'); assert.deepEqual(instance, new TypedArray([$(1), $(2), $(3)]), 'correct elements with array-like'); instance = TypedArray.from(createIterable([$(1), $(2), $(3)])); assert.true(instance instanceof TypedArray, 'correct instance with iterable'); assert.deepEqual(instance, new TypedArray([$(1), $(2), $(3)]), 'correct elements with iterable'); assert.deepEqual(TypedArray.from([1, 2, 3], it => String(it * it)), new TypedArray([$(1), $(4), $(9)]), 'accept callback'); assert.deepEqual(TypedArray.from([{ valueOf() { return $(2); } }]), new TypedArray([$(2)]), 'passed array with object convertible to primitive'); assert.deepEqual(TypedArray.from(createIterable([{ valueOf() { return $(2); } }])), new TypedArray([$(2)]), 'passed iterable with object convertible to primitive'); const context = {}; TypedArray.from([$(1)], function (value, key) { assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(value, $(1), 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(this, context, 'correct callback context'); return $(1); }, context); assert.throws(() => TypedArray.from.call(undefined, []), "isn't generic #1"); if (NATIVE) { assert.throws(() => TypedArray.from.call(Array, []), "isn't generic #2"); assert.notThrows(() => TypedArray.from({ 0: $(1), length: -1, }, () => { throw new Error(); }), 'uses ToLength'); } } }); core-js-3.33.2/tests/unit-global/es.typed-array.includes.js000066400000000000000000000017611451776221300235520ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.includes', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { includes } = TypedArray.prototype; assert.isFunction(includes, `${ name }::includes is function`); assert.arity(includes, 1, `${ name }::includes arity is 1`); assert.name(includes, 'includes', `${ name }::includes name is 'includes'`); assert.looksNative(includes, `${ name }::includes looks native`); assert.true(new TypedArray([1, 1, 1]).includes(1)); assert.false(new TypedArray([1, 2, 3]).includes(1, 1)); assert.true(new TypedArray([1, 2, 3]).includes(2, 1)); assert.false(new TypedArray([1, 2, 3]).includes(2, -1)); assert.true(new TypedArray([1, 2, 3]).includes(2, -2)); assert.throws(() => includes.call([1], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.index-of.js000066400000000000000000000017561451776221300234610ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.indexOf', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { indexOf } = TypedArray.prototype; assert.isFunction(indexOf, `${ name }::indexOf is function`); assert.arity(indexOf, 1, `${ name }::indexOf arity is 1`); assert.name(indexOf, 'indexOf', `${ name }::indexOf name is 'indexOf'`); assert.looksNative(indexOf, `${ name }::indexOf looks native`); assert.same(new TypedArray([1, 1, 1]).indexOf(1), 0); assert.same(new TypedArray([1, 2, 3]).indexOf(1, 1), -1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, 1), 1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, -1), -1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, -2), 1); assert.throws(() => indexOf.call([1], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.iterator.js000066400000000000000000000117531451776221300235770ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.keys', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { keys } = TypedArray.prototype; assert.isFunction(keys, `${ name }::keys is function`); assert.arity(keys, 0, `${ name }::keys arity is 0`); assert.name(keys, 'keys', `${ name }::keys name is 'keys'`); assert.looksNative(keys, `${ name }::keys looks native`); const iterator = new TypedArray([1, 2, 3]).keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 0, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => keys.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.values', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { values } = TypedArray.prototype; assert.isFunction(values, `${ name }::values is function`); assert.arity(values, 0, `${ name }::values arity is 0`); assert.name(values, 'values', `${ name }::values name is 'values'`); assert.looksNative(values, `${ name }::values looks native`); const iterator = new TypedArray([1, 2, 3]).values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 3, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => values.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.entries', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { entries } = TypedArray.prototype; assert.isFunction(entries, `${ name }::entries is function`); assert.arity(entries, 0, `${ name }::entries arity is 0`); assert.name(entries, 'entries', `${ name }::entries name is 'entries'`); assert.looksNative(entries, `${ name }::entries looks native`); const iterator = new TypedArray([1, 2, 3]).entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 1], done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: [1, 2], done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: [2, 3], done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => entries.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.@@iterator', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { assert.isIterable(TypedArray.prototype, `${ name } is iterable`); assert.arity(TypedArray.prototype[Symbol.iterator], 0, `${ name }::@@iterator arity is 0`); assert.name(TypedArray.prototype[Symbol.iterator], 'values', `${ name }::@@iterator name is 'values'`); assert.looksNative(TypedArray.prototype[Symbol.iterator], `${ name }::@@iterator looks native`); assert.same(TypedArray.prototype[Symbol.iterator], TypedArray.prototype.values); const iterator = new TypedArray([1, 2, 3])[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 3, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => TypedArray.prototype[Symbol.iterator].call([1, 2]), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.join.js000066400000000000000000000015751451776221300227060ustar00rootroot00000000000000/* eslint-disable unicorn/require-array-join-separator -- required for testing */ import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.join', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { join } = TypedArray.prototype; assert.isFunction(join, `${ name }::join is function`); assert.arity(join, 1, `${ name }::join arity is 1`); assert.name(join, 'join', `${ name }::join name is 'join'`); assert.looksNative(join, `${ name }::join looks native`); assert.same(new TypedArray([1, 2, 3]).join('|'), '1|2|3', 'works #1'); assert.same(new TypedArray([1, 2, 3]).join(), '1,2,3', 'works #2'); assert.throws(() => join.call([1, 2, 3]), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.last-index-of.js000066400000000000000000000020661451776221300244150ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.lastIndexOf', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { lastIndexOf } = TypedArray.prototype; assert.isFunction(lastIndexOf, `${ name }::lastIndexOf is function`); assert.arity(lastIndexOf, 1, `${ name }::lastIndexOf arity is 1`); assert.name(lastIndexOf, 'lastIndexOf', `${ name }::lastIndexOf name is 'lastIndexOf'`); assert.looksNative(lastIndexOf, `${ name }::lastIndexOf looks native`); assert.same(new TypedArray([1, 1, 1]).lastIndexOf(1), 2); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(3, 1), -1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, 1), 1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, -3), -1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, -2), 1); assert.throws(() => lastIndexOf.call([1], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.map.js000066400000000000000000000027621451776221300225230ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.map', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { map } = TypedArray.prototype; assert.isFunction(map, `${ name }::map is function`); assert.arity(map, 1, `${ name }::map arity is 1`); assert.name(map, 'map', `${ name }::map name is 'map'`); assert.looksNative(map, `${ name }::map looks native`); const array = new TypedArray([1]); const context = {}; array.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5]).map(it => it * 2); assert.true(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [2, 4, 6, 8, 10], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).map((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => map.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.of.js000066400000000000000000000024711451776221300223470ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArray%.of', assert => { // we can't implement %TypedArray% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { assert.isFunction(TypedArray.of, `${ name }.of is function`); assert.arity(TypedArray.of, 0, `${ name }.of arity is 0`); assert.name(TypedArray.of, 'of', `${ name }.of name is 'of'`); assert.looksNative(TypedArray.of, `${ name }.of looks native`); let instance = TypedArray.of(); assert.true(instance instanceof TypedArray, 'correct instance with 0 arguments'); assert.arrayEqual(instance, [], 'correct elements with 0 arguments'); instance = TypedArray.of(1); assert.true(instance instanceof TypedArray, 'correct instance with 1 argument'); assert.arrayEqual(instance, [1], 'correct elements with 1 argument'); instance = TypedArray.of(1, 2, 3); assert.true(instance instanceof TypedArray, 'correct instance with several arguments'); assert.arrayEqual(instance, [1, 2, 3], 'correct elements with several arguments'); assert.throws(() => TypedArray.of.call(undefined, 1), "isn't generic #1"); if (NATIVE) assert.throws(() => TypedArray.of.call(Array, 1), "isn't generic #2"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.reduce-right.js000066400000000000000000000037541451776221300243320ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reduceRight', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { reduceRight } = TypedArray.prototype; assert.isFunction(reduceRight, `${ name }::reduceRight is function`); assert.arity(reduceRight, 1, `${ name }::reduceRight arity is 1`); assert.name(reduceRight, 'reduceRight', `${ name }::reduceRight name is 'reduceRight'`); assert.looksNative(reduceRight, `${ name }::reduceRight looks native`); const array = new TypedArray([1]); const accumulator = {}; array.reduceRight(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(new TypedArray([1, 2, 3]).reduceRight(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new TypedArray([1, 2]).reduceRight((memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same(new TypedArray([1, 2, 3]).reduceRight((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).reduceRight((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.throws(() => reduceRight.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.reduce.js000066400000000000000000000036221451776221300232110ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reduce', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { reduce } = TypedArray.prototype; assert.isFunction(reduce, `${ name }::reduce is function`); assert.arity(reduce, 1, `${ name }::reduce arity is 1`); assert.name(reduce, 'reduce', `${ name }::reduce name is 'reduce'`); assert.looksNative(reduce, `${ name }::reduce looks native`); const array = new TypedArray([1]); const accumulator = {}; array.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(new TypedArray([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new TypedArray([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same(new TypedArray([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).reduce((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.throws(() => reduce.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.reverse.js000066400000000000000000000017121451776221300234130ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reverse', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { reverse } = TypedArray.prototype; assert.isFunction(reverse, `${ name }::reverse is function`); assert.arity(reverse, 0, `${ name }::reverse arity is 0`); assert.name(reverse, 'reverse', `${ name }::reverse name is 'reverse'`); assert.looksNative(reverse, `${ name }::reverse looks native`); const array = new TypedArray([1, 2]); assert.same(array.reverse(), array, 'return this'); assert.arrayEqual(new TypedArray([1, 2, 3, 4]).reverse(), [4, 3, 2, 1], 'works #1'); assert.arrayEqual(new TypedArray([1, 2, 3]).reverse(), [3, 2, 1], 'works #2'); assert.throws(() => reverse.call([1, 2]), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.set.js000066400000000000000000000033271451776221300225370ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.set', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { set } = TypedArray.prototype; assert.isFunction(set, `${ name }::set is function`); if (NATIVE) assert.arity(set, 1, `${ name }::set arity is 1`); assert.name(set, 'set', `${ name }::set name is 'set'`); assert.looksNative(set, `${ name }::set looks native`); assert.same(new TypedArray(1).set([1]), undefined, 'void'); const array1 = new TypedArray([1, 2, 3, 4, 5]); const array2 = new TypedArray(5); array2.set(array1); assert.arrayEqual(array2, [1, 2, 3, 4, 5]); assert.throws(() => array2.set(array1, 1)); assert.throws(() => array2.set(array1, -1)); array2.set(new TypedArray([99, 98]), 2); assert.arrayEqual(array2, [1, 2, 99, 98, 5]); array2.set(new TypedArray([99, 98, 97]), 2); assert.arrayEqual(array2, [1, 2, 99, 98, 97]); assert.throws(() => array2.set(new TypedArray([99, 98, 97, 96]), 2)); assert.throws(() => array2.set([101, 102, 103, 104], 4)); const array3 = new TypedArray(2); assert.notThrows(() => array3.set({ length: 2, 0: 1, 1: 2 }), 'set array-like #1'); assert.arrayEqual(array3, [1, 2], 'set array-like #2'); assert.notThrows(() => array3.set('34'), 'set string #1'); assert.arrayEqual(array3, [3, 4], 'set string #2'); assert.notThrows(() => array3.set(1), 'set number #1'); assert.arrayEqual(array3, [3, 4], 'set number #2'); assert.throws(() => set.call([1, 2, 3], [1]), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.slice.js000066400000000000000000000023421451776221300230370ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.slice', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { slice } = TypedArray.prototype; assert.isFunction(slice, `${ name }::slice is function`); assert.arity(slice, 2, `${ name }::slice arity is 0`); assert.name(slice, 'slice', `${ name }::slice name is 'slice'`); assert.looksNative(slice, `${ name }::slice looks native`); const array = new TypedArray([1, 2, 3, 4, 5]); assert.notSame(array.slice(), array, 'returns new array'); assert.true(array.slice() instanceof TypedArray, 'correct instance'); assert.notSame(array.slice().buffer, array.buffer, 'with new buffer'); assert.arrayEqual(array.slice(), array); assert.arrayEqual(array.slice(1, 3), [2, 3]); assert.arrayEqual(array.slice(1, undefined), [2, 3, 4, 5]); assert.arrayEqual(array.slice(1, -1), [2, 3, 4]); assert.arrayEqual(array.slice(-2, -1), [4]); assert.arrayEqual(array.slice(-2, -3), []); assert.throws(() => slice.call([1, 2], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.some.js000066400000000000000000000032671451776221300227120ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.some', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { some } = TypedArray.prototype; assert.isFunction(some, `${ name }::some is function`); assert.arity(some, 1, `${ name }::some arity is 1`); assert.name(some, 'some', `${ name }::some name is 'some'`); assert.looksNative(some, `${ name }::some looks native`); const array = new TypedArray([1]); const context = {}; array.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new TypedArray([1, 2, 3]).some(it => typeof it == 'number')); assert.true(new TypedArray([1, 2, 3]).some(it => it < 3)); assert.false(new TypedArray([1, 2, 3]).some(it => it < 0)); assert.false(new TypedArray([1, 2, 3]).some(it => typeof it == 'string')); assert.true(new TypedArray([1, 2, 3]).some(function () { return +this === 1; }, 1)); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).some((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => some.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.sort.js000066400000000000000000000050171451776221300227310ustar00rootroot00000000000000import { DESCRIPTORS, STRICT, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.sort', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { sort } = TypedArray.prototype; assert.isFunction(sort, `${ name }::sort is function`); assert.arity(sort, 1, `${ name }::sort arity is 1`); assert.name(sort, 'sort', `${ name }::sort name is 'sort'`); assert.looksNative(sort, `${ name }::sort looks native`); if (name.indexOf('Float') === 0) { assert.deepEqual(new TypedArray([1, -1, 3, NaN, 2, 0, 11, -0]).sort(), new TypedArray([-1, -0, 0, 1, 2, 3, 11, NaN]), '#1'); assert.true(1 / new TypedArray([0, -0]).sort()[0] < 0, '-0'); assert.deepEqual(new TypedArray([NaN, 1, NaN]).sort(), new TypedArray([1, NaN, NaN]), 'NaN'); } if (name.indexOf('8') === -1) { const expected = Array(516); let array = new TypedArray(516); let index, mod, j, k, postfix; for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } array.sort((a, b) => (a / 4 | 0) - (b / 4 | 0)); assert.same(String(array), String(expected), 'stable #1'); let result = ''; array = new TypedArray(520); index = 0; for (j = 0; j < 10; j++) { switch (j) { case 1: case 4: case 5: case 7: postfix = 3; break; case 3: case 6: postfix = 4; break; default: postfix = 2; } for (k = 0; k < 52; k++) { array[index] = 10 * index++ + postfix; } } array.sort((a, b) => b % 10 - a % 10); for (index = 0; index < array.length; index++) { j = String((array[index] / 520) | 0); if (result.charAt(result.length - 1) !== j) result += j; } assert.same(result, '3614570289', 'stable #2'); } assert.throws(() => sort.call([0], () => { /* empty */ }), "isn't generic"); assert.notThrows(() => new TypedArray([1, 2, 3]).sort(undefined).length === 3, 'works with undefined'); assert.throws(() => new TypedArray([1, 2, 3]).sort(null), 'throws on null'); assert.throws(() => new TypedArray([1, 2, 3]).sort({}), 'throws on {}'); if (STRICT) { assert.throws(() => sort.call(null), TypeError, 'ToObject(this)'); assert.throws(() => sort.call(undefined), TypeError, 'ToObject(this)'); } } }); core-js-3.33.2/tests/unit-global/es.typed-array.subarray.js000066400000000000000000000030371451776221300235720ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.subarray', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { subarray } = TypedArray.prototype; assert.isFunction(subarray, `${ name }::subarray is function`); if (NATIVE) assert.arity(subarray, 2, `${ name }::subarray arity is 2`); assert.name(subarray, 'subarray', `${ name }::subarray name is 'subarray'`); assert.looksNative(subarray, `${ name }::subarray looks native`); const array1 = new TypedArray([1, 2, 3, 4, 5]); const array2 = array1.subarray(3); assert.notSame(array1, array2, 'creates new array'); assert.true(array2 instanceof TypedArray, `instance ${ name }`); assert.same(array1.buffer, array2.buffer, 'with the same buffer'); assert.arrayEqual(array2, [4, 5]); assert.arrayEqual(array1.subarray(1, 3), [2, 3]); assert.arrayEqual(array1.subarray(-3), [3, 4, 5]); assert.arrayEqual(array1.subarray(-3, -1), [3, 4]); assert.arrayEqual(array1.subarray(3, 2), []); assert.arrayEqual(array1.subarray(-2, -3), []); assert.arrayEqual(array1.subarray(4, 1), []); assert.arrayEqual(array1.subarray(-1, -4), []); assert.arrayEqual(array1.subarray(1).subarray(1), [3, 4, 5]); assert.arrayEqual(array1.subarray(1, 4).subarray(1, 2), [3]); assert.throws(() => subarray.call([1, 2, 3], 1), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.to-locale-string.js000066400000000000000000000015741451776221300251310ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toLocaleString', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { toLocaleString } = TypedArray.prototype; assert.isFunction(toLocaleString, `${ name }::toLocaleString is function`); assert.arity(toLocaleString, 0, `${ name }::toLocaleString arity is 0`); assert.name(toLocaleString, 'toLocaleString', `${ name }::toLocaleString name is 'toLocaleString'`); assert.looksNative(toLocaleString, `${ name }::toLocaleString looks native`); assert.same(new TypedArray([1, 2, 3]).toLocaleString(), [1, 2, 3].toLocaleString(), 'works'); assert.throws(() => toLocaleString.call([1, 2, 3]), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.to-reversed.js000066400000000000000000000024401451776221300241760ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS_WITH_BIG_INT } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toReversed', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray, $ } of TYPED_ARRAYS_WITH_BIG_INT) { const { toReversed } = TypedArray.prototype; assert.isFunction(toReversed, `${ name }::toReversed is function`); assert.arity(toReversed, 0, `${ name }::toReversed arity is 0`); assert.name(toReversed, 'toReversed', `${ name }::toReversed name is 'toReversed'`); assert.looksNative(toReversed, `${ name }::toReversed looks native`); const array = new TypedArray([$(1), $(2)]); assert.notSame(array.toReversed(), array, 'immutable'); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4)]).toReversed(), new TypedArray([$(4), $(3), $(2), $(1)]), 'works #1'); assert.deepEqual(new TypedArray([$(1), $(2), $(3)]).toReversed(), new TypedArray([$(3), $(2), $(1)]), 'works #2'); assert.throws(() => toReversed.call(null), TypeError, "isn't generic #1"); assert.throws(() => toReversed.call(undefined), TypeError, "isn't generic #2"); assert.throws(() => toReversed.call([$(1), $(2)]), TypeError, "isn't generic #3"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.to-sorted.js000066400000000000000000000052511451776221300236620ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toSorted', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { toSorted } = TypedArray.prototype; assert.isFunction(toSorted, `${ name }::toSorted is function`); assert.arity(toSorted, 1, `${ name }::toSorted arity is 1`); assert.name(toSorted, 'toSorted', `${ name }::toSorted name is 'toSorted'`); assert.looksNative(toSorted, `${ name }::toSorted looks native`); let array = new TypedArray([1]); assert.notSame(array.toSorted(), array, 'immutable'); if (name.indexOf('Float') === 0) { assert.deepEqual(new TypedArray([1, -1, 3, NaN, 2, 0, 11, -0]).toSorted(), new TypedArray([-1, -0, 0, 1, 2, 3, 11, NaN]), '#1'); assert.true(1 / new TypedArray([0, -0]).toSorted()[0] < 0, '-0'); assert.deepEqual(new TypedArray([NaN, 1, NaN]).toSorted(), new TypedArray([1, NaN, NaN]), 'NaN'); } if (name.indexOf('8') === -1) { const expected = Array(516); array = new TypedArray(516); let index, mod, j, k, postfix; for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } array = array.toSorted((a, b) => (a / 4 | 0) - (b / 4 | 0)); assert.arrayEqual(array, expected, 'stable #1'); let result = ''; array = new TypedArray(520); index = 0; for (j = 0; j < 10; j++) { switch (j) { case 1: case 4: case 5: case 7: postfix = 3; break; case 3: case 6: postfix = 4; break; default: postfix = 2; } for (k = 0; k < 52; k++) { array[index] = 10 * index++ + postfix; } } array = array.toSorted((a, b) => b % 10 - a % 10); for (index = 0; index < array.length; index++) { j = String((array[index] / 520) | 0); if (result.charAt(result.length - 1) !== j) result += j; } assert.same(result, '3614570289', 'stable #2'); } assert.notThrows(() => new TypedArray([1, 2, 3]).toSorted(undefined).length === 3, 'works with undefined'); assert.throws(() => new TypedArray([1, 2, 3]).toSorted(null), 'throws on null'); assert.throws(() => new TypedArray([1, 2, 3]).toSorted({}), 'throws on {}'); assert.throws(() => toSorted.call(null), TypeError, "isn't generic #1"); assert.throws(() => toSorted.call(undefined), TypeError, "isn't generic #2"); assert.throws(() => toSorted.call([1, 2]), TypeError, "isn't generic #3"); } }); core-js-3.33.2/tests/unit-global/es.typed-array.to-string.js000066400000000000000000000014201451776221300236620ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toString', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { toString } = TypedArray.prototype; assert.isFunction(toString, `${ name }::toString is function`); assert.arity(toString, 0, `${ name }::toString arity is 0`); assert.name(toString, 'toString', `${ name }::toString name is 'toString'`); assert.looksNative(toString, `${ name }::toString looks native`); assert.same(new TypedArray([1, 2, 3]).toString(), '1,2,3', 'works'); assert.same(toString.call([1, 2, 3]), '1,2,3', 'generic'); } }); core-js-3.33.2/tests/unit-global/es.typed-array.with.js000066400000000000000000000043721451776221300227200ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import { DESCRIPTORS, TYPED_ARRAYS_WITH_BIG_INT } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.with', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray, $ } of TYPED_ARRAYS_WITH_BIG_INT) { const { with: withAt } = TypedArray.prototype; assert.isFunction(withAt, `${ name }::with is function`); assert.arity(withAt, 2, `${ name }::with arity is 0`); // assert.name(withAt, 'with', `${ name }::with name is 'with'`); assert.looksNative(withAt, `${ name }::with looks native`); const array = new TypedArray([$(1), $(2), $(3), $(4), $(5)]); assert.notSame(array.with(2, $(1)), array, 'immutable'); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).with(2, $(6)), new TypedArray([$(1), $(2), $(6), $(4), $(5)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).with(-2, $(6)), new TypedArray([$(1), $(2), $(3), $(6), $(5)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).with('1', $(6)), new TypedArray([$(1), $(6), $(3), $(4), $(5)])); assert.throws(() => new TypedArray([$(1), $(2), $(3), $(4), $(5)]).with(5, $(6)), RangeError); assert.throws(() => new TypedArray([$(1), $(2), $(3), $(4), $(5)]).with(-6, $(6)), RangeError); assert.throws(() => withAt.call(null, 1, $(2)), TypeError, "isn't generic #1"); assert.throws(() => withAt.call(undefined, 1, $(2)), TypeError, "isn't generic #2"); assert.throws(() => withAt.call([1, 2], 1, $(3)), TypeError, "isn't generic #3"); const checker = createConversionChecker($(10)); assert.same(new TypedArray(5).with(2, checker)[2], $(10)); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); assert.true(!!function () { try { new TypedArray(1).with(2, { valueOf() { throw 8; } }); } catch (error) { // some early implementations, like WebKit, does not follow the final semantic // https://github.com/tc39/proposal-change-array-by-copy/pull/86 return error === 8; } }(), 'proper order of operations'); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.float32.js000066400000000000000000000076061451776221300244550ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Float32 conversions', assert => { const float32array = new Float32Array(1); const uint8array = new Uint8Array(float32array.buffer); const dataview = new DataView(float32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, -0, [0, 0, 0, 128]], [1, 1, [0, 0, 128, 63]], [-1, -1, [0, 0, 128, 191]], [1.1, 1.100000023841858, [205, 204, 140, 63]], [-1.1, -1.100000023841858, [205, 204, 140, 191]], [1.9, 1.899999976158142, [51, 51, 243, 63]], [-1.9, -1.899999976158142, [51, 51, 243, 191]], [127, 127, [0, 0, 254, 66]], [-127, -127, [0, 0, 254, 194]], [128, 128, [0, 0, 0, 67]], [-128, -128, [0, 0, 0, 195]], [255, 255, [0, 0, 127, 67]], [-255, -255, [0, 0, 127, 195]], // eslint-disable-next-line no-loss-of-precision -- false positive [255.1, 255.10000610351562, [154, 25, 127, 67]], [255.9, 255.89999389648438, [102, 230, 127, 67]], [256, 256, [0, 0, 128, 67]], [32767, 32767, [0, 254, 255, 70]], [-32767, -32767, [0, 254, 255, 198]], [32768, 32768, [0, 0, 0, 71]], [-32768, -32768, [0, 0, 0, 199]], [65535, 65535, [0, 255, 127, 71]], [65536, 65536, [0, 0, 128, 71]], [65537, 65537, [128, 0, 128, 71]], [65536.54321, 65536.546875, [70, 0, 128, 71]], [-65536.54321, -65536.546875, [70, 0, 128, 199]], [2147483647, 2147483648, [0, 0, 0, 79]], [-2147483647, -2147483648, [0, 0, 0, 207]], [2147483648, 2147483648, [0, 0, 0, 79]], [-2147483648, -2147483648, [0, 0, 0, 207]], [2147483649, 2147483648, [0, 0, 0, 79]], [-2147483649, -2147483648, [0, 0, 0, 207]], [4294967295, 4294967296, [0, 0, 128, 79]], [4294967296, 4294967296, [0, 0, 128, 79]], [4294967297, 4294967296, [0, 0, 128, 79]], [9007199254740991, 9007199254740992, [0, 0, 0, 90]], [-9007199254740991, -9007199254740992, [0, 0, 0, 218]], [9007199254740992, 9007199254740992, [0, 0, 0, 90]], [-9007199254740992, -9007199254740992, [0, 0, 0, 218]], [9007199254740994, 9007199254740992, [0, 0, 0, 90]], [-9007199254740994, -9007199254740992, [0, 0, 0, 218]], [Infinity, Infinity, [0, 0, 128, 127]], [-Infinity, -Infinity, [0, 0, 128, 255]], [1.7976931348623157e+308, Infinity, [0, 0, 128, 127]], [-1.7976931348623157e+308, -Infinity, [0, 0, 128, 255]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, -0, [0, 0, 0, 128]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; float32array[0] = value; assert.same(float32array[0], conversion, `Float32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Float32Array ${ toString(value) } -> [${ representation }]`); dataview.setFloat32(0, value); assert.arrayEqual(uint8array, big, `dataview.setFloat32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getFloat32(0), conversion, `dataview{${ big }}.getFloat32(0) -> ${ toString(conversion) }`); dataview.setFloat32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setFloat32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getFloat32(0, false), conversion, `dataview{${ big }}.getFloat32(0, false) -> ${ toString(conversion) }`); dataview.setFloat32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setFloat32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getFloat32(0, true), conversion, `dataview{${ little }}.getFloat32(0, true) -> ${ toString(conversion) }`); } float32array[0] = NaN; assert.same(float32array[0], NaN, 'NaN -> NaN'); }); core-js-3.33.2/tests/unit-global/es.typed.conversions.float64.js000066400000000000000000000107611451776221300244560ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Float64 conversions', assert => { const float64array = new Float64Array(1); const uint8array = new Uint8Array(float64array.buffer); const dataview = new DataView(float64array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0, 0, 0, 0, 0]], [-0, -0, [0, 0, 0, 0, 0, 0, 0, 128]], [1, 1, [0, 0, 0, 0, 0, 0, 240, 63]], [-1, -1, [0, 0, 0, 0, 0, 0, 240, 191]], [1.1, 1.1, [154, 153, 153, 153, 153, 153, 241, 63]], [-1.1, -1.1, [154, 153, 153, 153, 153, 153, 241, 191]], [1.9, 1.9, [102, 102, 102, 102, 102, 102, 254, 63]], [-1.9, -1.9, [102, 102, 102, 102, 102, 102, 254, 191]], [127, 127, [0, 0, 0, 0, 0, 192, 95, 64]], [-127, -127, [0, 0, 0, 0, 0, 192, 95, 192]], [128, 128, [0, 0, 0, 0, 0, 0, 96, 64]], [-128, -128, [0, 0, 0, 0, 0, 0, 96, 192]], [255, 255, [0, 0, 0, 0, 0, 224, 111, 64]], [-255, -255, [0, 0, 0, 0, 0, 224, 111, 192]], [255.1, 255.1, [51, 51, 51, 51, 51, 227, 111, 64]], [255.9, 255.9, [205, 204, 204, 204, 204, 252, 111, 64]], [256, 256, [0, 0, 0, 0, 0, 0, 112, 64]], [32767, 32767, [0, 0, 0, 0, 192, 255, 223, 64]], [-32767, -32767, [0, 0, 0, 0, 192, 255, 223, 192]], [32768, 32768, [0, 0, 0, 0, 0, 0, 224, 64]], [-32768, -32768, [0, 0, 0, 0, 0, 0, 224, 192]], [65535, 65535, [0, 0, 0, 0, 224, 255, 239, 64]], [65536, 65536, [0, 0, 0, 0, 0, 0, 240, 64]], [65537, 65537, [0, 0, 0, 0, 16, 0, 240, 64]], [65536.54321, 65536.54321, [14, 248, 252, 176, 8, 0, 240, 64]], [-65536.54321, -65536.54321, [14, 248, 252, 176, 8, 0, 240, 192]], [2147483647, 2147483647, [0, 0, 192, 255, 255, 255, 223, 65]], [-2147483647, -2147483647, [0, 0, 192, 255, 255, 255, 223, 193]], [2147483648, 2147483648, [0, 0, 0, 0, 0, 0, 224, 65]], [-2147483648, -2147483648, [0, 0, 0, 0, 0, 0, 224, 193]], [2147483649, 2147483649, [0, 0, 32, 0, 0, 0, 224, 65]], [-2147483649, -2147483649, [0, 0, 32, 0, 0, 0, 224, 193]], [4294967295, 4294967295, [0, 0, 224, 255, 255, 255, 239, 65]], [4294967296, 4294967296, [0, 0, 0, 0, 0, 0, 240, 65]], [4294967297, 4294967297, [0, 0, 16, 0, 0, 0, 240, 65]], [9007199254740991, 9007199254740991, [255, 255, 255, 255, 255, 255, 63, 67]], [-9007199254740991, -9007199254740991, [255, 255, 255, 255, 255, 255, 63, 195]], [9007199254740992, 9007199254740992, [0, 0, 0, 0, 0, 0, 64, 67]], [-9007199254740992, -9007199254740992, [0, 0, 0, 0, 0, 0, 64, 195]], [9007199254740994, 9007199254740994, [1, 0, 0, 0, 0, 0, 64, 67]], [-9007199254740994, -9007199254740994, [1, 0, 0, 0, 0, 0, 64, 195]], [Infinity, Infinity, [0, 0, 0, 0, 0, 0, 240, 127]], [-Infinity, -Infinity, [0, 0, 0, 0, 0, 0, 240, 255]], [-1.7976931348623157e+308, -1.7976931348623157e+308, [255, 255, 255, 255, 255, 255, 239, 255]], [1.7976931348623157e+308, 1.7976931348623157e+308, [255, 255, 255, 255, 255, 255, 239, 127]], [5e-324, 5e-324, [1, 0, 0, 0, 0, 0, 0, 0]], [-5e-324, -5e-324, [1, 0, 0, 0, 0, 0, 0, 128]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; float64array[0] = value; assert.same(float64array[0], conversion, `Float64Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Float64Array ${ toString(value) } -> [${ representation }]`); dataview.setFloat64(0, value); assert.arrayEqual(uint8array, big, `dataview.setFloat64(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getFloat64(0), conversion, `dataview{${ big }}.getFloat64(0) -> ${ toString(conversion) }`); dataview.setFloat64(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setFloat64(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getFloat64(0, false), conversion, `dataview{${ big }}.getFloat64(0, false) -> ${ toString(conversion) }`); dataview.setFloat64(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setFloat64(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getFloat64(0, true), conversion, `dataview{${ little }}.getFloat64(0, true) -> ${ toString(conversion) }`); } float64array[0] = NaN; assert.same(float64array[0], NaN, 'NaN -> NaN'); }); core-js-3.33.2/tests/unit-global/es.typed.conversions.int16.js000066400000000000000000000063111451776221300241340ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => { const int16array = new Int16Array(1); const uint8array = new Uint8Array(int16array.buffer); const dataview = new DataView(int16array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0]], [-0, 0, [0, 0]], [1, 1, [1, 0]], [-1, -1, [255, 255]], [1.1, 1, [1, 0]], [-1.1, -1, [255, 255]], [1.9, 1, [1, 0]], [-1.9, -1, [255, 255]], [127, 127, [127, 0]], [-127, -127, [129, 255]], [128, 128, [128, 0]], [-128, -128, [128, 255]], [255, 255, [255, 0]], [-255, -255, [1, 255]], [255.1, 255, [255, 0]], [255.9, 255, [255, 0]], [256, 256, [0, 1]], [32767, 32767, [255, 127]], [-32767, -32767, [1, 128]], [32768, -32768, [0, 128]], [-32768, -32768, [0, 128]], [65535, -1, [255, 255]], [65536, 0, [0, 0]], [65537, 1, [1, 0]], [65536.54321, 0, [0, 0]], [-65536.54321, 0, [0, 0]], [2147483647, -1, [255, 255]], [-2147483647, 1, [1, 0]], [2147483648, 0, [0, 0]], [-2147483648, 0, [0, 0]], [4294967296, 0, [0, 0]], [9007199254740992, 0, [0, 0]], [-9007199254740992, 0, [0, 0]], [Infinity, 0, [0, 0]], [-Infinity, 0, [0, 0]], [-1.7976931348623157e+308, 0, [0, 0]], [1.7976931348623157e+308, 0, [0, 0]], [5e-324, 0, [0, 0]], [-5e-324, 0, [0, 0]], [NaN, 0, [0, 0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data.push( [2147483649, 1, [1, 0]], [-2147483649, -1, [255, 255]], [4294967295, -1, [255, 255]], [4294967297, 1, [1, 0]], [9007199254740991, -1, [255, 255]], [-9007199254740991, 1, [1, 0]], [9007199254740994, 2, [2, 0]], [-9007199254740994, -2, [254, 255]], ); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int16array[0] = value; assert.same(int16array[0], conversion, `Int16Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int16Array ${ toString(value) } -> [${ representation }]`); dataview.setInt16(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt16(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt16(0), conversion, `dataview{${ big }}.getInt16(0) -> ${ toString(conversion) }`); dataview.setInt16(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setInt16(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getInt16(0, false), conversion, `dataview{${ big }}.getInt16(0, false) -> ${ toString(conversion) }`); dataview.setInt16(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setInt16(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getInt16(0, true), conversion, `dataview{${ little }}.getInt16(0, true) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.int32.js000066400000000000000000000067221451776221300241400ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Int32 conversions', assert => { const int32array = new Int32Array(1); const uint8array = new Uint8Array(int32array.buffer); const dataview = new DataView(int32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, 0, [0, 0, 0, 0]], [1, 1, [1, 0, 0, 0]], [-1, -1, [255, 255, 255, 255]], [1.1, 1, [1, 0, 0, 0]], [-1.1, -1, [255, 255, 255, 255]], [1.9, 1, [1, 0, 0, 0]], [-1.9, -1, [255, 255, 255, 255]], [127, 127, [127, 0, 0, 0]], [-127, -127, [129, 255, 255, 255]], [128, 128, [128, 0, 0, 0]], [-128, -128, [128, 255, 255, 255]], [255, 255, [255, 0, 0, 0]], [-255, -255, [1, 255, 255, 255]], [255.1, 255, [255, 0, 0, 0]], [255.9, 255, [255, 0, 0, 0]], [256, 256, [0, 1, 0, 0]], [32767, 32767, [255, 127, 0, 0]], [-32767, -32767, [1, 128, 255, 255]], [32768, 32768, [0, 128, 0, 0]], [-32768, -32768, [0, 128, 255, 255]], [65535, 65535, [255, 255, 0, 0]], [65536, 65536, [0, 0, 1, 0]], [65537, 65537, [1, 0, 1, 0]], [65536.54321, 65536, [0, 0, 1, 0]], [-65536.54321, -65536, [0, 0, 255, 255]], [2147483647, 2147483647, [255, 255, 255, 127]], [-2147483647, -2147483647, [1, 0, 0, 128]], [2147483648, -2147483648, [0, 0, 0, 128]], [-2147483648, -2147483648, [0, 0, 0, 128]], [2147483649, -2147483647, [1, 0, 0, 128]], [-2147483649, 2147483647, [255, 255, 255, 127]], [4294967295, -1, [255, 255, 255, 255]], [4294967296, 0, [0, 0, 0, 0]], [4294967297, 1, [1, 0, 0, 0]], [9007199254740991, -1, [255, 255, 255, 255]], [-9007199254740991, 1, [1, 0, 0, 0]], [9007199254740992, 0, [0, 0, 0, 0]], [-9007199254740992, 0, [0, 0, 0, 0]], [9007199254740994, 2, [2, 0, 0, 0]], [-9007199254740994, -2, [254, 255, 255, 255]], [Infinity, 0, [0, 0, 0, 0]], [-Infinity, 0, [0, 0, 0, 0]], [-1.7976931348623157e+308, 0, [0, 0, 0, 0]], [1.7976931348623157e+308, 0, [0, 0, 0, 0]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, 0, [0, 0, 0, 0]], [NaN, 0, [0, 0, 0, 0]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int32array[0] = value; assert.same(int32array[0], conversion, `Int32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int32Array ${ toString(value) } -> [${ representation }]`); dataview.setInt32(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt32(0), conversion, `dataview{${ big }}.getInt32(0) -> ${ toString(conversion) }`); dataview.setInt32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setInt32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getInt32(0, false), conversion, `dataview{${ big }}.getInt32(0, false) -> ${ toString(conversion) }`); dataview.setInt32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setInt32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getInt32(0, true), conversion, `dataview{${ little }}.getInt32(0, true) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.int8.js000066400000000000000000000046731451776221300240660ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Int8 conversions', assert => { const int8array = new Int8Array(1); const uint8array = new Uint8Array(int8array.buffer); const dataview = new DataView(int8array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, -1, [255]], [1.1, 1, [1]], [-1.1, -1, [255]], [1.9, 1, [1]], [-1.9, -1, [255]], [127, 127, [127]], [-127, -127, [129]], [128, -128, [128]], [-128, -128, [128]], [255, -1, [255]], [-255, 1, [1]], [255.1, -1, [255]], [255.9, -1, [255]], [256, 0, [0]], [32767, -1, [255]], [-32767, 1, [1]], [32768, 0, [0]], [-32768, 0, [0]], [65535, -1, [255]], [65536, 0, [0]], [65537, 1, [1]], [65536.54321, 0, [0]], [-65536.54321, 0, [0]], [2147483647, -1, [255]], [-2147483647, 1, [1]], [2147483648, 0, [0]], [-2147483648, 0, [0]], [4294967296, 0, [0]], [9007199254740992, 0, [0]], [-9007199254740992, 0, [0]], [Infinity, 0, [0]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 0, [0]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data.push( [2147483649, 1, [1]], [-2147483649, -1, [255]], [4294967295, -1, [255]], [4294967297, 1, [1]], [9007199254740991, -1, [255]], [-9007199254740991, 1, [1]], [9007199254740994, 2, [2]], [-9007199254740994, -2, [254]], ); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int8array[0] = value; assert.same(int8array[0], conversion, `Int8Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int8Array ${ toString(value) } -> [${ representation }]`); dataview.setInt8(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt8(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt8(0), conversion, `dataview{${ big }}.getInt8(0) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.uint16.js000066400000000000000000000063711451776221300243270ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Uint16 conversions', assert => { const uint16array = new Uint16Array(1); const uint8array = new Uint8Array(uint16array.buffer); const dataview = new DataView(uint16array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0]], [-0, 0, [0, 0]], [1, 1, [1, 0]], [-1, 65535, [255, 255]], [1.1, 1, [1, 0]], [-1.1, 65535, [255, 255]], [1.9, 1, [1, 0]], [-1.9, 65535, [255, 255]], [127, 127, [127, 0]], [-127, 65409, [129, 255]], [128, 128, [128, 0]], [-128, 65408, [128, 255]], [255, 255, [255, 0]], [-255, 65281, [1, 255]], [255.1, 255, [255, 0]], [255.9, 255, [255, 0]], [256, 256, [0, 1]], [32767, 32767, [255, 127]], [-32767, 32769, [1, 128]], [32768, 32768, [0, 128]], [-32768, 32768, [0, 128]], [65535, 65535, [255, 255]], [65536, 0, [0, 0]], [65537, 1, [1, 0]], [65536.54321, 0, [0, 0]], [-65536.54321, 0, [0, 0]], [2147483647, 65535, [255, 255]], [-2147483647, 1, [1, 0]], [2147483648, 0, [0, 0]], [-2147483648, 0, [0, 0]], [4294967296, 0, [0, 0]], [9007199254740992, 0, [0, 0]], [-9007199254740992, 0, [0, 0]], [Infinity, 0, [0, 0]], [-Infinity, 0, [0, 0]], [-1.7976931348623157e+308, 0, [0, 0]], [1.7976931348623157e+308, 0, [0, 0]], [5e-324, 0, [0, 0]], [-5e-324, 0, [0, 0]], [NaN, 0, [0, 0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data.push( [2147483649, 1, [1, 0]], [-2147483649, 65535, [255, 255]], [4294967295, 65535, [255, 255]], [4294967297, 1, [1, 0]], [9007199254740991, 65535, [255, 255]], [-9007199254740991, 1, [1, 0]], [9007199254740994, 2, [2, 0]], [-9007199254740994, 65534, [254, 255]], ); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; uint16array[0] = value; assert.same(uint16array[0], conversion, `Uint16Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Uint16Array ${ toString(value) } -> [${ representation }]`); dataview.setUint16(0, value); assert.arrayEqual(uint8array, big, `dataview.setUint16(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getUint16(0), conversion, `dataview{${ big }}.getUint16(0) -> ${ toString(conversion) }`); dataview.setUint16(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setUint16(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getUint16(0, false), conversion, `dataview{${ big }}.getUint16(0, false) -> ${ toString(conversion) }`); dataview.setUint16(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setUint16(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getUint16(0, true), conversion, `dataview{${ little }}.getUint16(0, true) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.uint32.js000066400000000000000000000070551451776221300243250ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Uint32 conversions', assert => { const uint32array = new Uint32Array(1); const uint8array = new Uint8Array(uint32array.buffer); const dataview = new DataView(uint32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, 0, [0, 0, 0, 0]], [1, 1, [1, 0, 0, 0]], [-1, 4294967295, [255, 255, 255, 255]], [1.1, 1, [1, 0, 0, 0]], [-1.1, 4294967295, [255, 255, 255, 255]], [1.9, 1, [1, 0, 0, 0]], [-1.9, 4294967295, [255, 255, 255, 255]], [127, 127, [127, 0, 0, 0]], [-127, 4294967169, [129, 255, 255, 255]], [128, 128, [128, 0, 0, 0]], [-128, 4294967168, [128, 255, 255, 255]], [255, 255, [255, 0, 0, 0]], [-255, 4294967041, [1, 255, 255, 255]], [255.1, 255, [255, 0, 0, 0]], [255.9, 255, [255, 0, 0, 0]], [256, 256, [0, 1, 0, 0]], [32767, 32767, [255, 127, 0, 0]], [-32767, 4294934529, [1, 128, 255, 255]], [32768, 32768, [0, 128, 0, 0]], [-32768, 4294934528, [0, 128, 255, 255]], [65535, 65535, [255, 255, 0, 0]], [65536, 65536, [0, 0, 1, 0]], [65537, 65537, [1, 0, 1, 0]], [65536.54321, 65536, [0, 0, 1, 0]], [-65536.54321, 4294901760, [0, 0, 255, 255]], [2147483647, 2147483647, [255, 255, 255, 127]], [-2147483647, 2147483649, [1, 0, 0, 128]], [2147483648, 2147483648, [0, 0, 0, 128]], [-2147483648, 2147483648, [0, 0, 0, 128]], [2147483649, 2147483649, [1, 0, 0, 128]], [-2147483649, 2147483647, [255, 255, 255, 127]], [4294967295, 4294967295, [255, 255, 255, 255]], [4294967296, 0, [0, 0, 0, 0]], [4294967297, 1, [1, 0, 0, 0]], [9007199254740991, 4294967295, [255, 255, 255, 255]], [-9007199254740991, 1, [1, 0, 0, 0]], [9007199254740992, 0, [0, 0, 0, 0]], [-9007199254740992, 0, [0, 0, 0, 0]], [9007199254740994, 2, [2, 0, 0, 0]], [-9007199254740994, 4294967294, [254, 255, 255, 255]], [Infinity, 0, [0, 0, 0, 0]], [-Infinity, 0, [0, 0, 0, 0]], [-1.7976931348623157e+308, 0, [0, 0, 0, 0]], [1.7976931348623157e+308, 0, [0, 0, 0, 0]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, 0, [0, 0, 0, 0]], [NaN, 0, [0, 0, 0, 0]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; uint32array[0] = value; assert.same(uint32array[0], conversion, `Uint32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Uint32Array ${ toString(value) } -> [${ representation }]`); dataview.setUint32(0, value); assert.arrayEqual(uint8array, big, `dataview.setUint32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getUint32(0), conversion, `dataview{${ big }}.getUint32(0) -> ${ toString(conversion) }`); dataview.setUint32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setUint32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getUint32(0, false), conversion, `dataview{${ big }}.getUint32(0, false) -> ${ toString(conversion) }`); dataview.setUint32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setUint32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getUint32(0, true), conversion, `dataview{${ little }}.getUint32(0, true) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.uint8-clamped.js000066400000000000000000000035501451776221300256470ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Uint8Clamped conversions', assert => { const uint8clamped = new Uint8ClampedArray(1); const uint8array = new Uint8Array(uint8clamped.buffer); function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, 0, [0]], [1.1, 1, [1]], [-1.1, 0, [0]], [1.9, 2, [2]], [-1.9, 0, [0]], [127, 127, [127]], [-127, 0, [0]], [128, 128, [128]], [-128, 0, [0]], [255, 255, [255]], [-255, 0, [0]], [255.1, 255, [255]], [255.9, 255, [255]], [256, 255, [255]], [32767, 255, [255]], [-32767, 0, [0]], [32768, 255, [255]], [-32768, 0, [0]], [65535, 255, [255]], [65536, 255, [255]], [65537, 255, [255]], [65536.54321, 255, [255]], [-65536.54321, 0, [0]], [2147483647, 255, [255]], [-2147483647, 0, [0]], [2147483648, 255, [255]], [-2147483648, 0, [0]], [2147483649, 255, [255]], [-2147483649, 0, [0]], [4294967295, 255, [255]], [4294967296, 255, [255]], [4294967297, 255, [255]], [9007199254740991, 255, [255]], [-9007199254740991, 0, [0]], [9007199254740992, 255, [255]], [-9007199254740992, 0, [0]], [9007199254740994, 255, [255]], [-9007199254740994, 0, [0]], [Infinity, 255, [255]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 255, [255]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; for (const [value, conversion, little] of data) { uint8clamped[0] = value; assert.same(uint8clamped[0], conversion, `Uint8ClampedArray ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, little, `Uint8ClampedArray ${ toString(value) } -> [${ little }]`); } }); core-js-3.33.2/tests/unit-global/es.typed.conversions.uint8.js000066400000000000000000000044401451776221300242430ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Uint8 conversions', assert => { const uint8array = new Uint8Array(1); const dataview = new DataView(uint8array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, 255, [255]], [1.1, 1, [1]], [-1.1, 255, [255]], [1.9, 1, [1]], [-1.9, 255, [255]], [127, 127, [127]], [-127, 129, [129]], [128, 128, [128]], [-128, 128, [128]], [255, 255, [255]], [-255, 1, [1]], [255.1, 255, [255]], [255.9, 255, [255]], [256, 0, [0]], [32767, 255, [255]], [-32767, 1, [1]], [32768, 0, [0]], [-32768, 0, [0]], [65535, 255, [255]], [65536, 0, [0]], [65537, 1, [1]], [65536.54321, 0, [0]], [-65536.54321, 0, [0]], [2147483647, 255, [255]], [-2147483647, 1, [1]], [2147483648, 0, [0]], [-2147483648, 0, [0]], [4294967296, 0, [0]], [9007199254740992, 0, [0]], [-9007199254740992, 0, [0]], [Infinity, 0, [0]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 0, [0]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data.push( [2147483649, 1, [1]], [-2147483649, 255, [255]], [4294967295, 255, [255]], [4294967297, 1, [1]], [9007199254740991, 255, [255]], [-9007199254740991, 1, [1]], [9007199254740994, 2, [2]], [-9007199254740994, 254, [254]], ); } for (const [value, conversion, little] of data) { uint8array[0] = value; assert.same(uint8array[0], conversion, `Uint8Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, little, `Uint8Array ${ toString(value) } -> [${ little }]`); dataview.setUint8(0, value); assert.arrayEqual(uint8array, little, `dataview.setUint8(0, ${ toString(value) }) -> [${ little }]`); assert.same(viewFrom(little).getUint8(0), conversion, `dataview{${ little }}.getUint8(0) -> ${ toString(conversion) }`); } }); core-js-3.33.2/tests/unit-global/es.unescape.js000066400000000000000000000007671451776221300213140ustar00rootroot00000000000000QUnit.test('unescape', assert => { assert.isFunction(unescape); assert.name(unescape, 'unescape'); assert.arity(unescape, 1); assert.looksNative(unescape); assert.same(unescape('%21q2%u0444'), '!q2ф'); assert.same(unescape('%u044q2%21'), '%u044q2!'); assert.same(unescape(null), 'null'); assert.same(unescape(undefined), 'undefined'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => unescape(Symbol('unescape test')), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-global/es.weak-map.js000066400000000000000000000163151451776221300212070ustar00rootroot00000000000000import { DESCRIPTORS, FREEZING, GLOBAL, NATIVE } from '../helpers/constants.js'; import { createIterable, nativeSubclass } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const { freeze, isFrozen, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('WeakMap', assert => { assert.isFunction(WeakMap); assert.name(WeakMap, 'WeakMap'); assert.arity(WeakMap, 0); assert.looksNative(WeakMap); assert.true('delete' in WeakMap.prototype, 'delete in WeakMap.prototype'); assert.true('get' in WeakMap.prototype, 'get in WeakMap.prototype'); assert.true('has' in WeakMap.prototype, 'has in WeakMap.prototype'); assert.true('set' in WeakMap.prototype, 'set in WeakMap.prototype'); assert.true(new WeakMap() instanceof WeakMap, 'new WeakMap instanceof WeakMap'); let object = {}; assert.same(new WeakMap(createIterable([[object, 42]])).get(object), 42, 'Init from iterable'); let weakmap = new WeakMap(); const frozen = freeze({}); weakmap.set(frozen, 42); assert.same(weakmap.get(frozen), 42, 'Support frozen objects'); weakmap = new WeakMap(); weakmap.set(frozen, 42); assert.true(weakmap.has(frozen), 'works with frozen objects, #1'); assert.same(weakmap.get(frozen), 42, 'works with frozen objects, #2'); weakmap.delete(frozen); assert.false(weakmap.has(frozen), 'works with frozen objects, #3'); assert.same(weakmap.get(frozen), undefined, 'works with frozen objects, #4'); let done = false; try { new WeakMap(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); assert.false(('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new WeakMap(array); assert.true(done); object = {}; new WeakMap().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakMap); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof WeakMap, 'correct subclassing with native classes #2'); object = {}; assert.same(new Subclass().set(object, 2).get(object), 2, 'correct subclassing with native classes #3'); } const buffer = new ArrayBuffer(8); const map = new WeakMap([[buffer, 8]]); assert.true(map.has(buffer), 'works with ArrayBuffer keys'); }); QUnit.test('WeakMap#delete', assert => { assert.isFunction(WeakMap.prototype.delete); if (NATIVE) assert.name(WeakMap.prototype.delete, 'delete'); if (NATIVE) assert.arity(WeakMap.prototype.delete, 1); assert.looksNative(WeakMap.prototype.delete); assert.nonEnumerable(WeakMap.prototype, 'delete'); const a = {}; const b = {}; const weakmap = new WeakMap(); weakmap.set(a, 42); weakmap.set(b, 21); assert.true(weakmap.has(a), 'WeakMap has values before .delete() #1'); assert.true(weakmap.has(b), 'WeakMap has values before .delete() #2'); weakmap.delete(a); assert.false(weakmap.has(a), 'WeakMap has not value after .delete() #1'); assert.true(weakmap.has(b), 'WeakMap has not value after .delete() #2'); assert.notThrows(() => !weakmap.delete(1), 'return false on primitive'); const object = {}; weakmap.set(object, 42); freeze(object); assert.true(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.false(weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#get', assert => { assert.isFunction(WeakMap.prototype.get); assert.name(WeakMap.prototype.get, 'get'); if (NATIVE) assert.arity(WeakMap.prototype.get, 1); assert.looksNative(WeakMap.prototype.get); assert.nonEnumerable(WeakMap.prototype, 'get'); const weakmap = new WeakMap(); assert.same(weakmap.get({}), undefined, 'WeakMap .get() before .set() return undefined'); let object = {}; weakmap.set(object, 42); assert.same(weakmap.get(object), 42, 'WeakMap .get() return value'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'WeakMap .get() after .delete() return undefined'); assert.notThrows(() => weakmap.get(1) === undefined, 'return undefined on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.same(weakmap.get(object), 42, 'works with frozen objects #1'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'works with frozen objects #2'); }); QUnit.test('WeakMap#has', assert => { assert.isFunction(WeakMap.prototype.has); assert.name(WeakMap.prototype.has, 'has'); if (NATIVE) assert.arity(WeakMap.prototype.has, 1); assert.looksNative(WeakMap.prototype.has); assert.nonEnumerable(WeakMap.prototype, 'has'); const weakmap = new WeakMap(); assert.false(weakmap.has({}), 'WeakMap .has() before .set() return false'); let object = {}; weakmap.set(object, 42); assert.true(weakmap.has(object), 'WeakMap .has() return true'); weakmap.delete(object); assert.false(weakmap.has(object), 'WeakMap .has() after .delete() return false'); assert.notThrows(() => !weakmap.has(1), 'return false on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.true(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.false(weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#set', assert => { assert.isFunction(WeakMap.prototype.set); assert.name(WeakMap.prototype.set, 'set'); assert.arity(WeakMap.prototype.set, 2); assert.looksNative(WeakMap.prototype.set); assert.nonEnumerable(WeakMap.prototype, 'set'); const weakmap = new WeakMap(); const object = {}; weakmap.set(object, 33); assert.same(weakmap.get(object), 33, 'works with object as keys'); assert.same(weakmap.set({}, 42), weakmap, 'chaining'); assert.throws(() => new WeakMap().set(42, 42), 'throws with primitive keys'); const object1 = freeze({}); const object2 = {}; weakmap.set(object1, 42); weakmap.set(object2, 42); freeze(object); assert.same(weakmap.get(object1), 42, 'works with frozen objects #1'); assert.same(weakmap.get(object2), 42, 'works with frozen objects #2'); weakmap.delete(object1); weakmap.delete(object2); assert.same(weakmap.get(object1), undefined, 'works with frozen objects #3'); assert.same(weakmap.get(object2), undefined, 'works with frozen objects #4'); const array = freeze([]); weakmap.set(array, 42); assert.same(weakmap.get(array), 42, 'works with frozen arrays #1'); if (FREEZING) assert.true(isFrozen(array), 'works with frozen arrays #2'); }); QUnit.test('WeakMap#@@toStringTag', assert => { assert.same(WeakMap.prototype[Symbol.toStringTag], 'WeakMap', 'WeakMap::@@toStringTag is `WeakMap`'); assert.same(String(new WeakMap()), '[object WeakMap]', 'correct stringification'); }); core-js-3.33.2/tests/unit-global/es.weak-set.js000066400000000000000000000110111451776221300212110ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants.js'; import { createIterable, nativeSubclass } from '../helpers/helpers.js'; const Symbol = GLOBAL.Symbol || {}; const { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('WeakSet', assert => { assert.isFunction(WeakSet); assert.name(WeakSet, 'WeakSet'); assert.arity(WeakSet, 0); assert.looksNative(WeakSet); assert.true('add' in WeakSet.prototype, 'add in WeakSet.prototype'); assert.true('delete' in WeakSet.prototype, 'delete in WeakSet.prototype'); assert.true('has' in WeakSet.prototype, 'has in WeakSet.prototype'); assert.true(new WeakSet() instanceof WeakSet, 'new WeakSet instanceof WeakSet'); let object = {}; assert.true(new WeakSet(createIterable([object])).has(object), 'Init from iterable'); const weakset = new WeakSet(); const frozen = freeze({}); weakset.add(frozen); assert.true(weakset.has(frozen), 'works with frozen objects, #1'); weakset.delete(frozen); assert.false(weakset.has(frozen), 'works with frozen objects, #2'); let done = false; try { new WeakSet(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); assert.false(('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new WeakSet(array); assert.true(done); object = {}; new WeakSet().add(object); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakSet); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof WeakSet, 'correct subclassing with native classes #2'); object = {}; assert.true(new Subclass().add(object).has(object), 'correct subclassing with native classes #3'); } const buffer = new ArrayBuffer(8); const set = new WeakSet([buffer]); assert.true(set.has(buffer), 'works with ArrayBuffer keys'); }); QUnit.test('WeakSet#add', assert => { assert.isFunction(WeakSet.prototype.add); assert.name(WeakSet.prototype.add, 'add'); assert.arity(WeakSet.prototype.add, 1); assert.looksNative(WeakSet.prototype.add); assert.nonEnumerable(WeakSet.prototype, 'add'); const weakset = new WeakSet(); assert.same(weakset.add({}), weakset, 'chaining'); assert.throws(() => new WeakSet().add(42), 'throws with primitive keys'); }); QUnit.test('WeakSet#delete', assert => { assert.isFunction(WeakSet.prototype.delete); if (NATIVE) assert.arity(WeakSet.prototype.delete, 1); assert.looksNative(WeakSet.prototype.delete); assert.nonEnumerable(WeakSet.prototype, 'delete'); const a = {}; const b = {}; const weakset = new WeakSet().add(a).add(b); assert.true(weakset.has(a), 'WeakSet has values before .delete() #1'); assert.true(weakset.has(b), 'WeakSet has values before .delete() #2'); weakset.delete(a); assert.false(weakset.has(a), 'WeakSet has not value after .delete() #1'); assert.true(weakset.has(b), 'WeakSet has not value after .delete() #2'); assert.notThrows(() => !weakset.delete(1), 'return false on primitive'); }); QUnit.test('WeakSet#has', assert => { assert.isFunction(WeakSet.prototype.has); assert.name(WeakSet.prototype.has, 'has'); assert.arity(WeakSet.prototype.has, 1); assert.looksNative(WeakSet.prototype.has); assert.nonEnumerable(WeakSet.prototype, 'has'); const weakset = new WeakSet(); assert.false(weakset.has({}), 'WeakSet has`nt value'); const object = {}; weakset.add(object); assert.true(weakset.has(object), 'WeakSet has value after .add()'); weakset.delete(object); assert.false(weakset.has(object), 'WeakSet has not value after .delete()'); assert.notThrows(() => !weakset.has(1), 'return false on primitive'); }); QUnit.test('WeakSet::@@toStringTag', assert => { assert.same(WeakSet.prototype[Symbol.toStringTag], 'WeakSet', 'WeakSet::@@toStringTag is `WeakSet`'); assert.same(String(new WeakSet()), '[object WeakSet]', 'correct stringification'); }); core-js-3.33.2/tests/unit-global/esnext.array-buffer.detached.js000066400000000000000000000024211451776221300245220ustar00rootroot00000000000000/* eslint-disable es/no-shared-array-buffer -- testing */ import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('ArrayBuffer#detached', assert => { assert.same(new ArrayBuffer(8).detached, false, 'default'); const detached = new ArrayBuffer(8); try { structuredClone(detached, { transfer: [detached] }); } catch { /* empty */ } if (detached.length === 0) { assert.same(detached.detached, true, 'detached'); } if (DESCRIPTORS) { const { get, configurable, enumerable } = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'detached'); assert.same(configurable, true, 'configurable'); assert.same(enumerable, false, 'non-enumerable'); assert.isFunction(get); assert.looksNative(get); assert.throws(() => get.call(null), TypeError, 'non-generic-1'); assert.throws(() => get(), TypeError, 'non-generic-2'); assert.throws(() => get.call(1), TypeError, 'non-generic-3'); assert.throws(() => get.call(true), TypeError, 'non-generic-4'); assert.throws(() => get.call(''), TypeError, 'non-generic-5'); assert.throws(() => get.call({}), TypeError, 'non-generic-6'); if (typeof SharedArrayBuffer == 'function') { assert.throws(() => get.call(new SharedArrayBuffer(8)), TypeError, 'non-generic-7'); } } }); core-js-3.33.2/tests/unit-global/esnext.array-buffer.transfer-to-fixed-length.js000066400000000000000000000066721451776221300276150ustar00rootroot00000000000000/* eslint-disable es/no-shared-array-buffer -- testing */ import { GLOBAL } from '../helpers/constants.js'; import { arrayToBuffer, bufferToArray } from '../helpers/helpers.js'; const transferToFixedLength = GLOBAL?.ArrayBuffer?.prototype?.transferToFixedLength; if (transferToFixedLength) QUnit.test('ArrayBuffer#transferToFixedLength', assert => { assert.isFunction(transferToFixedLength); assert.arity(transferToFixedLength, 0); assert.name(transferToFixedLength, 'transferToFixedLength'); assert.looksNative(transferToFixedLength); assert.nonEnumerable(ArrayBuffer.prototype, 'transferToFixedLength'); // works incorrectly in ancient webkit const DETACHED = false; // 'detached' in ArrayBuffer.prototype; const array = [0, 1, 2, 3, 4, 5, 6, 7]; let buffer = arrayToBuffer(array); let transferred = buffer.transferToFixedLength(); assert.notSame(transferred, buffer, 'returns new buffer 1'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 1'); assert.same(buffer.byteLength, 0, 'original array length 1'); if (DETACHED) assert.true(buffer.detached, 'original array detached 1'); assert.same(transferred.byteLength, 8, 'proper transferred byteLength 1'); assert.arrayEqual(bufferToArray(transferred), array, 'properly copied 1'); buffer = arrayToBuffer(array); transferred = buffer.transferToFixedLength(5); assert.notSame(transferred, buffer, 'returns new buffer 2'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 2'); assert.same(buffer.byteLength, 0, 'original array length 2'); if (DETACHED) assert.true(buffer.detached, 'original array detached 2'); assert.same(transferred.byteLength, 5, 'proper transferred byteLength 2'); assert.arrayEqual(bufferToArray(transferred), array.slice(0, 5), 'properly copied 2'); buffer = arrayToBuffer(array); transferred = buffer.transferToFixedLength(16.7); assert.notSame(transferred, buffer, 'returns new buffer 3'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 3'); assert.same(buffer.byteLength, 0, 'original array length 3'); if (DETACHED) assert.true(buffer.detached, 'original array detached 3'); assert.same(transferred.byteLength, 16, 'proper transferred byteLength 3'); assert.arrayEqual(bufferToArray(transferred), [...array, 0, 0, 0, 0, 0, 0, 0, 0], 'properly copied 3'); assert.throws(() => arrayToBuffer(array).transferToFixedLength(-1), RangeError, 'negative length'); assert.throws(() => transferToFixedLength.call({}), TypeError, 'non-generic-1'); if (typeof SharedArrayBuffer == 'function') { assert.throws(() => transferToFixedLength.call(new SharedArrayBuffer(8)), TypeError, 'non-generic-2'); } if ('resizable' in ArrayBuffer.prototype) { assert.false(arrayToBuffer(array).transferToFixedLength().resizable, 'non-resizable-1'); assert.false(arrayToBuffer(array).transferToFixedLength(5).resizable, 'non-resizable-2'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); transferred = buffer.transferToFixedLength(); assert.arrayEqual(bufferToArray(transferred), array, 'resizable-1'); assert.false(transferred.resizable, 'resizable-2'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); transferred = buffer.transferToFixedLength(5); assert.arrayEqual(bufferToArray(transferred), array.slice(0, 5), 'resizable-3'); assert.false(transferred.resizable, 'resizable-4'); } }); core-js-3.33.2/tests/unit-global/esnext.array-buffer.transfer.js000066400000000000000000000062641451776221300246160ustar00rootroot00000000000000/* eslint-disable es/no-shared-array-buffer -- testing */ import { GLOBAL } from '../helpers/constants.js'; import { arrayToBuffer, bufferToArray } from '../helpers/helpers.js'; const transfer = GLOBAL?.ArrayBuffer?.prototype?.transfer; if (transfer) QUnit.test('ArrayBuffer#transfer', assert => { assert.isFunction(transfer); assert.arity(transfer, 0); assert.name(transfer, 'transfer'); assert.looksNative(transfer); assert.nonEnumerable(ArrayBuffer.prototype, 'transfer'); // works incorrectly in ancient webkit const DETACHED = false; // 'detached' in ArrayBuffer.prototype; const array = [0, 1, 2, 3, 4, 5, 6, 7]; let buffer = arrayToBuffer(array); let transferred = buffer.transfer(); assert.notSame(transferred, buffer, 'returns new buffer 1'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 1'); assert.same(buffer.byteLength, 0, 'original array length 1'); if (DETACHED) assert.true(buffer.detached, 'original array detached 1'); assert.same(transferred.byteLength, 8, 'proper transferred byteLength 1'); assert.arrayEqual(bufferToArray(transferred), array, 'properly copied 1'); buffer = arrayToBuffer(array); transferred = buffer.transfer(5); assert.notSame(transferred, buffer, 'returns new buffer 2'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 2'); assert.same(buffer.byteLength, 0, 'original array length 2'); if (DETACHED) assert.true(buffer.detached, 'original array detached 2'); assert.same(transferred.byteLength, 5, 'proper transferred byteLength 2'); assert.arrayEqual(bufferToArray(transferred), array.slice(0, 5), 'properly copied 2'); buffer = arrayToBuffer(array); transferred = buffer.transfer(16.7); assert.notSame(transferred, buffer, 'returns new buffer 3'); assert.true(transferred instanceof ArrayBuffer, 'returns ArrayBuffer 3'); assert.same(buffer.byteLength, 0, 'original array length 3'); if (DETACHED) assert.true(buffer.detached, 'original array detached 3'); assert.same(transferred.byteLength, 16, 'proper transferred byteLength 3'); assert.arrayEqual(bufferToArray(transferred), [...array, 0, 0, 0, 0, 0, 0, 0, 0], 'properly copied 3'); assert.throws(() => arrayToBuffer(array).transfer(-1), RangeError, 'negative length'); assert.throws(() => transfer.call({}), TypeError, 'non-generic-1'); if (typeof SharedArrayBuffer == 'function') { assert.throws(() => transfer.call(new SharedArrayBuffer(8)), TypeError, 'non-generic-2'); } if ('resizable' in ArrayBuffer.prototype) { assert.false(arrayToBuffer(array).transfer().resizable, 'non-resizable-1'); assert.false(arrayToBuffer(array).transfer(5).resizable, 'non-resizable-2'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); transferred = buffer.transfer(); assert.arrayEqual(bufferToArray(transferred), array, 'resizable-1'); assert.true(transferred.resizable, 'resizable-2'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); transferred = buffer.transfer(5); assert.arrayEqual(bufferToArray(transferred), array.slice(0, 5), 'resizable-3'); assert.true(transferred.resizable, 'resizable-4'); } }); core-js-3.33.2/tests/unit-global/esnext.array.filter-out.js000066400000000000000000000026201451776221300236050ustar00rootroot00000000000000// TODO: Remove from `core-js@4` import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#filterOut', assert => { const { filterOut } = Array.prototype; assert.isFunction(filterOut); assert.arity(filterOut, 1); assert.name(filterOut, 'filterOut'); assert.looksNative(filterOut); assert.nonEnumerable(Array.prototype, 'filterOut'); let array = [1]; const context = {}; array.filterOut(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], [1, 2, 3, 'q', {}, 4, true, 5].filterOut(it => typeof it != 'number')); if (STRICT) { assert.throws(() => filterOut.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filterOut.call(undefined, () => { /* empty */ }), TypeError); } assert.notThrows(() => filterOut.call({ length: -1, 0: 1, }, () => { throw new Error(); }), 'uses ToLength'); array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.filterOut(Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.filter-reject.js000066400000000000000000000026311451776221300242540ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#filterReject', assert => { const { filterReject } = Array.prototype; assert.isFunction(filterReject); assert.arity(filterReject, 1); assert.name(filterReject, 'filterReject'); assert.looksNative(filterReject); assert.nonEnumerable(Array.prototype, 'filterReject'); let array = [1]; const context = {}; array.filterReject(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], [1, 2, 3, 'q', {}, 4, true, 5].filterReject(it => typeof it != 'number')); if (STRICT) { assert.throws(() => filterReject.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filterReject.call(undefined, () => { /* empty */ }), TypeError); } assert.notThrows(() => filterReject.call({ length: -1, 0: 1, }, () => { throw new Error(); }), 'uses ToLength'); array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.filterReject(Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.from-async.js000066400000000000000000000055121451776221300235740ustar00rootroot00000000000000import { createAsyncIterable, createIterable } from '../helpers/helpers.js'; import { STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Array.fromAsync', assert => { const { fromAsync } = Array; assert.isFunction(fromAsync); assert.arity(fromAsync, 1); assert.name(fromAsync, 'fromAsync'); assert.looksNative(fromAsync); assert.nonEnumerable(Array, 'fromAsync'); function C() { /* empty */ } return fromAsync(createAsyncIterable([1, 2, 3]), it => it ** 2).then(it => { assert.arrayEqual(it, [1, 4, 9], 'async iterable and mapfn'); return fromAsync(createAsyncIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return fromAsync(createAsyncIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'async iterable without mapfn'); return fromAsync(createIterable([1, 2, 3]), arg => arg ** 2); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and mapfn'); return fromAsync(createIterable([1, 2, 3]), arg => Promise.resolve(arg ** 2)); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and async mapfn'); return fromAsync(createIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return fromAsync(createIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'iterable and without mapfn'); return fromAsync([1, Promise.resolve(2), 3]); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'array'); return fromAsync('123'); }).then(it => { assert.arrayEqual(it, ['1', '2', '3'], 'string'); return fromAsync.call(C, [1]); }).then(it => { assert.true(it instanceof C, 'subclassable'); return fromAsync({ length: 1, 0: 1 }); }).then(it => { assert.arrayEqual(it, [1], 'non-iterable'); return fromAsync(createIterable([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); return fromAsync(undefined, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync(null, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync([1], null); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync([1], {}); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); }); }); core-js-3.33.2/tests/unit-global/esnext.array.group-by-to-map.js000066400000000000000000000033241451776221300244540ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; const { from } = Array; QUnit.test('Array#groupByToMap', assert => { const { groupByToMap } = Array.prototype; assert.isFunction(groupByToMap); assert.arity(groupByToMap, 1); assert.looksNative(groupByToMap); assert.nonEnumerable(Array.prototype, 'groupByToMap'); let array = [1]; const context = {}; array.groupByToMap(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true([].groupByToMap(it => it) instanceof Map, 'returns Map'); assert.deepEqual(from([1, 2, 3].groupByToMap(it => it % 2)), [[1, [1, 3]], [0, [2]]], '#1'); assert.deepEqual( from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].groupByToMap(it => `i${ it % 5 }`)), [['i1', [1, 6, 11]], ['i2', [2, 7, 12]], ['i3', [3, 8]], ['i4', [4, 9]], ['i0', [5, 10]]], '#2', ); assert.deepEqual(from(Array(3).groupByToMap(it => it)), [[undefined, [undefined, undefined, undefined]]], '#3'); if (STRICT) { assert.throws(() => groupByToMap.call(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupByToMap.call(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.groupByToMap(Boolean).get(true).foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.group-by.js000066400000000000000000000032271451776221300232630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; const { getPrototypeOf } = Object; QUnit.test('Array#groupBy', assert => { const { groupBy } = Array.prototype; assert.isFunction(groupBy); assert.arity(groupBy, 1); assert.name(groupBy, 'groupBy'); assert.looksNative(groupBy); assert.nonEnumerable(Array.prototype, 'groupBy'); let array = [1]; const context = {}; array.groupBy(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(getPrototypeOf([].groupBy(it => it)), null, 'null proto'); assert.deepEqual([1, 2, 3].groupBy(it => it % 2), { 1: [1, 3], 0: [2] }, '#1'); assert.deepEqual( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].groupBy(it => `i${ it % 5 }`), { i1: [1, 6, 11], i2: [2, 7, 12], i3: [3, 8], i4: [4, 9], i0: [5, 10] }, '#2', ); assert.deepEqual(Array(3).groupBy(it => it), { undefined: [undefined, undefined, undefined] }, '#3'); if (STRICT) { assert.throws(() => groupBy.call(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupBy.call(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.groupBy(Boolean).true.foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.group-to-map.js000066400000000000000000000033411451776221300240430ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; const { from } = Array; QUnit.test('Array#groupToMap', assert => { const { groupToMap } = Array.prototype; assert.isFunction(groupToMap); assert.arity(groupToMap, 1); assert.name(groupToMap, 'groupToMap'); assert.looksNative(groupToMap); assert.nonEnumerable(Array.prototype, 'groupToMap'); let array = [1]; const context = {}; array.groupToMap(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true([].groupToMap(it => it) instanceof Map, 'returns Map'); assert.deepEqual(from([1, 2, 3].groupToMap(it => it % 2)), [[1, [1, 3]], [0, [2]]], '#1'); assert.deepEqual( from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].groupToMap(it => `i${ it % 5 }`)), [['i1', [1, 6, 11]], ['i2', [2, 7, 12]], ['i3', [3, 8]], ['i4', [4, 9]], ['i0', [5, 10]]], '#2', ); assert.deepEqual(from(Array(3).groupToMap(it => it)), [[undefined, [undefined, undefined, undefined]]], '#3'); if (STRICT) { assert.throws(() => groupToMap.call(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupToMap.call(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.groupToMap(Boolean).get(true).foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.group.js000066400000000000000000000031671451776221300226560ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; const { getPrototypeOf } = Object; QUnit.test('Array#group', assert => { const { group } = Array.prototype; assert.isFunction(group); assert.arity(group, 1); assert.name(group, 'group'); assert.looksNative(group); assert.nonEnumerable(Array.prototype, 'group'); let array = [1]; const context = {}; array.group(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(getPrototypeOf([].group(it => it)), null, 'null proto'); assert.deepEqual([1, 2, 3].group(it => it % 2), { 1: [1, 3], 0: [2] }, '#1'); assert.deepEqual( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].group(it => `i${ it % 5 }`), { i1: [1, 6, 11], i2: [2, 7, 12], i3: [3, 8], i4: [4, 9], i0: [5, 10] }, '#2', ); assert.deepEqual(Array(3).group(it => it), { undefined: [undefined, undefined, undefined] }, '#3'); if (STRICT) { assert.throws(() => group.call(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => group.call(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(array.group(Boolean).true.foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-global/esnext.array.is-template-object.js000066400000000000000000000017061451776221300252070ustar00rootroot00000000000000QUnit.test('Array.isTemplateObject', assert => { const { isTemplateObject } = Array; const { freeze } = Object; assert.isFunction(isTemplateObject); assert.arity(isTemplateObject, 1); assert.name(isTemplateObject, 'isTemplateObject'); assert.looksNative(isTemplateObject); assert.nonEnumerable(Array, 'isTemplateObject'); assert.false(isTemplateObject(undefined)); assert.false(isTemplateObject(null)); assert.false(isTemplateObject({})); assert.false(isTemplateObject(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.false(isTemplateObject([])); assert.false(isTemplateObject(freeze([]))); const template = (() => { try { // eslint-disable-next-line no-template-curly-in-string -- safe return Function('return (it => it)`qwe${ 123 }asd`')(); } catch { /* empty */ } })(); if (template) assert.true(isTemplateObject(template)); }); core-js-3.33.2/tests/unit-global/esnext.array.last-index.js000066400000000000000000000006061451776221300235650ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Array#lastIndex', assert => { const descriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'lastIndex'); assert.isFunction(descriptor.get); assert.false(descriptor.enumerable); assert.true(descriptor.configurable); assert.same([1, 2, 3].lastIndex, 2); assert.same([].lastIndex, 0); }); core-js-3.33.2/tests/unit-global/esnext.array.last-item.js000066400000000000000000000011101451776221300234030ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('Array#lastItem', assert => { const descriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'lastItem'); assert.isFunction(descriptor.get); assert.isFunction(descriptor.set); assert.false(descriptor.enumerable); assert.true(descriptor.configurable); assert.same([1, 2, 3].lastItem, 3); assert.same([].lastItem, undefined); let array = [1, 2, 3]; array.lastItem = 4; assert.deepEqual(array, [1, 2, 4]); array = []; array.lastItem = 5; assert.deepEqual(array, [5]); }); core-js-3.33.2/tests/unit-global/esnext.array.unique-by.js000066400000000000000000000024311451776221300234310ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Array#uniqueBy', assert => { const { uniqueBy } = Array.prototype; assert.isFunction(uniqueBy); assert.arity(uniqueBy, 1); assert.name(uniqueBy, 'uniqueBy'); assert.looksNative(uniqueBy); assert.nonEnumerable(Array.prototype, 'uniqueBy'); let array = [1, 2, 3, 2, 1]; assert.notSame(array.uniqueBy(), array); assert.deepEqual(array.uniqueBy(), [1, 2, 3]); array = [ { id: 1, uid: 10000, }, { id: 2, uid: 10000, }, { id: 3, uid: 10001, }, ]; assert.deepEqual(array.uniqueBy(it => it.uid), [ { id: 1, uid: 10000, }, { id: 3, uid: 10001, }, ]); assert.deepEqual(array.uniqueBy(({ id, uid }) => `${ id }-${ uid }`), array); assert.deepEqual([1, undefined, 2, undefined, null, 1].uniqueBy(), [1, undefined, 2, null]); assert.deepEqual([0, -0].uniqueBy(), [0]); assert.deepEqual([NaN, NaN].uniqueBy(), [NaN]); assert.deepEqual(uniqueBy.call({ length: 1, 0: 1 }), [1]); if (STRICT) { assert.throws(() => uniqueBy.call(null), TypeError); assert.throws(() => uniqueBy.call(undefined), TypeError); } assert.true('uniqueBy' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.33.2/tests/unit-global/esnext.async-disposable-stack.constructor.js000066400000000000000000000140641451776221300273320ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('AsyncDisposableStack constructor', assert => { assert.isFunction(AsyncDisposableStack); assert.arity(AsyncDisposableStack, 0); assert.name(AsyncDisposableStack, 'AsyncDisposableStack'); assert.looksNative(AsyncDisposableStack); assert.throws(() => AsyncDisposableStack(), 'throws w/o `new`'); assert.true(new AsyncDisposableStack() instanceof AsyncDisposableStack); assert.same(AsyncDisposableStack.prototype.constructor, AsyncDisposableStack); }); QUnit.test('AsyncDisposableStack#disposeAsync', assert => { assert.isFunction(AsyncDisposableStack.prototype.disposeAsync); assert.arity(AsyncDisposableStack.prototype.disposeAsync, 0); assert.name(AsyncDisposableStack.prototype.disposeAsync, 'disposeAsync'); assert.looksNative(AsyncDisposableStack.prototype.disposeAsync); assert.nonEnumerable(AsyncDisposableStack.prototype, 'disposeAsync'); }); QUnit.test('AsyncDisposableStack#use', assert => { assert.isFunction(AsyncDisposableStack.prototype.use); assert.arity(AsyncDisposableStack.prototype.use, 1); assert.name(AsyncDisposableStack.prototype.use, 'use'); assert.looksNative(AsyncDisposableStack.prototype.use); assert.nonEnumerable(AsyncDisposableStack.prototype, 'use'); let result = ''; const stack = new AsyncDisposableStack(); const resource = { [Symbol.asyncDispose]() { result += '1'; assert.same(this, resource); assert.same(arguments.length, 0); }, }; assert.same(stack.use(resource), resource); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#adopt', assert => { assert.isFunction(AsyncDisposableStack.prototype.adopt); assert.arity(AsyncDisposableStack.prototype.adopt, 2); assert.name(AsyncDisposableStack.prototype.adopt, 'adopt'); assert.looksNative(AsyncDisposableStack.prototype.adopt); assert.nonEnumerable(AsyncDisposableStack.prototype, 'adopt'); let result = ''; const stack = new AsyncDisposableStack(); const resource = {}; assert.same(stack.adopt(resource, function (arg) { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 1); assert.same(arg, resource); }), resource); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#defer', assert => { assert.isFunction(AsyncDisposableStack.prototype.defer); assert.arity(AsyncDisposableStack.prototype.defer, 1); assert.name(AsyncDisposableStack.prototype.defer, 'defer'); assert.looksNative(AsyncDisposableStack.prototype.defer); assert.nonEnumerable(AsyncDisposableStack.prototype, 'defer'); let result = ''; const stack = new AsyncDisposableStack(); assert.same(stack.defer(function () { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 0); }), undefined); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#move', assert => { assert.isFunction(AsyncDisposableStack.prototype.move); assert.arity(AsyncDisposableStack.prototype.move, 0); assert.name(AsyncDisposableStack.prototype.move, 'move'); assert.looksNative(AsyncDisposableStack.prototype.move); assert.nonEnumerable(AsyncDisposableStack.prototype, 'move'); let result = ''; const stack1 = new AsyncDisposableStack(); stack1.defer(() => result += '2'); stack1.defer(() => result += '1'); const stack2 = stack1.move(); assert.true(stack1.disposed); return stack2.disposeAsync().then(() => { assert.same(result, '12'); }); }); QUnit.test('AsyncDisposableStack#@@asyncDispose', assert => { assert.same(AsyncDisposableStack.prototype[Symbol.asyncDispose], AsyncDisposableStack.prototype.disposeAsync); }); QUnit.test('AsyncDisposableStack#@@toStringTag', assert => { assert.same(AsyncDisposableStack.prototype[Symbol.toStringTag], 'AsyncDisposableStack', '@@toStringTag'); }); QUnit.test('AsyncDisposableStack#1', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => result += '5'); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.resolve(result += '3') }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); assert.false(stack.disposed); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '123456'); assert.true(stack.disposed); return stack.disposeAsync(); }).then(it => { assert.same(it, undefined); }); }); QUnit.test('AsyncDisposableStack#2', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => { throw new Error(5); }); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.resolve(result += '3') }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); return stack.disposeAsync().then(() => { assert.avoid(); }, error => { assert.same(result, '12346'); assert.true(error instanceof Error); assert.same(error.message, '5'); }); }); QUnit.test('AsyncDisposableStack#3', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => { throw new Error(5); }); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.reject(Error(3)) }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); return stack.disposeAsync().then(() => { assert.avoid(); }, error => { assert.same(result, '1246'); assert.true(error instanceof SuppressedError); assert.same(error.error.message, '5'); assert.same(error.suppressed.message, '3'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.as-indexed-pairs.js000066400000000000000000000014521451776221300265000ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('AsyncIterator#asIndexedPairs', assert => { const { asIndexedPairs } = AsyncIterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); // assert.name(asIndexedPairs, 'asIndexedPairs'); assert.looksNative(asIndexedPairs); assert.nonEnumerable(AsyncIterator.prototype, 'asIndexedPairs'); if (STRICT) { assert.throws(() => asIndexedPairs.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call(null, () => { /* empty */ }), TypeError); } return asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.async-dispose.js000066400000000000000000000013351451776221300261240ustar00rootroot00000000000000const { create } = Object; QUnit.test('AsyncIterator#@@asyncDispose', assert => { const asyncDispose = AsyncIterator.prototype[Symbol.asyncDispose]; assert.isFunction(asyncDispose); assert.arity(asyncDispose, 0); assert.looksNative(asyncDispose); return create(AsyncIterator.prototype)[Symbol.asyncDispose]().then(result => { assert.same(result, undefined); }).then(() => { let called = false; const iterator2 = create(AsyncIterator.prototype); iterator2.return = function () { called = true; assert.same(this, iterator2); return 7; }; return iterator2[Symbol.asyncDispose]().then(result => { assert.same(result, undefined); assert.true(called); }); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.constructor.js000066400000000000000000000031751451776221300257340ustar00rootroot00000000000000import { nativeSubclass } from '../helpers/helpers.js'; const { getPrototypeOf } = Object; QUnit.test('AsyncIterator', assert => { assert.isFunction(AsyncIterator); assert.arity(AsyncIterator, 0); assert.name(AsyncIterator, 'AsyncIterator'); assert.looksNative(AsyncIterator); const asyncGenerator = (() => { try { return Function('return async function*(){}()')(); } catch { /* empty */ } })(); if (asyncGenerator && globalThis.USE_FUNCTION_CONSTRUCTOR) { const proto = getPrototypeOf(getPrototypeOf(getPrototypeOf(asyncGenerator))); if (proto !== Object.prototype && proto !== null) { assert.true(asyncGenerator instanceof AsyncIterator, 'AsyncGenerator'); } } assert.true(AsyncIterator.from([1, 2, 3]) instanceof AsyncIterator, 'Async From Proxy'); assert.true(AsyncIterator.from([1, 2, 3]).drop(1) instanceof AsyncIterator, 'Async Drop Proxy'); if (nativeSubclass) { const Sub = nativeSubclass(AsyncIterator); assert.true(new Sub() instanceof AsyncIterator, 'abstract constructor'); } assert.throws(() => new AsyncIterator(), 'direct constructor throws'); assert.throws(() => AsyncIterator(), 'throws w/o `new`'); }); QUnit.test('AsyncIterator#constructor', assert => { assert.same(AsyncIterator.prototype.constructor, AsyncIterator, 'AsyncIterator#constructor is AsyncIterator'); }); QUnit.test('AsyncIterator#@@toStringTag', assert => { assert.same(AsyncIterator.prototype[Symbol.toStringTag], 'AsyncIterator', 'AsyncIterator::@@toStringTag is `AsyncIterator`'); assert.same(String(AsyncIterator.from([1, 2, 3])), '[object AsyncIterator]', 'correct stringification'); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.drop.js000066400000000000000000000022431451776221300243060ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('AsyncIterator#drop', assert => { const { drop } = AsyncIterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.name(drop, 'drop'); assert.looksNative(drop); assert.nonEnumerable(AsyncIterator.prototype, 'drop'); if (STRICT) { assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); } assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => drop.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); return drop.call(createIterator([1, 2, 3]), 1).toArray().then(it => { assert.arrayEqual(it, [2, 3], 'basic functionality'); return drop.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [2, 3], 'float'); return drop.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [], 'big'); return drop.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'zero'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.every.js000066400000000000000000000030101451776221300244650ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#every', assert => { const { every } = AsyncIterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(AsyncIterator.prototype, 'every'); if (STRICT) { assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); return every.call(createIterator([1, 2, 3]), it => typeof it == 'number').then(result => { assert.true(result, 'basic functionality, +'); return every.call(createIterator([1, 2, 3]), it => it === 2); }).then(result => { assert.false(result, 'basic functionality, -'); return every.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return every.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.filter.js000066400000000000000000000026361451776221300246350ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#filter', assert => { const { filter } = AsyncIterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(AsyncIterator.prototype, 'filter'); if (STRICT) { assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); return filter.call(createIterator([1, 2, 3]), it => it % 2).toArray().then(it => { assert.arrayEqual(it, [1, 3], 'basic functionality'); return filter.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); }).then(() => { return filter.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.find.js000066400000000000000000000027651451776221300242730ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#find', assert => { const { find } = AsyncIterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(AsyncIterator.prototype, 'find'); if (STRICT) { assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); return find.call(createIterator([2, 3, 4]), it => it % 2).then(result => { assert.same(result, 3, 'basic functionality, +'); return find.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.same(result, undefined, 'basic functionality, -'); return find.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return find.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.flat-map.js000066400000000000000000000030351451776221300250430ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#flatMap', assert => { const { flatMap } = AsyncIterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.name(flatMap, 'flatMap'); assert.looksNative(flatMap); assert.nonEnumerable(AsyncIterator.prototype, 'flatMap'); if (STRICT) { assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); return flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6]]), it => typeof it == 'number' ? [-it] : it).toArray().then(it => { assert.arrayEqual(it, [-1, -2, 3, 4, 5, 6], 'basic functionality'); return flatMap.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); return [arg]; }).toArray(); }).then(() => { return flatMap.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.for-each.js000066400000000000000000000026631451776221300250340ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#forEach', assert => { const { forEach } = AsyncIterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(AsyncIterator.prototype, 'forEach'); if (STRICT) { assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); const array = []; return forEach.call(createIterator([1, 2, 3]), it => array.push(it)).then(() => { assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); return forEach.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return forEach.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.from.js000066400000000000000000000016231451776221300243060ustar00rootroot00000000000000const { assign, create } = Object; QUnit.test('AsyncIterator.from', assert => { const { from } = AsyncIterator; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(AsyncIterator, 'from'); assert.true(AsyncIterator.from([].values()) instanceof AsyncIterator, 'proxy, iterator'); assert.true(AsyncIterator.from([]) instanceof AsyncIterator, 'proxy, iterable'); const asyncIterator = assign(create(AsyncIterator.prototype), { next: () => { /* empty */ }, }); assert.same(AsyncIterator.from(asyncIterator), asyncIterator, 'does not wrap AsyncIterator instances'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); return AsyncIterator.from([1, Promise.resolve(2), 3]).toArray().then(result => { assert.arrayEqual(result, [1, 2, 3], 'unwrap promises'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.indexed.js000066400000000000000000000013321451776221300247600ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('AsyncIterator#indexed', assert => { const { indexed } = AsyncIterator.prototype; assert.isFunction(indexed); assert.arity(indexed, 0); assert.name(indexed, 'indexed'); assert.looksNative(indexed); assert.nonEnumerable(AsyncIterator.prototype, 'indexed'); if (STRICT) { assert.throws(() => indexed.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => indexed.call(null, () => { /* empty */ }), TypeError); } return indexed.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.map.js000066400000000000000000000025621451776221300241230ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#map', assert => { const { map } = AsyncIterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(AsyncIterator.prototype, 'map'); if (STRICT) { assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); return map.call(createIterator([1, 2, 3]), it => it ** 2).toArray().then(it => { assert.arrayEqual(it, [1, 4, 9], 'basic functionality'); return map.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); }).then(() => { return map.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.reduce.js000066400000000000000000000033431451776221300246130ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#reduce', assert => { const { reduce } = AsyncIterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(AsyncIterator.prototype, 'reduce'); if (STRICT) { assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); } assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1).then(it => { assert.same(it, 7, 'basic functionality, initial'); return reduce.call(createIterator([2]), function (a, b, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 3, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); assert.same(counter, 0, 'counter'); }, 1); }).then(() => { return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b); }).then(it => { assert.same(it, 6, 'basic functionality, no initial'); return reduce.call(createIterator([]), (a, b) => a + b); }).catch(() => { assert.required('reduce an empty iterable with no initial'); return reduce.call(createIterator([1]), () => { throw 42; }, 1); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.some.js000066400000000000000000000027521451776221300243120ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('AsyncIterator#some', assert => { const { some } = AsyncIterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(AsyncIterator.prototype, 'some'); if (STRICT) { assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); return some.call(createIterator([1, 2, 3]), it => it === 2).then(result => { assert.true(result, 'basic functionality, +'); return some.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.false(result, 'basic functionality, -'); return some.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return some.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.take.js000066400000000000000000000022401451776221300242630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('AsyncIterator#take', assert => { const { take } = AsyncIterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.name(take, 'take'); assert.looksNative(take); assert.nonEnumerable(AsyncIterator.prototype, 'take'); if (STRICT) { assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); } assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => take.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); return take.call(createIterator([1, 2, 3]), 2).toArray().then(it => { assert.arrayEqual(it, [1, 2], 'basic functionality'); return take.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [1], 'float'); return take.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'big'); return take.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [], 'zero'); }); }); core-js-3.33.2/tests/unit-global/esnext.async-iterator.to-array.js000066400000000000000000000011741451776221300251020ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('AsyncIterator#toArray', assert => { const { toArray } = AsyncIterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.name(toArray, 'toArray'); assert.looksNative(toArray); assert.nonEnumerable(AsyncIterator.prototype, 'toArray'); if (STRICT) { assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); } return toArray.call(createIterator([1, 2, 3])).then(it => { assert.arrayEqual(it, [1, 2, 3]); }); }); core-js-3.33.2/tests/unit-global/esnext.bigint.range.js000066400000000000000000000046101451776221300227460ustar00rootroot00000000000000/* eslint-disable es/no-bigint -- safe */ if (typeof BigInt == 'function') QUnit.test('BigInt.range', assert => { const { range } = BigInt; const { from } = Array; assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); assert.looksNative(range); assert.nonEnumerable(BigInt, 'range'); let iterator = range(BigInt(1), BigInt(2)); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: BigInt(1), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(BigInt(-1), BigInt(5))), [BigInt(-1), BigInt(0), BigInt(1), BigInt(2), BigInt(3), BigInt(4)]); assert.deepEqual(from(range(BigInt(-5), BigInt(1))), [BigInt(-5), BigInt(-4), BigInt(-3), BigInt(-2), BigInt(-1), BigInt(0)]); assert.deepEqual( from(range(BigInt('9007199254740991'), BigInt('9007199254740992'), { inclusive: true })), [BigInt('9007199254740991'), BigInt('9007199254740992')], ); assert.deepEqual(from(range(BigInt(0), BigInt(0))), []); assert.deepEqual(from(range(BigInt(0), BigInt(-5), BigInt(1))), []); iterator = range(BigInt(1), BigInt(3)); assert.deepEqual(iterator.start, BigInt(1)); assert.deepEqual(iterator.end, BigInt(3)); assert.deepEqual(iterator.step, BigInt(1)); assert.false(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { inclusive: true }); assert.deepEqual(iterator.start, BigInt(-1)); assert.deepEqual(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(-1)); assert.true(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { step: BigInt(4), inclusive() { /* empty */ } }); assert.same(iterator.start, BigInt(-1)); assert.same(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(4)); assert.true(iterator.inclusive); iterator = range(BigInt(0), BigInt(5)); assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(-Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), Infinity), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), { step: Infinity }), TypeError); assert.throws(() => range({}, BigInt(1)), TypeError); assert.throws(() => range(BigInt(1), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.composite-key.js000066400000000000000000000036631451776221300231760ustar00rootroot00000000000000 import { FREEZING } from '../helpers/constants.js'; const { getPrototypeOf, isFrozen } = Object; QUnit.test('compositeKey', assert => { assert.isFunction(compositeKey); assert.name(compositeKey, 'compositeKey'); assert.looksNative(compositeKey); const key = compositeKey({}); assert.same(typeof key, 'object'); assert.same({}.toString.call(key), '[object Object]'); assert.same(getPrototypeOf(key), null); if (FREEZING) assert.true(isFrozen(key)); const a = ['a']; const b = ['b']; const c = ['c']; assert.same(compositeKey(a), compositeKey(a)); assert.notSame(compositeKey(a), compositeKey(['a'])); assert.notSame(compositeKey(a), compositeKey(a, 1)); assert.notSame(compositeKey(a), compositeKey(a, b)); assert.same(compositeKey(a, 1), compositeKey(a, 1)); assert.same(compositeKey(a, b), compositeKey(a, b)); assert.notSame(compositeKey(a, b), compositeKey(b, a)); assert.same(compositeKey(a, b, c), compositeKey(a, b, c)); assert.notSame(compositeKey(a, b, c), compositeKey(c, b, a)); assert.notSame(compositeKey(a, b, c), compositeKey(a, c, b)); assert.notSame(compositeKey(a, b, c, 1), compositeKey(a, b, c)); assert.same(compositeKey(a, b, c, 1), compositeKey(a, b, c, 1)); assert.same(compositeKey(1, a), compositeKey(1, a)); assert.notSame(compositeKey(1, a), compositeKey(a, 1)); assert.same(compositeKey(1, a, 2, b), compositeKey(1, a, 2, b)); assert.notSame(compositeKey(1, a, 2, b), compositeKey(1, a, b, 2)); assert.same(compositeKey(1, 2, a, b), compositeKey(1, 2, a, b)); assert.notSame(compositeKey(1, 2, a, b), compositeKey(1, a, b, 2)); assert.same(compositeKey(a, a), compositeKey(a, a)); assert.notSame(compositeKey(a, a), compositeKey(a, ['a'])); assert.notSame(compositeKey(a, a), compositeKey(a, b)); assert.throws(() => compositeKey(), TypeError); assert.throws(() => compositeKey(1, 2), TypeError); assert.throws(() => compositeKey('foo', null, true), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.composite-symbol.js000066400000000000000000000037441451776221300237130ustar00rootroot00000000000000 QUnit.test('compositeSymbol', assert => { assert.isFunction(compositeSymbol); assert.name(compositeSymbol, 'compositeSymbol'); assert.looksNative(compositeSymbol); assert.true(Object(compositeSymbol({})) instanceof Symbol); const a = ['a']; const b = ['b']; const c = ['c']; assert.same(compositeSymbol(a), compositeSymbol(a)); assert.notSame(compositeSymbol(a), compositeSymbol(['a'])); assert.notSame(compositeSymbol(a), compositeSymbol(a, 1)); assert.notSame(compositeSymbol(a), compositeSymbol(a, b)); assert.same(compositeSymbol(a, 1), compositeSymbol(a, 1)); assert.same(compositeSymbol(a, b), compositeSymbol(a, b)); assert.notSame(compositeSymbol(a, b), compositeSymbol(b, a)); assert.same(compositeSymbol(a, b, c), compositeSymbol(a, b, c)); assert.notSame(compositeSymbol(a, b, c), compositeSymbol(c, b, a)); assert.notSame(compositeSymbol(a, b, c), compositeSymbol(a, c, b)); assert.notSame(compositeSymbol(a, b, c, 1), compositeSymbol(a, b, c)); assert.same(compositeSymbol(a, b, c, 1), compositeSymbol(a, b, c, 1)); assert.same(compositeSymbol(1, a), compositeSymbol(1, a)); assert.notSame(compositeSymbol(1, a), compositeSymbol(a, 1)); assert.same(compositeSymbol(1, a, 2, b), compositeSymbol(1, a, 2, b)); assert.notSame(compositeSymbol(1, a, 2, b), compositeSymbol(1, a, b, 2)); assert.same(compositeSymbol(1, 2, a, b), compositeSymbol(1, 2, a, b)); assert.notSame(compositeSymbol(1, 2, a, b), compositeSymbol(1, a, b, 2)); assert.same(compositeSymbol(a, a), compositeSymbol(a, a)); assert.notSame(compositeSymbol(a, a), compositeSymbol(a, ['a'])); assert.notSame(compositeSymbol(a, a), compositeSymbol(a, b)); assert.same(compositeSymbol(), compositeSymbol()); assert.same(compositeSymbol(1, 2), compositeSymbol(1, 2)); assert.notSame(compositeSymbol(1, 2), compositeSymbol(2, 1)); assert.same(compositeSymbol('foo', null, true), compositeSymbol('foo', null, true)); assert.same(compositeSymbol('string'), Symbol.for('string')); }); core-js-3.33.2/tests/unit-global/esnext.data-view.set-float16.js000066400000000000000000000047461451776221300243360ustar00rootroot00000000000000QUnit.test('DataView.prototype.{ getFloat16, setFloat16 }', assert => { const { getFloat16, setFloat16 } = DataView.prototype; assert.isFunction(getFloat16); assert.arity(getFloat16, 1); assert.name(getFloat16, 'getFloat16'); assert.isFunction(setFloat16); assert.arity(setFloat16, 2); assert.name(setFloat16, 'setFloat16'); assert.same(new DataView(new ArrayBuffer(8)).setFloat16(0, 0), undefined, 'void'); function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0b0000000000000000, 0], [0b1000000000000000, -0], [0b0011110000000000, 1], [0b1011110000000000, -1], [0b0100001001001000, 3.140625], [0b0000001000000000, 0.000030517578125], [0b0111101111111111, 65504], [0b1111101111111111, -65504], [0b0000000000000001, 2 ** -24], [0b1000000000000001, -(2 ** -24)], // [0b0111110000000001, NaN], <- what NaN representation should be used? [0b0111110000000000, Infinity], [0b1111110000000000, -Infinity], ]; const buffer = new ArrayBuffer(2); const view = new DataView(buffer); for (const [bin, f16] of data) for (const LE of [false, true]) { view.setUint16(0, bin, LE); assert.same(view.getFloat16(0, LE), f16, `DataView.prototype.setUint16 + DataView.prototype.getFloat16, LE: ${ LE }, ${ toString(bin) } -> ${ toString(f16) }`); view.setFloat16(0, f16, LE); assert.same(view.getUint16(0, LE), bin, `DataView.prototype.setFloat16 + DataView.prototype.getUint16, LE: ${ LE }, ${ toString(f16) } -> ${ toString(bin) }`); assert.same(view.getFloat16(0, LE), f16, `DataView.prototype.setFloat16 + DataView.prototype.getFloat16, LE: ${ LE }, ${ toString(f16) }`); } const MAX_FLOAT16 = 65504; const MIN_FLOAT16 = 2 ** -24; const conversions = [ [1.337, 1.3369140625], [0.499994, 0.5], [7.9999999, 8], [MAX_FLOAT16, MAX_FLOAT16], [-MAX_FLOAT16, -MAX_FLOAT16], [MIN_FLOAT16, MIN_FLOAT16], [-MIN_FLOAT16, -MIN_FLOAT16], [MIN_FLOAT16 / 2, 0], [-MIN_FLOAT16 / 2, -0], [2.980232238769531911744490042422139897126953655970282852649688720703125e-8, MIN_FLOAT16], [-2.980232238769531911744490042422139897126953655970282852649688720703125e-8, -MIN_FLOAT16], ]; for (const [from, to] of conversions) for (const LE of [false, true]) { view.setFloat16(0, from, LE); assert.same(view.getFloat16(0, LE), to, `DataView.prototype.setFloat16 + DataView.prototype.getFloat16, LE: ${ LE }, ${ toString(from) } -> ${ toString(to) }`); } }); core-js-3.33.2/tests/unit-global/esnext.data-view.set-uint8-clamped.js000066400000000000000000000051041451776221300255210ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('DataView.prototype.{ getUint8Clamped, setUint8Clamped }', assert => { const { getUint8Clamped, setUint8Clamped } = DataView.prototype; assert.isFunction(getUint8Clamped); assert.arity(getUint8Clamped, 1); assert.name(getUint8Clamped, 'getUint8Clamped'); assert.isFunction(setUint8Clamped); assert.arity(setUint8Clamped, 2); assert.name(setUint8Clamped, 'setUint8Clamped'); assert.same(new DataView(new ArrayBuffer(8)).setUint8Clamped(0, 0), undefined, 'void'); function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, 0, [0]], [1.1, 1, [1]], [-1.1, 0, [0]], [1.9, 2, [2]], [-1.9, 0, [0]], [127, 127, [127]], [-127, 0, [0]], [128, 128, [128]], [-128, 0, [0]], [255, 255, [255]], [-255, 0, [0]], [255.1, 255, [255]], [255.9, 255, [255]], [256, 255, [255]], [32767, 255, [255]], [-32767, 0, [0]], [32768, 255, [255]], [-32768, 0, [0]], [65535, 255, [255]], [65536, 255, [255]], [65537, 255, [255]], [65536.54321, 255, [255]], [-65536.54321, 0, [0]], [2147483647, 255, [255]], [-2147483647, 0, [0]], [2147483648, 255, [255]], [-2147483648, 0, [0]], [2147483649, 255, [255]], [-2147483649, 0, [0]], [4294967295, 255, [255]], [4294967296, 255, [255]], [4294967297, 255, [255]], [9007199254740991, 255, [255]], [-9007199254740991, 0, [0]], [9007199254740992, 255, [255]], [-9007199254740992, 0, [0]], [9007199254740994, 255, [255]], [-9007199254740994, 0, [0]], [Infinity, 255, [255]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 255, [255]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; const buffer = new ArrayBuffer(1); const view = new DataView(buffer); const array = DESCRIPTORS ? new Uint8Array(buffer) : null; for (const [value, conversion, little] of data) { view.setUint8Clamped(0, value); assert.same(view.getUint8Clamped(0), conversion, `DataView.prototype.setUint8Clamped + DataView.prototype.getUint8Clamped, ${ toString(value) } -> ${ toString(conversion) }`); assert.same(view.getUint8(0), conversion, `DataView.prototype.setUint8Clamped + DataView.prototype.getUint8, ${ toString(value) } -> ${ toString(conversion) }`); if (DESCRIPTORS) assert.arrayEqual(array, little, `DataView.prototype.setUint8Clamped + Uint8Array ${ toString(value) } -> [${ little }]`); } }); core-js-3.33.2/tests/unit-global/esnext.disposable-stack.constructor.js000066400000000000000000000124371451776221300262210ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('DisposableStack constructor', assert => { assert.isFunction(DisposableStack); assert.arity(DisposableStack, 0); assert.name(DisposableStack, 'DisposableStack'); assert.looksNative(DisposableStack); assert.throws(() => DisposableStack(), 'throws w/o `new`'); assert.true(new DisposableStack() instanceof DisposableStack); assert.same(DisposableStack.prototype.constructor, DisposableStack); }); QUnit.test('DisposableStack#dispose', assert => { assert.isFunction(DisposableStack.prototype.dispose); assert.arity(DisposableStack.prototype.dispose, 0); assert.name(DisposableStack.prototype.dispose, 'dispose'); assert.looksNative(DisposableStack.prototype.dispose); assert.nonEnumerable(DisposableStack.prototype, 'dispose'); }); QUnit.test('DisposableStack#use', assert => { assert.isFunction(DisposableStack.prototype.use); assert.arity(DisposableStack.prototype.use, 1); assert.name(DisposableStack.prototype.use, 'use'); assert.looksNative(DisposableStack.prototype.use); assert.nonEnumerable(DisposableStack.prototype, 'use'); let result = ''; const stack1 = new DisposableStack(); const resource = { [Symbol.dispose]() { result += '1'; assert.same(this, resource); assert.same(arguments.length, 0); }, }; assert.same(stack1.use(resource), resource); assert.same(stack1.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#adopt', assert => { assert.isFunction(DisposableStack.prototype.adopt); assert.arity(DisposableStack.prototype.adopt, 2); assert.name(DisposableStack.prototype.adopt, 'adopt'); assert.looksNative(DisposableStack.prototype.adopt); assert.nonEnumerable(DisposableStack.prototype, 'adopt'); let result = ''; const stack = new DisposableStack(); const resource = {}; assert.same(stack.adopt(resource, function (arg) { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 1); assert.same(arg, resource); }), resource); assert.same(stack.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#defer', assert => { assert.isFunction(DisposableStack.prototype.defer); assert.arity(DisposableStack.prototype.defer, 1); assert.name(DisposableStack.prototype.defer, 'defer'); assert.looksNative(DisposableStack.prototype.defer); assert.nonEnumerable(DisposableStack.prototype, 'defer'); let result = ''; const stack = new DisposableStack(); assert.same(stack.defer(function () { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 0); }), undefined); assert.same(stack.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#move', assert => { assert.isFunction(DisposableStack.prototype.move); assert.arity(DisposableStack.prototype.move, 0); assert.name(DisposableStack.prototype.move, 'move'); assert.looksNative(DisposableStack.prototype.move); assert.nonEnumerable(DisposableStack.prototype, 'move'); let result = ''; const stack = new DisposableStack(); stack.defer(() => result += '2'); stack.defer(() => result += '1'); const stack2 = stack.move(); assert.true(stack.disposed); stack2.dispose(); assert.same(result, '12'); }); QUnit.test('DisposableStack#@@dispose', assert => { assert.same(DisposableStack.prototype[Symbol.dispose], DisposableStack.prototype.dispose); }); QUnit.test('DisposableStack#@@toStringTag', assert => { assert.same(DisposableStack.prototype[Symbol.toStringTag], 'DisposableStack', '@@toStringTag'); }); QUnit.test('DisposableStack', assert => { let result1 = ''; const stack1 = new DisposableStack(); stack1.use({ [Symbol.dispose]: () => result1 += '6' }); stack1.adopt({}, () => result1 += '5'); stack1.defer(() => result1 += '4'); stack1.use({ [Symbol.dispose]: () => result1 += '3' }); stack1.adopt({}, () => result1 += '2'); stack1.defer(() => result1 += '1'); assert.false(stack1.disposed); assert.same(stack1.dispose(), undefined); assert.same(result1, '123456'); assert.true(stack1.disposed); assert.same(stack1.dispose(), undefined); let result2 = ''; const stack2 = new DisposableStack(); let error2; stack2.use({ [Symbol.dispose]: () => result2 += '6' }); stack2.adopt({}, () => { throw new Error(5); }); stack2.defer(() => result2 += '4'); stack2.use({ [Symbol.dispose]: () => result2 += '3' }); stack2.adopt({}, () => result2 += '2'); stack2.defer(() => result2 += '1'); try { stack2.dispose(); } catch (error2$) { error2 = error2$; } assert.same(result2, '12346'); assert.true(error2 instanceof Error); assert.same(error2.message, '5'); let result3 = ''; const stack3 = new DisposableStack(); let error3; stack3.use({ [Symbol.dispose]: () => result3 += '6' }); stack3.adopt({}, () => { throw new Error(5); }); stack3.defer(() => result3 += '4'); stack3.use({ [Symbol.dispose]: () => { throw new Error(3); } }); stack3.adopt({}, () => result3 += '2'); stack3.defer(() => result3 += '1'); try { stack3.dispose(); } catch (error3$) { error3 = error3$; } assert.same(result3, '1246'); assert.true(error3 instanceof SuppressedError); assert.same(error3.error.message, '5'); assert.same(error3.suppressed.message, '3'); }); core-js-3.33.2/tests/unit-global/esnext.function.demethodize.js000066400000000000000000000006721451776221300245300ustar00rootroot00000000000000QUnit.test('Function#demethodize', assert => { const { demethodize } = Function.prototype; assert.isFunction(demethodize); assert.arity(demethodize, 0); assert.name(demethodize, 'demethodize'); assert.looksNative(demethodize); assert.nonEnumerable(Function.prototype, 'demethodize'); assert.same(function () { return 42; }.demethodize()(), 42); assert.deepEqual(Array.prototype.slice.demethodize()([1, 2, 3], 1), [2, 3]); }); core-js-3.33.2/tests/unit-global/esnext.function.is-callable.js000066400000000000000000000033401451776221300243720ustar00rootroot00000000000000import { fromSource } from '../helpers/helpers.js'; QUnit.test('Function.isCallable', assert => { const { isCallable } = Function; assert.isFunction(isCallable); assert.arity(isCallable, 1); assert.name(isCallable, 'isCallable'); assert.looksNative(isCallable); assert.nonEnumerable(Function, 'isCallable'); assert.false(isCallable({}), 'object'); assert.false(isCallable(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }()), 'arguments'); assert.false(isCallable([]), 'array'); assert.false(isCallable(/./), 'regex'); assert.false(isCallable(1), 'number'); assert.false(isCallable(true), 'boolean'); assert.false(isCallable('1'), 'string'); assert.false(isCallable(null), 'null'); assert.false(isCallable(), 'undefined'); assert.true(isCallable(Function.call), 'native function'); // eslint-disable-next-line prefer-arrow-callback -- required assert.true(isCallable(function () { /* empty */ }), 'function'); const arrow = fromSource('it => it'); if (arrow) assert.true(isCallable(arrow), 'arrow'); const klass = fromSource('class {}'); // Safari 9 and Edge 13- bugs if (klass && !/constructor|function/.test(klass)) assert.false(isCallable(klass), 'class'); const gen = fromSource('function * () {}'); if (gen) assert.true(isCallable(gen), 'gen'); const asyncFunc = fromSource('async function () {}'); if (asyncFunc) assert.true(isCallable(asyncFunc), 'asyncFunc'); const asyncGen = fromSource('async * function () {}'); if (asyncGen) assert.true(isCallable(asyncGen), 'asyncGen'); const method = fromSource('({f(){}}).f'); // Safari 9 bug if (method && !/function/.test(method)) assert.true(isCallable(method), 'method'); }); core-js-3.33.2/tests/unit-global/esnext.function.is-constructor.js000066400000000000000000000036221451776221300252230ustar00rootroot00000000000000import { fromSource } from '../helpers/helpers.js'; QUnit.test('Function.isConstructor', assert => { const { isConstructor } = Function; assert.isFunction(isConstructor); assert.arity(isConstructor, 1); assert.name(isConstructor, 'isConstructor'); assert.looksNative(isConstructor); assert.nonEnumerable(Function, 'isConstructor'); assert.false(isConstructor({}), 'object'); assert.false(isConstructor(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }()), 'arguments'); assert.false(isConstructor([]), 'array'); assert.false(isConstructor(/./), 'regex'); assert.false(isConstructor(1), 'number'); assert.false(isConstructor(true), 'boolean'); assert.false(isConstructor('1'), 'string'); assert.false(isConstructor(null), 'null'); assert.false(isConstructor(), 'undefined'); // assert.false(isConstructor(Function.call), 'native function'); // fails in some old engines // eslint-disable-next-line prefer-arrow-callback -- required assert.true(isConstructor(function () { /* empty */ }), 'function'); const arrow = fromSource('it => it'); if (arrow) assert.false(isConstructor(arrow), 'arrow'); const klass = fromSource('class {}'); // Safari 9 and Edge 13- bugs if (klass && !/constructor|function/.test(klass)) assert.true(isConstructor(klass), 'class'); const Gen = fromSource('function * () {}'); // V8 ~ Chrome 49- bug if (Gen) try { new Gen(); } catch { assert.false(isConstructor(Gen), 'gen'); } const asyncFunc = fromSource('async function () {}'); if (asyncFunc) assert.false(isConstructor(asyncFunc), 'asyncFunc'); const asyncGen = fromSource('async * function () {}'); if (asyncGen) assert.false(isConstructor(asyncGen), 'asyncGen'); const method = fromSource('({f(){}}).f'); // Safari 9 bug if (method && !/function/.test(method)) assert.false(isConstructor(method), 'method'); }); core-js-3.33.2/tests/unit-global/esnext.function.metadata.js000066400000000000000000000002551451776221300240040ustar00rootroot00000000000000QUnit.test('Function#@@metadata', assert => { assert.true(Symbol.metadata in Function.prototype); assert.same(Function.prototype[Symbol.metadata], null, 'is null'); }); core-js-3.33.2/tests/unit-global/esnext.function.un-this.js000066400000000000000000000006131451776221300236110ustar00rootroot00000000000000QUnit.test('Function#unThis', assert => { const { unThis } = Function.prototype; assert.isFunction(unThis); assert.arity(unThis, 0); // assert.name(unThis, 'unThis'); assert.looksNative(unThis); assert.nonEnumerable(Function.prototype, 'unThis'); assert.same(function () { return 42; }.unThis()(), 42); assert.deepEqual(Array.prototype.slice.unThis()([1, 2, 3], 1), [2, 3]); }); core-js-3.33.2/tests/unit-global/esnext.iterator.as-indexed-pairs.js000066400000000000000000000015271451776221300253700ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('Iterator#asIndexedPairs', assert => { const { asIndexedPairs } = Iterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); // assert.name(asIndexedPairs, 'asIndexedPairs'); assert.looksNative(asIndexedPairs); assert.nonEnumerable(Iterator.prototype, 'asIndexedPairs'); assert.arrayEqual(asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); if (STRICT) { assert.throws(() => asIndexedPairs.call(undefined), TypeError); assert.throws(() => asIndexedPairs.call(null), TypeError); } assert.throws(() => asIndexedPairs.call({}).next(), TypeError); assert.throws(() => asIndexedPairs.call([]).next(), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.constructor.js000066400000000000000000000034471451776221300246230ustar00rootroot00000000000000import { createIterator, nativeSubclass } from '../helpers/helpers.js'; const { getPrototypeOf } = Object; QUnit.test('Iterator', assert => { assert.isFunction(Iterator); assert.arity(Iterator, 0); assert.name(Iterator, 'Iterator'); assert.looksNative(Iterator); const generator = (() => { try { return Function('return function*(){}()')(); } catch { /* empty */ } })(); if (generator) { const proto = getPrototypeOf(getPrototypeOf(getPrototypeOf(generator))); if (proto !== Object.prototype && proto !== null) { assert.true(generator instanceof Iterator, 'Generator'); } } assert.true(''[Symbol.iterator]() instanceof Iterator, 'String Iterator'); assert.true([].values() instanceof Iterator, 'Array Iterator'); assert.true(new Set().values() instanceof Iterator, 'Set Iterator'); assert.true('abc'.matchAll(/./g) instanceof Iterator, 'MatchAll Iterator'); assert.true(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'From Proxy'); assert.true([].values().drop(1) instanceof Iterator, 'Drop Proxy'); if (nativeSubclass) { const Sub = nativeSubclass(Iterator); assert.true(new Sub() instanceof Iterator, 'abstract constructor'); } assert.throws(() => new Iterator(), 'direct constructor throws'); assert.throws(() => Iterator(), 'throws w/o `new`'); }); QUnit.test('Iterator#constructor', assert => { assert.same(Iterator.prototype.constructor, Iterator, 'Iterator#constructor is Iterator'); }); QUnit.test('Iterator#@@toStringTag', assert => { assert.same(Iterator.prototype[Symbol.toStringTag], 'Iterator', 'Iterator::@@toStringTag is `Iterator`'); assert.same(String(Iterator.from({ next: () => ({ done: Math.random() > 0.9, value: Math.random() * 10 | 0 }), })), '[object Iterator]', 'correct stringification'); }); core-js-3.33.2/tests/unit-global/esnext.iterator.dispose.js000066400000000000000000000010451451776221300236740ustar00rootroot00000000000000const { create } = Object; QUnit.test('Iterator#@@dispose', assert => { const dispose = Iterator.prototype[Symbol.dispose]; assert.isFunction(dispose); assert.arity(dispose, 0); assert.looksNative(dispose); assert.same(create(Iterator.prototype)[Symbol.dispose](), undefined); let called = false; const iterator2 = create(Iterator.prototype); iterator2.return = function () { called = true; assert.same(this, iterator2); return 7; }; assert.same(iterator2[Symbol.dispose](), undefined); assert.true(called); }); core-js-3.33.2/tests/unit-global/esnext.iterator.drop.js000066400000000000000000000022001451776221300231640ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('Iterator#drop', assert => { const { drop } = Iterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.name(drop, 'drop'); assert.looksNative(drop); assert.nonEnumerable(Iterator.prototype, 'drop'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1).toArray(), [2, 3], 'basic functionality'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1.5).toArray(), [2, 3], 'float'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 4).toArray(), [], 'big'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 0).toArray(), [1, 2, 3], 'zero'); if (STRICT) { assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); } assert.throws(() => drop.call({}, 1).next(), TypeError); assert.throws(() => drop.call([], 1).next(), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => drop.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); }); core-js-3.33.2/tests/unit-global/esnext.iterator.every.js000066400000000000000000000025341451776221300233640ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#every', assert => { const { every } = Iterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Iterator.prototype, 'every'); assert.true(every.call(createIterator([1, 2, 3]), it => typeof it == 'number'), 'basic functionality #1'); assert.false(every.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #2'); every.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.filter.js000066400000000000000000000024421451776221300235150ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#filter', assert => { const { filter } = Iterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Iterator.prototype, 'filter'); assert.arrayEqual(filter.call(createIterator([1, 2, 3]), it => it % 2).toArray(), [1, 3], 'basic functionality'); filter.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => filter.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.find.js000066400000000000000000000023401451776221300231450ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#find', assert => { const { find } = Iterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Iterator.prototype, 'find'); assert.same(find.call(createIterator([1, 2, 3]), it => !(it % 2)), 2, 'basic functionality'); find.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.flat-map.js000066400000000000000000000030211451776221300237230ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#flatMap', assert => { const { flatMap } = Iterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.name(flatMap, 'flatMap'); assert.looksNative(flatMap); assert.nonEnumerable(Iterator.prototype, 'flatMap'); assert.arrayEqual( flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6]]), it => typeof it == 'number' ? [-it] : it).toArray(), [-1, -2, 3, 4, 5, 6], 'basic functionality', ); flatMap.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); return [arg]; }).toArray(); if (STRICT) { assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => flatMap.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => flatMap.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => flatMap.call(createIterator([1]), it => it).next(), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.for-each.js000066400000000000000000000025061451776221300237150ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#forEach', assert => { const { forEach } = Iterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(Iterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)); assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); forEach.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.from.js000066400000000000000000000015271451776221300231760ustar00rootroot00000000000000import { createIterable, createIterator } from '../helpers/helpers.js'; const { assign } = Object; QUnit.test('Iterator.from', assert => { const { from } = Iterator; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Iterator, 'from'); assert.true(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'proxy, iterator'); assert.true(Iterator.from(createIterable([1, 2, 3])) instanceof Iterator, 'proxy, iterable'); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3], 'just a proxy'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}).next(), TypeError); assert.throws(() => from(assign(new Iterator(), { next: 42 })).next(), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.indexed.js000066400000000000000000000013711451776221300236500ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('Iterator#indexed', assert => { const { indexed } = Iterator.prototype; assert.isFunction(indexed); assert.arity(indexed, 0); assert.name(indexed, 'indexed'); assert.looksNative(indexed); assert.nonEnumerable(Iterator.prototype, 'indexed'); assert.arrayEqual(indexed.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); if (STRICT) { assert.throws(() => indexed.call(undefined), TypeError); assert.throws(() => indexed.call(null), TypeError); } assert.throws(() => indexed.call({}).next(), TypeError); assert.throws(() => indexed.call([]).next(), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.map.js000066400000000000000000000023751451776221300230120ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#map', assert => { const { map } = Iterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Iterator.prototype, 'map'); assert.arrayEqual(map.call(createIterator([1, 2, 3]), it => it ** 2).toArray(), [1, 4, 9], 'basic functionality'); map.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); if (STRICT) { assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => map.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => map.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.range.js000066400000000000000000000111341451776221300233220ustar00rootroot00000000000000/* eslint-disable es/no-bigint -- safe */ QUnit.test('Iterator.range', assert => { const { range } = Iterator; const { from } = Array; assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); assert.looksNative(range); assert.nonEnumerable(Iterator, 'range'); let iterator = range(1, 2); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(-1, 5)), [-1, 0, 1, 2, 3, 4]); assert.deepEqual(from(range(-5, 1)), [-5, -4, -3, -2, -1, 0]); assert.deepEqual( from(range(0, 1, 0.1)), [0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8, 0.9], ); assert.deepEqual( from(range(2 ** 53 - 1, 2 ** 53, { inclusive: true })), [9007199254740991, 9007199254740992], ); assert.deepEqual(from(range(0, 0)), []); assert.deepEqual(from(range(0, -5, 1)), []); assert.deepEqual(from(range(NaN, 0)), []); assert.deepEqual(from(range(0, NaN)), []); assert.deepEqual(from(range(NaN, NaN)), []); assert.deepEqual(from(range(0, 0, { step: NaN })), []); assert.deepEqual(from(range(0, 5, NaN)), []); iterator = range(1, 3); assert.deepEqual(iterator.start, 1); assert.deepEqual(iterator.end, 3); assert.deepEqual(iterator.step, 1); assert.false(iterator.inclusive); iterator = range(-1, -3, { inclusive: true }); assert.deepEqual(iterator.start, -1); assert.deepEqual(iterator.end, -3); assert.same(iterator.step, -1); assert.true(iterator.inclusive); iterator = range(-1, -3, { step: 4, inclusive() { /* empty */ } }); assert.same(iterator.start, -1); assert.same(iterator.end, -3); assert.same(iterator.step, 4); assert.true(iterator.inclusive); iterator = range(0, 5); assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, 10, 0), RangeError); assert.throws(() => range(-Infinity, 10, 0), RangeError); assert.throws(() => range(0, 10, Infinity), RangeError); assert.throws(() => range(0, 10, { step: Infinity }), RangeError); assert.throws(() => range({}, 1), TypeError); assert.throws(() => range(1, {}), TypeError); assert.throws(() => range('1', 2), TypeError); assert.throws(() => range({ valueOf() { return 1; } }, 2), TypeError); if (typeof BigInt == 'function') { iterator = range(BigInt(1), BigInt(2)); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: BigInt(1), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(BigInt(-1), BigInt(5))), [BigInt(-1), BigInt(0), BigInt(1), BigInt(2), BigInt(3), BigInt(4)]); assert.deepEqual(from(range(BigInt(-5), BigInt(1))), [BigInt(-5), BigInt(-4), BigInt(-3), BigInt(-2), BigInt(-1), BigInt(0)]); assert.deepEqual( from(range(BigInt('9007199254740991'), BigInt('9007199254740992'), { inclusive: true })), [BigInt('9007199254740991'), BigInt('9007199254740992')], ); assert.deepEqual(from(range(BigInt(0), BigInt(0))), []); assert.deepEqual(from(range(BigInt(0), BigInt(-5), BigInt(1))), []); iterator = range(BigInt(1), BigInt(3)); assert.deepEqual(iterator.start, BigInt(1)); assert.deepEqual(iterator.end, BigInt(3)); assert.deepEqual(iterator.step, BigInt(1)); assert.false(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { inclusive: true }); assert.deepEqual(iterator.start, BigInt(-1)); assert.deepEqual(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(-1)); assert.true(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { step: BigInt(4), inclusive() { /* empty */ } }); assert.same(iterator.start, BigInt(-1)); assert.same(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(4)); assert.true(iterator.inclusive); iterator = range(BigInt(0), BigInt(5)); assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(-Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), Infinity), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), { step: Infinity }), TypeError); assert.throws(() => range({}, BigInt(1)), TypeError); assert.throws(() => range(BigInt(1), {}), TypeError); } }); core-js-3.33.2/tests/unit-global/esnext.iterator.reduce.js000066400000000000000000000026261451776221300235030ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#reduce', assert => { const { reduce } = Iterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Iterator.prototype, 'reduce'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1), 7, 'basic functionality'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b), 6, 'basic functionality, no init'); reduce.call(createIterator([2]), function (a, b, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 3, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); assert.same(counter, 0, 'counter'); }, 1); if (STRICT) { assert.throws(() => reduce.call(undefined, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(null, (a, b) => a + b, 0), TypeError); } assert.throws(() => reduce.call({}, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call([], (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.some.js000066400000000000000000000025121451776221300231710ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; QUnit.test('Iterator#some', assert => { const { some } = Iterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Iterator.prototype, 'some'); assert.true(some.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #1'); assert.false(some.call(createIterator([1, 2, 3]), it => typeof it == 'string'), 'basic functionality #2'); some.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.take.js000066400000000000000000000021751451776221300231570ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; QUnit.test('Iterator#take', assert => { const { take } = Iterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.name(take, 'take'); assert.looksNative(take); assert.nonEnumerable(Iterator.prototype, 'take'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 2).toArray(), [1, 2], 'basic functionality'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 1.5).toArray(), [1], 'float'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 4).toArray(), [1, 2, 3], 'big'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 0).toArray(), [], 'zero'); if (STRICT) { assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); } assert.throws(() => take.call({}, 1).next(), TypeError); assert.throws(() => take.call([], 1).next(), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => take.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); }); core-js-3.33.2/tests/unit-global/esnext.iterator.to-array.js000066400000000000000000000017461451776221300237740ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterable, createIterator } from '../helpers/helpers.js'; QUnit.test('Iterator#toArray', assert => { const { toArray } = Iterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.name(toArray, 'toArray'); assert.looksNative(toArray); assert.nonEnumerable(Iterator.prototype, 'toArray'); assert.arrayEqual([1, 2, 3].values().toArray(), [1, 2, 3]); assert.arrayEqual(new Set([1, 2, 3]).values().toArray(), [1, 2, 3]); assert.arrayEqual(Iterator.from('123').toArray(), ['1', '2', '3']); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3]); assert.arrayEqual(toArray.call(createIterator([1, 2, 3])), [1, 2, 3]); if (STRICT) { assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); } assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.iterator.to-async.js000066400000000000000000000013461451776221300237670ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Iterator#toAsync', assert => { const { toAsync } = Iterator.prototype; assert.isFunction(toAsync); assert.arity(toAsync, 0); assert.name(toAsync, 'toAsync'); assert.looksNative(toAsync); assert.nonEnumerable(Iterator.prototype, 'toAsync'); if (STRICT) { assert.throws(() => toAsync.call(undefined), TypeError); assert.throws(() => toAsync.call(null), TypeError); } return [1, 2, 3].values().toAsync().map(it => Promise.resolve(it)).toArray().then(it => { assert.arrayEqual(it, [1, 2, 3]); return new Set([1, 2, 3]).values().toAsync().map(el => Promise.resolve(el)).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3]); }); }); core-js-3.33.2/tests/unit-global/esnext.json.is-raw-json.js000066400000000000000000000014001451776221300235120ustar00rootroot00000000000000QUnit.test('JSON.rawJSON', assert => { const { isRawJSON, rawJSON } = JSON; const { freeze } = Object; assert.isFunction(isRawJSON); assert.arity(isRawJSON, 1); assert.name(isRawJSON, 'isRawJSON'); assert.looksNative(isRawJSON); assert.true(isRawJSON(rawJSON(1)), 'raw1'); assert.true(isRawJSON(rawJSON(null)), 'raw2'); assert.false(isRawJSON(freeze({ rawJSON: '123' })), 'fake'); assert.false(isRawJSON(undefined), 'undefined'); assert.false(isRawJSON(null), 'null'); assert.false(isRawJSON(1), 'number'); assert.false(isRawJSON('qwe'), 'string'); assert.false(isRawJSON(true), 'bool'); assert.false(isRawJSON(Symbol('JSON.isRawJSON test')), 'sym'); assert.false(isRawJSON({}), 'object'); assert.false(isRawJSON([]), 'array'); }); core-js-3.33.2/tests/unit-global/esnext.json.parse.js000066400000000000000000000334311451776221300224640ustar00rootroot00000000000000// Some tests adopted from Test262 project and governed by the BSD license. // Copyright (c) 2012 Ecma International. All rights reserved. /* eslint-disable unicorn/escape-case -- testing */ import { DESCRIPTORS, REDEFINABLE_PROTO } from '../helpers/constants.js'; QUnit.test('JSON.parse', assert => { const { parse } = JSON; const { defineProperty, hasOwn, keys } = Object; assert.isFunction(parse); assert.arity(parse, 2); assert.name(parse, 'parse'); assert.looksNative(parse); for (const [reviver, note] of [[undefined, 'without reviver'], [(key, value) => value, 'with reviver']]) { assert.throws(() => parse('12\t\r\n 34', reviver), SyntaxError, `15.12.1.1-0-1 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.throws(() => parse('\u000b1234', reviver), SyntaxError, `15.12.1.1-0-2 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u000c1234', reviver), SyntaxError, `15.12.1.1-0-3 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u00a01234', reviver), SyntaxError, `15.12.1.1-0-4 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u200b1234', reviver), SyntaxError, `15.12.1.1-0-5 ${ note }`); // should produce a syntax error assert.throws(() => parse('\ufeff1234', reviver), SyntaxError, `15.12.1.1-0-6 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u2028\u20291234', reviver), SyntaxError, `15.12.1.1-0-8 ${ note }`); // should produce a syntax error assert.notThrows(() => parse('\t\r \n{\t\r \n"property"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n"prop2"\t\r \n:\t\r \n' + '[\t\r \ntrue\t\r \n,\t\r \nnull\t\r \n,123.456\t\r \n]\t\r \n}\t\r \n', reviver), SyntaxError, `15.12.1.1-0-9 ${ note }`); // should JSON parse without error assert.same(parse('\t1234', reviver), 1234, `15.12.1.1-g1-1-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\t34', reviver), SyntaxError, `15.12.1.1-g1-1-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('\r1234', reviver), 1234, `15.12.1.1-g1-2-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\r34', reviver), SyntaxError, `15.12.1.1-g1-2-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('\n1234', reviver), 1234, `15.12.1.1-g1-3-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\n34', reviver), SyntaxError, `15.12.1.1-g1-3-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse(' 1234', reviver), 1234, `15.12.1.1-g1-4-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12 34', reviver), SyntaxError, `15.12.1.1-g1-4-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('"abc"', reviver), 'abc', `15.12.1.1-g2-1 ${ note }`); assert.throws(() => parse("'abc'", reviver), SyntaxError, `15.12.1.1-g2-2 ${ note }`); assert.throws(() => parse('\\u0022abc\\u0022', reviver), SyntaxError, `15.12.1.1-g2-3 ${ note }`); assert.throws(() => parse('"abc\'', reviver), SyntaxError, `15.12.1.1-g2-4 ${ note }`); assert.same(parse('""', reviver), '', `15.12.1.1-g2-5 ${ note }`); // invalid string characters should produce a syntax error assert.throws(() => parse('"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007"', reviver), SyntaxError, `15.12.1.1-g4-1 ${ note }`); assert.throws(() => parse('"\u0008\u0009\u000a\u000b\u000c\u000d\u000e\u000f"', reviver), SyntaxError, `15.12.1.1-g4-2 ${ note }`); assert.throws(() => parse('"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"', reviver), SyntaxError, `15.12.1.1-g4-3 ${ note }`); assert.throws(() => parse('"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"', reviver), SyntaxError, `15.12.1.1-g4-4 ${ note }`); assert.same(parse('"\\u0058"', reviver), 'X', `15.12.1.1-g5-1 ${ note }`); assert.throws(() => parse('"\\u005"', reviver), SyntaxError, `15.12.1.1-g5-2 ${ note }`); assert.throws(() => parse('"\\u0X50"', reviver), SyntaxError, `15.12.1.1-g5-3 ${ note }`); assert.same(parse('"\\/"', reviver), '/', `15.12.1.1-g6-1 ${ note }`); assert.same(parse('"\\\\"', reviver), '\\', `15.12.1.1-g6-2 ${ note }`); assert.same(parse('"\\b"', reviver), '\b', `15.12.1.1-g6-3 ${ note }`); assert.same(parse('"\\f"', reviver), '\f', `15.12.1.1-g6-4 ${ note }`); assert.same(parse('"\\n"', reviver), '\n', `15.12.1.1-g6-5 ${ note }`); assert.same(parse('"\\r"', reviver), '\r', `15.12.1.1-g6-6 ${ note }`); assert.same(parse('"\\t"', reviver), '\t', `15.12.1.1-g6-7 ${ note }`); const nullChars = [ '"\u0000"', '"\u0001"', '"\u0002"', '"\u0003"', '"\u0004"', '"\u0005"', '"\u0006"', '"\u0007"', '"\u0008"', '"\u0009"', '"\u000A"', '"\u000B"', '"\u000C"', '"\u000D"', '"\u000E"', '"\u000F"', '"\u0010"', '"\u0011"', '"\u0012"', '"\u0013"', '"\u0014"', '"\u0015"', '"\u0016"', '"\u0017"', '"\u0018"', '"\u0019"', '"\u001A"', '"\u001B"', '"\u001C"', '"\u001D"', '"\u001E"', '"\u001F"', ]; for (let i = 0; i < nullChars.length; i++) { assert.throws(() => parse(`{${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-1-${ i } ${ note }`); assert.throws(() => parse(`{${ nullChars[i] }name : "John" }`, reviver), SyntaxError, `15.12.2-2-2-${ i } ${ note }`); assert.throws(() => parse(`{name${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-3-${ i } ${ note }`); assert.throws(() => parse(`{${ nullChars[i] }name${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-4-${ i } ${ note }`); assert.throws(() => parse(`{na${ nullChars[i] }me : "John" }`, reviver), SyntaxError, `15.12.2-2-5-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-6-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] }John }`, reviver), SyntaxError, `15.12.2-2-7-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : John${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-8-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] }John${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-9-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : Jo${ nullChars[i] }hn }`, reviver), SyntaxError, `15.12.2-2-10-${ i } ${ note }`); } if (REDEFINABLE_PROTO) { // eslint-disable-next-line no-proto -- testing assert.same(parse('{ "__proto__": 1, "__proto__": 2 }', reviver).__proto__, 2, `duplicate proto ${ note }`); } assert.throws(() => parse('\u16801', reviver), SyntaxError, `15.12.1.1-0-7-1 ${ note }`); // invalid whitespace assert.throws(() => parse('\u180e1', reviver), SyntaxError, `15.12.1.1-0-7-2 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20001', reviver), SyntaxError, `15.12.1.1-0-7-3 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20011', reviver), SyntaxError, `15.12.1.1-0-7-4 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20021', reviver), SyntaxError, `15.12.1.1-0-7-5 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20031', reviver), SyntaxError, `15.12.1.1-0-7-6 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20041', reviver), SyntaxError, `15.12.1.1-0-7-7 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20051', reviver), SyntaxError, `15.12.1.1-0-7-8 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20061', reviver), SyntaxError, `15.12.1.1-0-7-9 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20071', reviver), SyntaxError, `15.12.1.1-0-7-10 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20081', reviver), SyntaxError, `15.12.1.1-0-7-11 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20091', reviver), SyntaxError, `15.12.1.1-0-7-12 ${ note }`); // invalid whitespace assert.throws(() => parse('\u200a1', reviver), SyntaxError, `15.12.1.1-0-7-13 ${ note }`); // invalid whitespace assert.throws(() => parse('\u202f1', reviver), SyntaxError, `15.12.1.1-0-7-14 ${ note }`); // invalid whitespace assert.throws(() => parse('\u205f1', reviver), SyntaxError, `15.12.1.1-0-7-15 ${ note }`); // invalid whitespace assert.throws(() => parse('\u30001', reviver), SyntaxError, `15.12.1.1-0-7-16 ${ note }`); // invalid whitespace assert.same(parse('-0', reviver), -0, `negative-zero-1 ${ note }`); assert.same(parse(' \n-0', reviver), -0, `negative-zero-2 ${ note }`); assert.same(parse('-0 \t', reviver), -0, `negative-zero-3 ${ note }`); assert.same(parse('\n\t -0\n ', reviver), -0, `negative-zero-4 ${ note }`); assert.same(parse(-0, reviver), 0, `negative-zero-5 ${ note }`); assert.throws(() => parse(undefined, reviver), SyntaxError, `undefined ${ note }`); assert.throws(() => parse(Symbol('JSON.parse test'), reviver), TypeError, `symbol ${ note }`); assert.same(parse(null, reviver), null, `null ${ note }`); assert.same(parse(false, reviver), false, `false ${ note }`); assert.same(parse(true, reviver), true, `true ${ note }`); assert.same(parse(0, reviver), 0, `0 ${ note }`); assert.same(parse(3.14, reviver), 3.14, `3.14 ${ note }`); assert.same(parse({ toString() { return '"string"'; }, valueOf() { return '"default_or_number"'; }, }, reviver), 'string', `text-object ${ note }`); assert.throws(() => parse({ toString: null, valueOf() { throw new EvalError('t262'); }, }, reviver), EvalError, `text-object-abrupt-1 ${ note }`); assert.throws(() => parse({ toString() { throw new EvalError('t262'); }, }, reviver), EvalError, `text-object-abrupt-2 ${ note }`); } // eslint-disable-next-line no-extend-native -- testing Array.prototype[1] = 3; const arr1 = parse('[1, 2]', function (key, value) { if (key === '0') delete this[1]; return value; }); delete Array.prototype[1]; assert.same(arr1[0], 1, 'reviver-array-get-prop-from-prototype-1'); assert.true(hasOwn(arr1, '1'), 'reviver-array-get-prop-from-prototype-2'); assert.same(arr1[1], 3, 'reviver-array-get-prop-from-prototype-3'); // eslint-disable-next-line no-extend-native -- testing Object.prototype.b = 3; const obj1 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') delete this.b; return value; }); delete Object.prototype.b; assert.same(obj1.a, 1, 'reviver-object-get-prop-from-prototype-1'); assert.true(hasOwn(obj1, 'b'), 'reviver-object-get-prop-from-prototype-2'); assert.same(obj1.b, 3, 'reviver-object-get-prop-from-prototype-3'); if (DESCRIPTORS) { const arr2 = parse('[1, 2]', function (key, value) { if (key === '0') defineProperty(this, '1', { configurable: false }); if (key === '1') return 22; return value; }); assert.same(arr2[0], 1, 'reviver-array-non-configurable-prop-create-1'); assert.same(arr2[1], 2, 'reviver-array-non-configurable-prop-create-2'); const arr3 = parse('[1, 2]', function (key, value) { if (key === '0') defineProperty(this, '1', { configurable: false }); if (key === '1') return; return value; }); assert.same(arr3[0], 1, 'reviver-array-non-configurable-prop-delete-1'); assert.true(hasOwn(arr3, '1'), 'reviver-array-non-configurable-prop-delete-2'); assert.same(arr3[1], 2, 'reviver-array-non-configurable-prop-delete-3'); const obj2 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') defineProperty(this, 'b', { configurable: false }); if (key === 'b') return 22; return value; }); assert.same(obj2.a, 1, 'reviver-object-non-configurable-prop-create-1'); assert.same(obj2.b, 2, 'reviver-object-non-configurable-prop-create-2'); const obj3 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') defineProperty(this, 'b', { configurable: false }); if (key === 'b') return; return value; }); assert.same(obj3.a, 1, 'reviver-object-non-configurable-prop-delete-1'); assert.true(hasOwn(obj3, 'b'), 'reviver-object-non-configurable-prop-delete-2'); assert.same(obj3.b, 2, 'reviver-object-non-configurable-prop-delete-3'); assert.throws(() => parse('[0,0]', function () { defineProperty(this, '1', { get: () => { throw new EvalError('t262'); } }); }), EvalError, 'reviver-get-name-err'); } assert.throws(() => parse('0', () => { throw new EvalError('t262'); }), EvalError, 'reviver-call-err'); // FF20- enumeration order issue if (keys({ k: 1, 2: 3 })[0] === '2') { const calls = []; parse('{"p1":0,"p2":0,"p1":0,"2":0,"1":0}', (name, val) => { calls.push(name); return val; }); // The empty string is the _rootName_ in JSON.parse assert.arrayEqual(calls, ['1', '2', 'p1', 'p2', ''], 'reviver-call-order'); } assert.throws(() => parse(), SyntaxError, 'no args'); }); QUnit.test('JSON.parse source access', assert => { const { parse } = JSON; const spy = (k, v, { source: $source }) => source = $source; let source; parse('1234', spy); assert.same(source, '1234', '1234'); parse('"1234"', spy); assert.same(source, '"1234"', '"1234"'); parse('null', spy); assert.same(source, 'null', 'null'); parse('true', spy); assert.same(source, 'true', 'true'); parse('false', spy); assert.same(source, 'false', 'false'); parse('{}', spy); assert.same(source, undefined, '{}'); parse('[]', spy); assert.same(source, undefined, '[]'); parse('9007199254740993', spy); assert.same(source, '9007199254740993', '9007199254740993'); }); core-js-3.33.2/tests/unit-global/esnext.json.raw-json.js000066400000000000000000000020631451776221300231070ustar00rootroot00000000000000import { FREEZING } from '../helpers/constants.js'; QUnit.test('JSON.rawJSON', assert => { const { rawJSON, stringify } = JSON; const { isFrozen, hasOwn } = Object; assert.isFunction(rawJSON); assert.arity(rawJSON, 1); assert.name(rawJSON, 'rawJSON'); assert.looksNative(rawJSON); const raw = rawJSON(1); assert.true(hasOwn(raw, 'rawJSON'), 'own rawJSON'); assert.same(raw.rawJSON, '1', 'is string 1'); if (FREEZING) assert.true(isFrozen(raw), 'frozen'); assert.same(stringify(rawJSON('"qwe"')), '"qwe"'); assert.same(stringify(rawJSON('null')), 'null'); assert.same(stringify(rawJSON('true')), 'true'); assert.same(stringify(rawJSON('9007199254740993')), '9007199254740993'); assert.same(stringify({ key: rawJSON('9007199254740993') }), '{"key":9007199254740993}'); assert.same(stringify([rawJSON('9007199254740993')]), '[9007199254740993]'); assert.throws(() => rawJSON('"qwe'), SyntaxError, 'invalid 1'); assert.throws(() => rawJSON({}), SyntaxError, 'invalid 2'); assert.throws(() => rawJSON(''), SyntaxError, 'invalid 3'); }); core-js-3.33.2/tests/unit-global/esnext.map.delete-all.js000066400000000000000000000021131451776221300231570ustar00rootroot00000000000000QUnit.test('Map#deleteAll', assert => { const { deleteAll } = Map.prototype; const { from } = Array; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(Map.prototype, 'deleteAll'); let set = new Map([[1, 2], [2, 3], [3, 4]]); assert.true(set.deleteAll(1, 2)); assert.deepEqual(from(set), [[3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.false(set.deleteAll(3, 4)); assert.deepEqual(from(set), [[1, 2], [2, 3]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.false(set.deleteAll(4, 5)); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.true(set.deleteAll()); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.emplace.js000066400000000000000000000036441451776221300225670ustar00rootroot00000000000000QUnit.test('Map#emplace', assert => { const { emplace } = Map.prototype; assert.isFunction(emplace); assert.arity(emplace, 2); assert.name(emplace, 'emplace'); assert.looksNative(emplace); assert.nonEnumerable(Map.prototype, 'emplace'); const map = new Map([['a', 2]]); let handler = { update(value, key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 'a', 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return value ** 2; }, insert() { assert.avoid(); }, }; assert.same(map.emplace('a', handler), 4, 'returns a correct value'); handler = { update() { assert.avoid(); }, insert(key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(key, 'b', 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return 3; }, }; assert.same(map.emplace('b', handler), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).emplace('b', { insert: () => 3 }), 3); assert.same(new Map([['a', 2]]).emplace('a', { update: value => value ** 2 }), 4); handler = { update() { /* empty */ }, insert() { /* empty */ } }; assert.throws(() => new Map().emplace('a'), TypeError); assert.throws(() => emplace.call({}, 'a', handler), TypeError); assert.throws(() => emplace.call([], 'a', handler), TypeError); assert.throws(() => emplace.call(undefined, 'a', handler), TypeError); assert.throws(() => emplace.call(null, 'a', handler), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.every.js000066400000000000000000000027371451776221300223150ustar00rootroot00000000000000QUnit.test('Map#every', assert => { const { every } = Map.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Map.prototype, 'every'); let map = new Map([[9, 1]]); const context = {}; map.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, 2], [2, 3]]); assert.true(map.every(it => typeof it == 'number')); assert.true(map.every(it => it < 4)); assert.false(map.every(it => it < 3)); assert.false(map.every(it => typeof it == 'string')); assert.true(map.every(function () { return +this === 1; }, 1)); let result = ''; map.every((value, key) => result += key); assert.same(result, '012'); assert.true(map.every((value, key, that) => that === map)); assert.throws(() => every.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.filter.js000066400000000000000000000025711451776221300224440ustar00rootroot00000000000000QUnit.test('Map#filter', assert => { const { filter } = Map.prototype; const { from } = Array; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Map.prototype, 'filter'); const map = new Map([[1, 2]]); const context = {}; map.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Map().filter(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).filter(it => typeof it == 'number')), [ ['a', 1], [1, 2], ['b', 3], [3, 4], [4, 5], ]); assert.throws(() => filter.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.find-key.js000066400000000000000000000022701451776221300226610ustar00rootroot00000000000000QUnit.test('Map#findKey', assert => { const { findKey } = Map.prototype; assert.isFunction(findKey); assert.arity(findKey, 1); assert.name(findKey, 'findKey'); assert.looksNative(findKey); assert.nonEnumerable(Map.prototype, 'findKey'); const set = new Map([[1, 2]]); const context = {}; set.findKey(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).findKey(it => it % 2), 2); assert.same(new Map().findKey(it => it === 42), undefined); assert.throws(() => findKey.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => findKey.call({}, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call([], () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.find.js000066400000000000000000000022101451776221300220650ustar00rootroot00000000000000QUnit.test('Map#find', assert => { const { find } = Map.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Map.prototype, 'find'); const set = new Map([[1, 2]]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).find(it => it % 2), 3); assert.same(new Map().find(it => it === 42), undefined); assert.throws(() => find.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.from.js000066400000000000000000000020151451776221300221130ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Map.from', assert => { const { from } = Map; const toArray = Array.from; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Map, 'from'); assert.true(Map.from() instanceof Map); assert.deepEqual(toArray(Map.from([])), []); assert.deepEqual(toArray(Map.from([[1, 2]])), [[1, 2]]); assert.deepEqual(toArray(Map.from([[1, 2], [2, 3], [1, 4]])), [[1, 4], [2, 3]]); assert.deepEqual(toArray(Map.from(createIterable([[1, 2], [2, 3], [1, 4]]))), [[1, 4], [2, 3]]); const pair = [1, 2]; const context = {}; Map.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([1, 2])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-global/esnext.map.group-by.js000066400000000000000000000015431451776221300227210ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Map.groupBy', assert => { const { groupBy } = Map; const toArray = Array.from; assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.looksNative(groupBy); assert.nonEnumerable(Map, 'groupBy'); assert.true(Map.groupBy([], it => it) instanceof Map); assert.deepEqual(toArray(groupBy([], it => it)), []); assert.deepEqual(toArray(groupBy([1, 2], it => it ** 2)), [[1, [1]], [4, [2]]]); assert.deepEqual(toArray(groupBy([1, 2, 1], it => it ** 2)), [[1, [1, 1]], [4, [2]]]); assert.deepEqual(toArray(groupBy(createIterable([1, 2]), it => it ** 2)), [[1, [1]], [4, [2]]]); const element = {}; groupBy([element], function (it, i) { assert.same(arguments.length, 2); assert.same(it, element); assert.same(i, 0); }); }); core-js-3.33.2/tests/unit-global/esnext.map.includes.js000066400000000000000000000016441451776221300227650ustar00rootroot00000000000000QUnit.test('Map#includes', assert => { const { includes } = Map.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.looksNative(includes); assert.nonEnumerable(Map.prototype, 'includes'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.true(map.includes(1)); assert.true(map.includes(-0)); assert.true(map.includes(0)); assert.true(map.includes(object)); assert.false(map.includes(4)); assert.false(map.includes(-0.5)); assert.false(map.includes({})); assert.true(map.includes(NaN)); assert.throws(() => includes.call(new Set(), 1), TypeError); assert.throws(() => includes.call({}, 1), TypeError); assert.throws(() => includes.call([], 1), TypeError); assert.throws(() => includes.call(undefined, 1), TypeError); assert.throws(() => includes.call(null, 1), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.key-by.js000066400000000000000000000014551451776221300223570ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Map.keyBy', assert => { const { keyBy } = Map; const toArray = Array.from; assert.isFunction(keyBy); assert.arity(keyBy, 2); assert.name(keyBy, 'keyBy'); assert.looksNative(keyBy); assert.nonEnumerable(Map, 'keyBy'); assert.true(Map.keyBy([], it => it) instanceof Map); assert.deepEqual(toArray(Map.keyBy([], it => it)), []); assert.deepEqual(toArray(Map.keyBy([1, 2], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy([1, 2, 1], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy(createIterable([1, 2]), it => it ** 2)), [[1, 1], [4, 2]]); const element = {}; Map.keyBy([element], it => assert.same(it, element)); // assert.throws(() => keyBy([1, 2], it => it)); }); core-js-3.33.2/tests/unit-global/esnext.map.key-of.js000066400000000000000000000016321451776221300223460ustar00rootroot00000000000000QUnit.test('Map#keyOf', assert => { const { keyOf } = Map.prototype; assert.isFunction(keyOf); assert.name(keyOf, 'keyOf'); assert.arity(keyOf, 1); assert.looksNative(keyOf); assert.nonEnumerable(Map.prototype, 'keyOf'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.same(map.keyOf(1), 1); assert.same(map.keyOf(-0), 4); assert.same(map.keyOf(0), 4); assert.same(map.keyOf(object), 5); assert.same(map.keyOf(4), undefined); assert.same(map.keyOf(-0.5), undefined); assert.same(map.keyOf({}), undefined); assert.same(map.keyOf(NaN), undefined); assert.throws(() => keyOf.call(new Set(), 1), TypeError); assert.throws(() => keyOf.call({}, 1), TypeError); assert.throws(() => keyOf.call([], 1), TypeError); assert.throws(() => keyOf.call(undefined, 1), TypeError); assert.throws(() => keyOf.call(null, 1), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.map-keys.js000066400000000000000000000027411451776221300227040ustar00rootroot00000000000000QUnit.test('Map#mapKeys', assert => { const { mapKeys } = Map.prototype; const { from } = Array; assert.isFunction(mapKeys); assert.arity(mapKeys, 1); assert.name(mapKeys, 'mapKeys'); assert.looksNative(mapKeys); assert.nonEnumerable(Map.prototype, 'mapKeys'); const map = new Map([[1, 2]]); const context = {}; map.mapKeys(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Map().mapKeys(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapKeys((value, key) => `${ key }${ value }`)), [ ['a1', 1], ['12', 2], ['b3', 3], ['2q', 'q'], ['c[object Object]', {}], ['34', 4], ['dtrue', true], ['45', 5], ]); assert.throws(() => mapKeys.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call([], () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.map-values.js000066400000000000000000000030031451776221300232200ustar00rootroot00000000000000QUnit.test('Map#mapValues', assert => { const { mapValues } = Map.prototype; const { from } = Array; assert.isFunction(mapValues); assert.arity(mapValues, 1); assert.name(mapValues, 'mapValues'); assert.looksNative(mapValues); assert.nonEnumerable(Map.prototype, 'mapValues'); const map = new Map([[1, 2]]); const context = {}; map.mapValues(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Map().mapValues(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapValues((value, key) => `${ key }${ value }`)), [ ['a', 'a1'], [1, '12'], ['b', 'b3'], [2, '2q'], ['c', 'c[object Object]'], [3, '34'], ['d', 'dtrue'], [4, '45'], ]); assert.throws(() => mapValues.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call([], () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.merge.js000066400000000000000000000017221451776221300222530ustar00rootroot00000000000000QUnit.test('Map#merge', assert => { const { merge } = Map.prototype; const { from } = Array; assert.isFunction(merge); assert.arity(merge, 1); assert.name(merge, 'merge'); assert.looksNative(merge); assert.nonEnumerable(Map.prototype, 'merge'); const map = new Map([[1, 2]]); const result = map.merge([[3, 4]]); assert.same(result, map); assert.true(result instanceof Map); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[5, 6]])), [[1, 2], [3, 4], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5], [5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([])), [[1, 2], [3, 4]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5]], [[5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.throws(() => merge.call({}, [[1, 2]]), TypeError); assert.throws(() => merge.call(undefined, [[1, 2]]), TypeError); assert.throws(() => merge.call(null, [[1, 2]]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.of.js000066400000000000000000000010441451776221300215550ustar00rootroot00000000000000QUnit.test('Map.of', assert => { const { of } = Map; const toArray = Array.from; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(Map, 'of'); assert.true(Map.of() instanceof Map); assert.deepEqual(toArray(Map.of([1, 2])), [[1, 2]]); assert.deepEqual(toArray(Map.of([1, 2], [2, 3], [1, 4])), [[1, 4], [2, 3]]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-global/esnext.map.reduce.js000066400000000000000000000036551451776221300224320ustar00rootroot00000000000000QUnit.test('Map#reduce', assert => { const { reduce } = Map.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Map.prototype, 'reduce'); const set = new Map([['a', 1]]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 'a', 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Map([ ['a', 1], ['b', 2], ]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 'b', 'correct start index without initial accumulator'); }); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((memo, value, key, s) => { s.delete('b'); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, 'ac', 'correct order #2'); assert.throws(() => reduce.call(new Set(), () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.some.js000066400000000000000000000027511451776221300221220ustar00rootroot00000000000000QUnit.test('Map#some', assert => { const { some } = Map.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Map.prototype, 'some'); let map = new Map([[9, 1]]); const context = {}; map.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, '2'], [2, 3]]); assert.true(map.some(it => typeof it == 'number')); assert.true(map.some(it => it < 3)); assert.false(map.some(it => it < 0)); assert.true(map.some(it => typeof it == 'string')); assert.false(map.some(function () { return +this !== 1; }, 1)); let result = ''; map.some((value, key) => { result += key; return false; }); assert.same(result, '012'); assert.true(map.some((value, key, that) => that === map)); assert.throws(() => some.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.update-or-insert.js000066400000000000000000000031661451776221300243620ustar00rootroot00000000000000QUnit.test('Map#updateOrInsert', assert => { const { updateOrInsert } = Map.prototype; assert.isFunction(updateOrInsert); assert.arity(updateOrInsert, 2); assert.looksNative(updateOrInsert); assert.nonEnumerable(Map.prototype, 'updateOrInsert'); const map = new Map([['a', 2]]); assert.same(map.updateOrInsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.updateOrInsert('b', value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).updateOrInsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).updateOrInsert('a', value => value ** 2), 4); assert.throws(() => new Map().updateOrInsert('a'), TypeError); assert.throws(() => updateOrInsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.update.js000066400000000000000000000035501451776221300224370ustar00rootroot00000000000000QUnit.test('Map#update', assert => { const { update } = Map.prototype; assert.isFunction(update); assert.arity(update, 2); assert.name(update, 'update'); assert.looksNative(update); assert.nonEnumerable(Map.prototype, 'update'); let map = new Map([[9, 2]]); assert.same(map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }), map, 'returns this'); assert.same(map.size, 1, 'correct size'); assert.same(map.get(9), 4, 'correct result'); map = new Map([[4, 5]]); map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }, function (key, that) { assert.same(arguments.length, 2, 'correct number of thunk arguments'); assert.same(key, 9, 'correct key in thunk'); assert.same(that, map, 'correct link to map in thunk'); return 2; }); assert.same(map.size, 2, 'correct size'); assert.same(map.get(4), 5, 'correct result #1'); assert.same(map.get(9), 4, 'correct result #2'); assert.throws(() => new Map([[9, 2]]).update(9), TypeError); assert.throws(() => new Map().update(9, () => { /* empty */ }), TypeError); assert.throws(() => update.call({}, () => { /* empty */ }), TypeError); assert.throws(() => update.call([], () => { /* empty */ }), TypeError); assert.throws(() => update.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => update.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.map.upsert.js000066400000000000000000000027761451776221300225100ustar00rootroot00000000000000QUnit.test('Map#upsert', assert => { const { upsert } = Map.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.looksNative(upsert); assert.nonEnumerable(Map.prototype, 'upsert'); const map = new Map([['a', 2]]); assert.same(map.upsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert('b', value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).upsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).upsert('a', value => value ** 2), 4); assert.throws(() => new Map().upsert('a'), TypeError); assert.throws(() => upsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.math.clamp.js000066400000000000000000000017331451776221300224260ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.clamp', assert => { const { clamp } = Math; assert.isFunction(clamp); assert.name(clamp, 'clamp'); assert.arity(clamp, 3); assert.looksNative(clamp); assert.nonEnumerable(Math, 'clamp'); assert.same(clamp(2, 4, 6), 4); assert.same(clamp(4, 2, 6), 4); assert.same(clamp(6, 2, 4), 4); const checker1 = createConversionChecker(2); const checker2 = createConversionChecker(4); const checker3 = createConversionChecker(5); assert.same(clamp(checker1, checker2, checker3), 4, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.deg-per-rad.js000066400000000000000000000005251451776221300234170ustar00rootroot00000000000000QUnit.test('Math.DEG_PER_RAD', assert => { const { DEG_PER_RAD, PI } = Math; assert.true('DEG_PER_RAD' in Math, 'DEG_PER_RAD in Math'); assert.nonEnumerable(Math, 'DEG_PER_RAD'); assert.nonConfigurable(Number, 'DEG_PER_RAD'); assert.nonWritable(Number, 'DEG_PER_RAD'); assert.same(DEG_PER_RAD, PI / 180, 'Is Math.PI / 180'); }); core-js-3.33.2/tests/unit-global/esnext.math.degrees.js000066400000000000000000000012321451776221300227420ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.degrees', assert => { const { degrees, PI } = Math; assert.isFunction(degrees); assert.name(degrees, 'degrees'); assert.arity(degrees, 1); assert.looksNative(degrees); assert.nonEnumerable(Math, 'degrees'); assert.same(degrees(0), 0); assert.same(degrees(PI / 2), 90); assert.same(degrees(PI), 180); assert.same(degrees(3 * PI / 2), 270); const checker = createConversionChecker(3 * PI / 2); assert.same(degrees(checker), 270, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.f16round.js000066400000000000000000000035021451776221300227720ustar00rootroot00000000000000// some asserts based on https://github.com/petamoriken/float16/blob/master/test/f16round.js import { createConversionChecker } from '../helpers/helpers.js'; const { MAX_VALUE, MIN_VALUE } = Number; QUnit.test('Math.f16round', assert => { const { f16round } = Math; assert.isFunction(f16round); assert.name(f16round, 'f16round'); assert.arity(f16round, 1); assert.looksNative(f16round); assert.nonEnumerable(Math, 'f16round'); assert.same(f16round(), NaN); assert.same(f16round(undefined), NaN); assert.same(f16round(NaN), NaN); assert.same(f16round(null), 0); assert.same(f16round(0), 0); assert.same(f16round(-0), -0); assert.same(f16round(MIN_VALUE), 0); assert.same(f16round(-MIN_VALUE), -0); assert.same(f16round(Infinity), Infinity); assert.same(f16round(-Infinity), -Infinity); assert.same(f16round(MAX_VALUE), Infinity); assert.same(f16round(-MAX_VALUE), -Infinity); const MAX_FLOAT16 = 65504; const MIN_FLOAT16 = 2 ** -24; assert.same(f16round(MAX_FLOAT16), MAX_FLOAT16); assert.same(f16round(-MAX_FLOAT16), -MAX_FLOAT16); assert.same(f16round(MIN_FLOAT16), MIN_FLOAT16); assert.same(f16round(-MIN_FLOAT16), -MIN_FLOAT16); assert.same(f16round(MIN_FLOAT16 / 2), 0); assert.same(f16round(-MIN_FLOAT16 / 2), -0); assert.same(f16round(2.980232238769531911744490042422139897126953655970282852649688720703125e-8), MIN_FLOAT16); assert.same(f16round(-2.980232238769531911744490042422139897126953655970282852649688720703125e-8), -MIN_FLOAT16); assert.same(f16round(1.337), 1.3369140625); assert.same(f16round(0.499994), 0.5); assert.same(f16round(7.9999999), 8); const checker = createConversionChecker(1.1); assert.same(f16round(checker), 1.099609375, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.fscale.js000066400000000000000000000027731451776221300225740ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.fscale', assert => { const { fscale, fround, PI } = Math; assert.isFunction(fscale); assert.name(fscale, 'fscale'); assert.arity(fscale, 5); assert.looksNative(fscale); assert.nonEnumerable(Math, 'fscale'); assert.same(fscale(3, 1, 2, 1, 2), 3); assert.same(fscale(0, 3, 5, 8, 10), 5); assert.same(fscale(1, 1, 1, 1, 1), NaN); assert.same(fscale(-1, -1, -1, -1, -1), NaN); assert.same(fscale(3, 1, 2, 1, PI), fround((3 - 1) * (PI - 1) / (2 - 1) + 1)); const checker1 = createConversionChecker(3); const checker2 = createConversionChecker(1); const checker3 = createConversionChecker(2); const checker4 = createConversionChecker(1); const checker5 = createConversionChecker(2); assert.same(fscale(checker1, checker2, checker3, checker4, checker5), 3, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); assert.same(checker5.$valueOf, 1, 'checker5 valueOf calls'); assert.same(checker5.$toString, 0, 'checker5 toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.iaddh.js000066400000000000000000000006471451776221300224060ustar00rootroot00000000000000QUnit.test('Math.iaddh', assert => { const { iaddh } = Math; assert.isFunction(iaddh); assert.name(iaddh, 'iaddh'); assert.arity(iaddh, 4); assert.looksNative(iaddh); assert.nonEnumerable(Math, 'iaddh'); assert.same(iaddh(0, 2, 1, 0), 2); assert.same(iaddh(0, 4, 1, 1), 5); assert.same(iaddh(2, 4, 1, 1), 5); assert.same(iaddh(0xFFFFFFFF, 4, 1, 1), 6); assert.same(iaddh(1, 4, 0xFFFFFFFF, 1), 6); }); core-js-3.33.2/tests/unit-global/esnext.math.imulh.js000066400000000000000000000005551451776221300224510ustar00rootroot00000000000000QUnit.test('Math.imulh', assert => { const { imulh } = Math; assert.isFunction(imulh); assert.name(imulh, 'imulh'); assert.arity(imulh, 2); assert.looksNative(imulh); assert.nonEnumerable(Math, 'imulh'); assert.same(imulh(0xFFFFFFFF, 7), -1); assert.same(imulh(0xFFFFFFF, 77), 4); assert.same(imulh(1, 7), 0); assert.same(imulh(-1, 7), -1); }); core-js-3.33.2/tests/unit-global/esnext.math.isubh.js000066400000000000000000000006471451776221300224470ustar00rootroot00000000000000QUnit.test('Math.isubh', assert => { const { isubh } = Math; assert.isFunction(isubh); assert.name(isubh, 'isubh'); assert.arity(isubh, 4); assert.looksNative(isubh); assert.nonEnumerable(Math, 'isubh'); assert.same(isubh(0, 2, 1, 0), 1); assert.same(isubh(0, 4, 1, 1), 2); assert.same(isubh(2, 4, 1, 1), 3); assert.same(isubh(0xFFFFFFFF, 4, 1, 1), 3); assert.same(isubh(1, 4, 0xFFFFFFFF, 1), 2); }); core-js-3.33.2/tests/unit-global/esnext.math.rad-per-deg.js000066400000000000000000000005251451776221300234170ustar00rootroot00000000000000QUnit.test('Math.RAD_PER_DEG', assert => { const { RAD_PER_DEG, PI } = Math; assert.true('RAD_PER_DEG' in Math, 'RAD_PER_DEG in Math'); assert.nonEnumerable(Math, 'RAD_PER_DEG'); assert.nonConfigurable(Number, 'RAD_PER_DEG'); assert.nonWritable(Number, 'RAD_PER_DEG'); assert.same(RAD_PER_DEG, 180 / PI, 'Is 180 / Math.PI'); }); core-js-3.33.2/tests/unit-global/esnext.math.radians.js000066400000000000000000000012321451776221300227450ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.radians', assert => { const { radians, PI } = Math; assert.isFunction(radians); assert.name(radians, 'radians'); assert.arity(radians, 1); assert.looksNative(radians); assert.nonEnumerable(Math, 'radians'); assert.same(radians(0), 0); assert.same(radians(90), PI / 2); assert.same(radians(180), PI); assert.same(radians(270), 3 * PI / 2); const checker = createConversionChecker(270); assert.same(radians(checker), 3 * PI / 2, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.scale.js000066400000000000000000000026211451776221300224160ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.scale', assert => { const { scale } = Math; assert.isFunction(scale); assert.name(scale, 'scale'); assert.arity(scale, 5); assert.looksNative(scale); assert.nonEnumerable(Math, 'scale'); assert.same(scale(3, 1, 2, 1, 2), 3); assert.same(scale(0, 3, 5, 8, 10), 5); assert.same(scale(1, 1, 1, 1, 1), NaN); assert.same(scale(-1, -1, -1, -1, -1), NaN); const checker1 = createConversionChecker(3); const checker2 = createConversionChecker(1); const checker3 = createConversionChecker(2); const checker4 = createConversionChecker(1); const checker5 = createConversionChecker(2); assert.same(scale(checker1, checker2, checker3, checker4, checker5), 3, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); assert.same(checker5.$valueOf, 1, 'checker5 valueOf calls'); assert.same(checker5.$toString, 0, 'checker5 toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.seeded-prng.js000066400000000000000000000025261451776221300235300ustar00rootroot00000000000000QUnit.test('Math.seededPRNG', assert => { const { seededPRNG } = Math; assert.isFunction(seededPRNG); assert.name(seededPRNG, 'seededPRNG'); assert.arity(seededPRNG, 1); assert.looksNative(seededPRNG); assert.nonEnumerable(Math, 'seededPRNG'); for (const gen of [seededPRNG({ seed: 42 }), seededPRNG({ seed: 42 })]) { assert.deepEqual(gen.next(), { value: 0.16461519912315087, done: false }); assert.deepEqual(gen.next(), { value: 0.2203933906000046, done: false }); assert.deepEqual(gen.next(), { value: 0.8249682894209105, done: false }); assert.deepEqual(gen.next(), { value: 0.10750079537509083, done: false }); assert.deepEqual(gen.next(), { value: 0.004673248161257476, done: false }); } for (const gen of [seededPRNG({ seed: 43 }), seededPRNG({ seed: 43 })]) { assert.deepEqual(gen.next(), { value: 0.1923438591811283, done: false }); assert.deepEqual(gen.next(), { value: 0.7896811578326683, done: false }); assert.deepEqual(gen.next(), { value: 0.9518230761883996, done: false }); assert.deepEqual(gen.next(), { value: 0.1414634102410296, done: false }); assert.deepEqual(gen.next(), { value: 0.7379838030207752, done: false }); } assert.throws(() => seededPRNG(), TypeError); assert.throws(() => seededPRNG(5), TypeError); assert.throws(() => seededPRNG({ seed: null }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.math.signbit.js000066400000000000000000000015321451776221300227660ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('Math.signbit', assert => { const { signbit } = Math; assert.isFunction(signbit); assert.name(signbit, 'signbit'); assert.arity(signbit, 1); assert.looksNative(signbit); assert.nonEnumerable(Math, 'signbit'); assert.false(signbit(NaN)); assert.false(signbit()); assert.true(signbit(-0)); assert.false(signbit(0)); assert.false(signbit(Infinity)); assert.true(signbit(-Infinity)); assert.false(signbit(13510798882111488)); assert.true(signbit(-13510798882111488)); assert.false(signbit(42.5)); assert.true(signbit(-42.5)); const checker = createConversionChecker(-13510798882111488); assert.true(signbit(checker), 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-global/esnext.math.umulh.js000066400000000000000000000005531451776221300224630ustar00rootroot00000000000000QUnit.test('Math.umulh', assert => { const { umulh } = Math; assert.isFunction(umulh); assert.name(umulh, 'umulh'); assert.arity(umulh, 2); assert.looksNative(umulh); assert.nonEnumerable(Math, 'umulh'); assert.same(umulh(0xFFFFFFFF, 7), 6); assert.same(umulh(0xFFFFFFF, 77), 4); assert.same(umulh(1, 7), 0); assert.same(umulh(-1, 7), 6); }); core-js-3.33.2/tests/unit-global/esnext.number.from-string.js000066400000000000000000000045041451776221300241370ustar00rootroot00000000000000QUnit.test('Number.fromString', assert => { const { fromString } = Number; assert.isFunction(fromString); assert.name(fromString, 'fromString'); assert.arity(fromString, 2); assert.looksNative(fromString); assert.nonEnumerable(Number, 'fromString'); assert.throws(() => fromString(undefined), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(Object('10')), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(''), SyntaxError, 'Empty string'); assert.same(fromString('-10', 2), -2, 'Works with negative numbers'); assert.throws(() => fromString('-'), SyntaxError, '-'); assert.same(fromString('10'), 10, 'Default radix is 10 #1'); assert.same(fromString('10', undefined), 10, 'Default radix is 10 #2'); for (let radix = 2; radix <= 36; ++radix) { assert.same(fromString('10', radix), radix, `Radix ${ radix }`); } assert.throws(() => fromString('10', -4294967294), RangeError, 'Radix uses ToInteger #1'); assert.same(fromString('10', 2.5), 2, 'Radix uses ToInteger #2'); assert.same(fromString('42'), 42); assert.same(fromString('42', 10), 42); assert.same(fromString('3.14159', 10), 3.14159); assert.same(fromString('-100.11', 2), -4.75); assert.same(fromString('202.1', 3), 20.333333333333332); assert.same(fromString('0'), 0); assert.same(fromString('0', 2), 0); assert.same(fromString('-0'), -0); assert.same(fromString('-0', 2), -0); assert.throws(() => fromString('0xc0ffee'), SyntaxError); assert.throws(() => fromString('0o755'), SyntaxError); assert.throws(() => fromString('0b00101010'), SyntaxError); assert.throws(() => fromString('C0FFEE', 16), SyntaxError); assert.same(fromString('c0ffee', 16), 12648430); assert.same(fromString('755', 8), 493); assert.throws(() => fromString(''), SyntaxError); assert.throws(() => fromString(' '), SyntaxError); assert.throws(() => fromString(' 1'), SyntaxError); assert.throws(() => fromString(' \n '), SyntaxError); assert.throws(() => fromString('x'), SyntaxError); assert.throws(() => fromString('1234', 0), RangeError); assert.throws(() => fromString('1234', 1), RangeError); assert.throws(() => fromString('1234', 37), RangeError); assert.throws(() => fromString('010'), SyntaxError); assert.throws(() => fromString('1_000_000_000'), SyntaxError); }); core-js-3.33.2/tests/unit-global/esnext.number.range.js000066400000000000000000000043701451776221300227650ustar00rootroot00000000000000QUnit.test('Number.range', assert => { const { range } = Number; const { from } = Array; assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); assert.looksNative(range); assert.nonEnumerable(Number, 'range'); let iterator = range(1, 2); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(-1, 5)), [-1, 0, 1, 2, 3, 4]); assert.deepEqual(from(range(-5, 1)), [-5, -4, -3, -2, -1, 0]); assert.deepEqual( from(range(0, 1, 0.1)), [0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8, 0.9], ); assert.deepEqual( from(range(2 ** 53 - 1, 2 ** 53, { inclusive: true })), [9007199254740991, 9007199254740992], ); assert.deepEqual(from(range(0, 0)), []); assert.deepEqual(from(range(0, -5, 1)), []); assert.deepEqual(from(range(NaN, 0)), []); assert.deepEqual(from(range(0, NaN)), []); assert.deepEqual(from(range(NaN, NaN)), []); assert.deepEqual(from(range(0, 0, { step: NaN })), []); assert.deepEqual(from(range(0, 5, NaN)), []); iterator = range(1, 3); assert.deepEqual(iterator.start, 1); assert.deepEqual(iterator.end, 3); assert.deepEqual(iterator.step, 1); assert.false(iterator.inclusive); iterator = range(-1, -3, { inclusive: true }); assert.deepEqual(iterator.start, -1); assert.deepEqual(iterator.end, -3); assert.same(iterator.step, -1); assert.true(iterator.inclusive); iterator = range(-1, -3, { step: 4, inclusive() { /* empty */ } }); assert.same(iterator.start, -1); assert.same(iterator.end, -3); assert.same(iterator.step, 4); assert.true(iterator.inclusive); iterator = range(0, 5); assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, 10, 0), RangeError); assert.throws(() => range(-Infinity, 10, 0), RangeError); assert.throws(() => range(0, 10, Infinity), RangeError); assert.throws(() => range(0, 10, { step: Infinity }), RangeError); assert.throws(() => range({}, 1), TypeError); assert.throws(() => range(1, {}), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.object.group-by.js000066400000000000000000000015661451776221300234170ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Object.groupBy', assert => { const { groupBy, getPrototypeOf, entries } = Object; assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.looksNative(groupBy); assert.nonEnumerable(Object, 'groupBy'); assert.same(getPrototypeOf(groupBy([], it => it)), null); assert.deepEqual(entries(groupBy([], it => it)), []); assert.deepEqual(entries(groupBy([1, 2], it => it ** 2)), [['1', [1]], ['4', [2]]]); assert.deepEqual(entries(groupBy([1, 2, 1], it => it ** 2)), [['1', [1, 1]], ['4', [2]]]); assert.deepEqual(entries(groupBy(createIterable([1, 2]), it => it ** 2)), [['1', [1]], ['4', [2]]]); const element = {}; groupBy([element], function (it, i) { assert.same(arguments.length, 2); assert.same(it, element); assert.same(i, 0); }); }); core-js-3.33.2/tests/unit-global/esnext.object.iterate-entries.js000066400000000000000000000014231451776221300247470ustar00rootroot00000000000000QUnit.test('Object.iterateEntries', assert => { const { iterateEntries } = Object; assert.isFunction(iterateEntries); assert.name(iterateEntries, 'iterateEntries'); assert.arity(iterateEntries, 1); assert.looksNative(iterateEntries); assert.nonEnumerable(Object, 'iterateEntries'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateEntries(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 1], done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: ['e', 3], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-global/esnext.object.iterate-keys.js000066400000000000000000000013561451776221300242560ustar00rootroot00000000000000QUnit.test('Object.iterateKeys', assert => { const { iterateKeys } = Object; assert.isFunction(iterateKeys); assert.name(iterateKeys, 'iterateKeys'); assert.arity(iterateKeys, 1); assert.looksNative(iterateKeys); assert.nonEnumerable(Object, 'iterateKeys'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateKeys(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-global/esnext.object.iterate-values.js000066400000000000000000000013741451776221300246020ustar00rootroot00000000000000QUnit.test('Object.iterateValues', assert => { const { iterateValues } = Object; assert.isFunction(iterateValues); assert.name(iterateValues, 'iterateValues'); assert.arity(iterateValues, 1); assert.looksNative(iterateValues); assert.nonEnumerable(Object, 'iterateValues'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateValues(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 3, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-global/esnext.observable.constructor.js000066400000000000000000000034701451776221300251120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('Observable', assert => { assert.isFunction(Observable); assert.arity(Observable, 1); assert.name(Observable, 'Observable'); assert.looksNative(Observable); assert.throws(() => Observable(() => { /* empty */ }), 'throws w/o `new`'); const observable = new Observable(function (subscriptionObserver) { assert.same(typeof subscriptionObserver, 'object', 'Subscription observer is object'); assert.same(subscriptionObserver.constructor, Object); const { next, error, complete } = subscriptionObserver; assert.isFunction(next); assert.isFunction(error); assert.isFunction(complete); assert.arity(next, 1); assert.arity(error, 1); assert.arity(complete, 0); if (STRICT) { assert.same(this, undefined, 'correct executor context'); } }); observable.subscribe({}); assert.true(observable instanceof Observable); }); QUnit.test('Observable#subscribe', assert => { assert.isFunction(Observable.prototype.subscribe); assert.arity(Observable.prototype.subscribe, 1); assert.name(Observable.prototype.subscribe, 'subscribe'); assert.looksNative(Observable.prototype.subscribe); const subscription = new Observable(() => { /* empty */ }).subscribe({}); assert.same(typeof subscription, 'object', 'Subscription is object'); assert.same(subscription.constructor, Object); assert.isFunction(subscription.unsubscribe); assert.arity(subscription.unsubscribe, 0); }); QUnit.test('Observable#constructor', assert => { assert.same(Observable.prototype.constructor, Observable); }); QUnit.test('Observable#@@observable', assert => { assert.isFunction(Observable.prototype[Symbol.observable]); const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); core-js-3.33.2/tests/unit-global/esnext.observable.from.js000066400000000000000000000003071451776221300234640ustar00rootroot00000000000000QUnit.test('Observable.from', assert => { assert.isFunction(Observable.from); assert.arity(Observable.from, 1); assert.name(Observable.from, 'from'); assert.looksNative(Observable.from); }); core-js-3.33.2/tests/unit-global/esnext.observable.of.js000066400000000000000000000002731451776221300231270ustar00rootroot00000000000000QUnit.test('Observable.of', assert => { assert.isFunction(Observable.of); assert.arity(Observable.of, 0); assert.name(Observable.of, 'of'); assert.looksNative(Observable.of); }); core-js-3.33.2/tests/unit-global/esnext.promise.try.js000066400000000000000000000011651451776221300226740ustar00rootroot00000000000000QUnit.test('Promise.try', assert => { assert.isFunction(Promise.try); assert.arity(Promise.try, 1); assert.looksNative(Promise.try); assert.nonEnumerable(Promise, 'try'); assert.true(Promise.try(() => 42) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.try, resolved', assert => { return Promise.try(() => 42).then(it => { assert.same(it, 42, 'resolved with a correct value'); }); }); QUnit.test('Promise.try, rejected', assert => { return Promise.try(() => { throw new Error(); }).then(() => { assert.avoid(); }, () => { assert.required('rejected as expected'); }); }); core-js-3.33.2/tests/unit-global/esnext.promise.with-resolvers.js000066400000000000000000000033341451776221300250530ustar00rootroot00000000000000const { getPrototypeOf } = Object; QUnit.test('Promise.withResolvers', assert => { const { withResolvers } = Promise; assert.isFunction(withResolvers); assert.arity(withResolvers, 0); assert.name(withResolvers, 'withResolvers'); assert.nonEnumerable(Promise, 'withResolvers'); assert.looksNative(withResolvers); const d1 = Promise.withResolvers(); assert.same(getPrototypeOf(d1), Object.prototype, 'proto is Object.prototype'); assert.true(d1.promise instanceof Promise, 'promise is promise'); assert.isFunction(d1.resolve, 'resolve is function'); assert.isFunction(d1.reject, 'reject is function'); const promise = {}; const resolve = () => { /* empty */ }; let reject = () => { /* empty */ }; function P(exec) { exec(resolve, reject); return promise; } const d2 = withResolvers.call(P); assert.same(d2.promise, promise, 'promise is promise #2'); assert.same(d2.resolve, resolve, 'resolve is resolve #2'); assert.same(d2.reject, reject, 'reject is reject #2'); reject = {}; assert.throws(() => withResolvers.call(P), TypeError, 'broken resolver'); assert.throws(() => withResolvers.call({}), TypeError, 'broken constructor #1'); assert.throws(() => withResolvers.call(null), TypeError, 'broken constructor #2'); }); QUnit.test('Promise.withResolvers, resolve', assert => { const d = Promise.withResolvers(); d.resolve(42); return d.promise.then(it => { assert.same(it, 42, 'resolved as expected'); }, () => { assert.avoid(); }); }); QUnit.test('Promise.withResolvers, reject', assert => { const d = Promise.withResolvers(); d.reject(42); return d.promise.then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejected as expected'); }); }); core-js-3.33.2/tests/unit-global/esnext.reflect.define-metadata.js000066400000000000000000000010241451776221300250260ustar00rootroot00000000000000QUnit.test('Reflect.defineMetadata', assert => { const { defineMetadata } = Reflect; assert.isFunction(defineMetadata); assert.arity(defineMetadata, 3); assert.name(defineMetadata, 'defineMetadata'); assert.looksNative(defineMetadata); assert.nonEnumerable(Reflect, 'defineMetadata'); assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); assert.same(defineMetadata('key', 'value', {}, undefined), undefined); assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); }); core-js-3.33.2/tests/unit-global/esnext.reflect.delete-metadata.js000066400000000000000000000016571451776221300250520ustar00rootroot00000000000000QUnit.test('Reflect.deleteMetadata', assert => { const { defineMetadata, hasOwnMetadata, deleteMetadata } = Reflect; const { create } = Object; assert.isFunction(deleteMetadata); assert.arity(deleteMetadata, 2); assert.name(deleteMetadata, 'deleteMetadata'); assert.looksNative(deleteMetadata); assert.nonEnumerable(Reflect, 'deleteMetadata'); assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); assert.false(deleteMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(deleteMetadata('key', object, undefined)); const prototype = {}; defineMetadata('key', 'value', prototype, undefined); assert.false(deleteMetadata('key', create(prototype), undefined)); object = {}; defineMetadata('key', 'value', object, undefined); deleteMetadata('key', object, undefined); assert.false(hasOwnMetadata('key', object, undefined)); }); core-js-3.33.2/tests/unit-global/esnext.reflect.get-metadata-keys.js000066400000000000000000000045601451776221300253340ustar00rootroot00000000000000QUnit.test('Reflect.getMetadataKeys', assert => { const { defineMetadata, getMetadataKeys } = Reflect; const { create } = Object; assert.isFunction(getMetadataKeys); assert.arity(getMetadataKeys, 1); assert.name(getMetadataKeys, 'getMetadataKeys'); assert.looksNative(getMetadataKeys); assert.nonEnumerable(Reflect, 'getMetadataKeys'); assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); object = {}; assert.deepEqual(getMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); }); core-js-3.33.2/tests/unit-global/esnext.reflect.get-metadata.js000066400000000000000000000021251451776221300243560ustar00rootroot00000000000000QUnit.test('Reflect.getMetadata', assert => { const { defineMetadata, getMetadata } = Reflect; const { create } = Object; assert.isFunction(getMetadata); assert.arity(getMetadata, 2); assert.name(getMetadata, 'getMetadata'); assert.looksNative(getMetadata); assert.nonEnumerable(Reflect, 'getMetadata'); assert.throws(() => getMetadata('key', undefined, undefined), TypeError); assert.same(getMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getMetadata('key', object, undefined), 'value'); assert.same(getMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); }); core-js-3.33.2/tests/unit-global/esnext.reflect.get-own-matadata.js000066400000000000000000000022061451776221300251530ustar00rootroot00000000000000QUnit.test('Reflect.getOwnMetadata', assert => { const { defineMetadata, getOwnMetadata } = Reflect; const { create } = Object; assert.isFunction(getOwnMetadata); assert.arity(getOwnMetadata, 2); assert.name(getOwnMetadata, 'getOwnMetadata'); assert.looksNative(getOwnMetadata); assert.nonEnumerable(Reflect, 'getOwnMetadata'); assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); assert.same(getOwnMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getOwnMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getOwnMetadata('key', object, undefined), undefined); assert.same(getOwnMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getOwnMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getOwnMetadata('key', object, 'name'), undefined); }); core-js-3.33.2/tests/unit-global/esnext.reflect.get-own-metadata-keys.js000066400000000000000000000046221451776221300261340ustar00rootroot00000000000000QUnit.test('Reflect.getOwnMetadataKeys', assert => { const { defineMetadata, getOwnMetadataKeys } = Reflect; const { create } = Object; assert.isFunction(getOwnMetadataKeys); assert.arity(getOwnMetadataKeys, 1); assert.name(getOwnMetadataKeys, 'getOwnMetadataKeys'); assert.looksNative(getOwnMetadataKeys); assert.nonEnumerable(Reflect, 'getOwnMetadataKeys'); assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getOwnMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), []); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); }); core-js-3.33.2/tests/unit-global/esnext.reflect.has-metadata.js000066400000000000000000000020351451776221300243520ustar00rootroot00000000000000QUnit.test('Reflect.hasMetadata', assert => { const { defineMetadata, hasMetadata } = Reflect; const { create } = Object; assert.isFunction(hasMetadata); assert.arity(hasMetadata, 2); assert.name(hasMetadata, 'hasMetadata'); assert.looksNative(hasMetadata); assert.nonEnumerable(Reflect, 'hasMetadata'); assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); assert.false(hasMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(hasMetadata('key', object, undefined)); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.true(hasMetadata('key', object, undefined)); assert.false(hasMetadata('key', {}, 'name')); object = {}; defineMetadata('key', 'value', object, 'name'); assert.true(hasMetadata('key', object, 'name')); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.true(hasMetadata('key', object, 'name')); }); core-js-3.33.2/tests/unit-global/esnext.reflect.has-own-metadata.js000066400000000000000000000021141451776221300251510ustar00rootroot00000000000000QUnit.test('Reflect.hasOwnMetadata', assert => { const { defineMetadata, hasOwnMetadata } = Reflect; const { create } = Object; assert.isFunction(hasOwnMetadata); assert.arity(hasOwnMetadata, 2); assert.name(hasOwnMetadata, 'hasOwnMetadata'); assert.looksNative(hasOwnMetadata); assert.nonEnumerable(Reflect, 'hasOwnMetadata'); assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); assert.false(hasOwnMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(hasOwnMetadata('key', object, undefined)); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.false(hasOwnMetadata('key', object, undefined)); assert.false(hasOwnMetadata('key', {}, 'name')); object = {}; defineMetadata('key', 'value', object, 'name'); assert.true(hasOwnMetadata('key', object, 'name')); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.false(hasOwnMetadata('key', object, 'name')); }); core-js-3.33.2/tests/unit-global/esnext.reflect.metadata.js000066400000000000000000000012061451776221300236000ustar00rootroot00000000000000QUnit.test('Reflect.metadata', assert => { const { metadata, hasOwnMetadata } = Reflect; assert.isFunction(metadata); assert.arity(metadata, 2); assert.name(metadata, 'metadata'); assert.looksNative(metadata); assert.isFunction(metadata('key', 'value')); assert.nonEnumerable(Reflect, 'metadata'); const decorator = metadata('key', 'value'); assert.throws(() => decorator(undefined, 'name'), TypeError); let target = function () { /* empty */ }; decorator(target); assert.true(hasOwnMetadata('key', target, undefined)); target = {}; decorator(target, 'name'); assert.true(hasOwnMetadata('key', target, 'name')); }); core-js-3.33.2/tests/unit-global/esnext.regexp.escape.js000066400000000000000000000017741451776221300231400ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('RegExp.escape', assert => { const { escape } = RegExp; assert.isFunction(escape); assert.arity(escape, 1); assert.name(escape, 'escape'); assert.looksNative(escape); assert.nonEnumerable(RegExp, 'escape'); assert.same(escape('10$'), '\\x310\\$', '10$'); assert.same(escape('abcdefg_123456'), 'abcdefg_123456', 'abcdefg_123456'); assert.same( escape('(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`'), '\\(\\)\\{\\}\\[\\]\\|\\,\\.\\?\\*\\+\\-\\^\\$\\=\\<\\>\\\\\\/\\#\\&\\!\\%\\:\\;\\@\\~\\\'\\"\\`', '(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`', ); const checker = createConversionChecker('10$'); assert.same(escape(checker), '\\x310\\$', 'checker result'); assert.same(checker.$valueOf, 0, 'checker valueOf calls'); assert.same(checker.$toString, 1, 'checker toString calls'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => escape(Symbol('thrower')), TypeError, 'throws on symbol'); } }); core-js-3.33.2/tests/unit-global/esnext.set.add-all.js000066400000000000000000000014561451776221300224740ustar00rootroot00000000000000QUnit.test('Set#addAll', assert => { const { addAll } = Set.prototype; const { from } = Array; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.looksNative(addAll); assert.nonEnumerable(Set.prototype, 'addAll'); const set = new Set([1]); assert.same(set.addAll(2), set); assert.deepEqual(from(new Set([1, 2, 3]).addAll(4, 5)), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).addAll(3, 4)), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).addAll()), [1, 2, 3]); assert.throws(() => addAll.call({ add() { /* empty */ } }, 1, 2, 3)); assert.throws(() => addAll.call({}, 1, 2, 3), TypeError); assert.throws(() => addAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => addAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.delete-all.js000066400000000000000000000017421451776221300232040ustar00rootroot00000000000000QUnit.test('Set#deleteAll', assert => { const { deleteAll } = Set.prototype; const { from } = Array; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(Set.prototype, 'deleteAll'); let set = new Set([1, 2, 3]); assert.true(set.deleteAll(1, 2)); assert.deepEqual(from(set), [3]); set = new Set([1, 2, 3]); assert.false(set.deleteAll(3, 4)); assert.deepEqual(from(set), [1, 2]); set = new Set([1, 2, 3]); assert.false(set.deleteAll(4, 5)); assert.deepEqual(from(set), [1, 2, 3]); set = new Set([1, 2, 3]); assert.true(set.deleteAll()); assert.deepEqual(from(set), [1, 2, 3]); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.difference.js000066400000000000000000000025041451776221300232630ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#difference', assert => { const { difference } = Set.prototype; const { from } = Array; assert.isFunction(difference); assert.arity(difference, 1); assert.name(difference, 'difference'); assert.looksNative(difference); assert.nonEnumerable(Set.prototype, 'difference'); const set = new Set([1]); assert.notSame(set.difference(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).difference(new Set([4, 5]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference(new Set([3, 4]))), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createSetLike([4, 5]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createSetLike([3, 4]))), [1, 2]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).difference([4, 5])), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference([3, 4])), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createIterable([3, 4]))), [1, 2]); assert.throws(() => new Set([1, 2, 3]).difference(), TypeError); assert.throws(() => difference.call({}, [1, 2, 3]), TypeError); assert.throws(() => difference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => difference.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.every.js000066400000000000000000000024461451776221300223300ustar00rootroot00000000000000QUnit.test('Set#every', assert => { const { every } = Set.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Set.prototype, 'every'); const set = new Set([1]); const context = {}; set.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set([1, 2, 3]).every(it => typeof it == 'number')); assert.false(new Set(['1', '2', '3']).some(it => typeof it == 'number')); assert.false(new Set([1, '2', 3]).every(it => typeof it == 'number')); assert.true(new Set().every(it => typeof it == 'number')); assert.throws(() => every.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.filter.js000066400000000000000000000023511451776221300224560ustar00rootroot00000000000000QUnit.test('Set#filter', assert => { const { filter } = Set.prototype; const { from } = Array; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Set.prototype, 'filter'); const set = new Set([1]); const context = {}; set.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set().filter(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3, 'q', {}, 4, true, 5]).filter(it => typeof it == 'number')), [1, 2, 3, 4, 5]); assert.throws(() => filter.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.find.js000066400000000000000000000021641451776221300221130ustar00rootroot00000000000000QUnit.test('Set#find', assert => { const { find } = Set.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Set.prototype, 'find'); const set = new Set([1]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([2, 3, 4]).find(it => it % 2), 3); assert.same(new Set().find(it => it === 42), undefined); assert.throws(() => find.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.from.js000066400000000000000000000017011451776221300221320ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('Set.from', assert => { const { from } = Set; const toArray = Array.from; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Set, 'from'); assert.true(Set.from() instanceof Set); assert.deepEqual(toArray(Set.from([])), []); assert.deepEqual(toArray(Set.from([1])), [1]); assert.deepEqual(toArray(Set.from([1, 2, 3, 2, 1])), [1, 2, 3]); assert.deepEqual(toArray(Set.from(createIterable([1, 2, 3, 2, 1]))), [1, 2, 3]); const context = {}; Set.from([1], function (element, index) { assert.same(element, 1); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from(1)); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-global/esnext.set.intersection.js000066400000000000000000000036141451776221300237020ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#intersection', assert => { const { intersection } = Set.prototype; const { from } = Array; assert.isFunction(intersection); assert.arity(intersection, 1); assert.name(intersection, 'intersection'); assert.looksNative(intersection); assert.nonEnumerable(Set.prototype, 'intersection'); const set = new Set([1]); assert.notSame(set.intersection(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([4, 5]))), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([2, 3, 4]))), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([4, 5]))), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([2, 3, 4]))), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2]))), [3, 2]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2, 1]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2, 1, 0]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2]))), [3, 2]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2, 1]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2, 1, 0]))), [1, 2, 3]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).intersection([4, 5])), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection([2, 3, 4])), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createIterable([2, 3, 4]))), [2, 3]); assert.throws(() => new Set([1, 2, 3]).intersection(), TypeError); assert.throws(() => intersection.call({}, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.is-disjoint-from.js000066400000000000000000000030771451776221300243740ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#isDisjointFrom', assert => { const { isDisjointFrom } = Set.prototype; assert.isFunction(isDisjointFrom); assert.arity(isDisjointFrom, 1); assert.name(isDisjointFrom, 'isDisjointFrom'); assert.looksNative(isDisjointFrom); assert.nonEnumerable(Set.prototype, 'isDisjointFrom'); assert.true(new Set([1]).isDisjointFrom(new Set([2]))); assert.false(new Set([1]).isDisjointFrom(new Set([1]))); assert.true(new Set([1, 2, 3]).isDisjointFrom(new Set([4, 5, 6]))); assert.false(new Set([1, 2, 3]).isDisjointFrom(new Set([5, 4, 3]))); assert.true(new Set([1]).isDisjointFrom(createSetLike([2]))); assert.false(new Set([1]).isDisjointFrom(createSetLike([1]))); assert.true(new Set([1, 2, 3]).isDisjointFrom(createSetLike([4, 5, 6]))); assert.false(new Set([1, 2, 3]).isDisjointFrom(createSetLike([5, 4, 3]))); // TODO: drop from core-js@4 assert.true(new Set([1]).isDisjointFrom([2])); assert.false(new Set([1]).isDisjointFrom([1])); assert.true(new Set([1, 2, 3]).isDisjointFrom([4, 5, 6])); assert.false(new Set([1, 2, 3]).isDisjointFrom([5, 4, 3])); assert.true(new Set([1]).isDisjointFrom(createIterable([2]))); assert.false(new Set([1]).isDisjointFrom(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isDisjointFrom(), TypeError); assert.throws(() => isDisjointFrom.call({}, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.is-subset-of.js000066400000000000000000000030421451776221300235070ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#isSubsetOf', assert => { const { isSubsetOf } = Set.prototype; assert.isFunction(isSubsetOf); assert.arity(isSubsetOf, 1); assert.name(isSubsetOf, 'isSubsetOf'); assert.looksNative(isSubsetOf); assert.nonEnumerable(Set.prototype, 'isSubsetOf'); assert.true(new Set([1]).isSubsetOf(new Set([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(new Set([2, 3, 4]))); assert.true(new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2, 1]))); assert.false(new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2]))); assert.true(new Set([1]).isSubsetOf(createSetLike([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(createSetLike([2, 3, 4]))); assert.true(new Set([1, 2, 3]).isSubsetOf(createSetLike([5, 4, 3, 2, 1]))); assert.false(new Set([1, 2, 3]).isSubsetOf(createSetLike([5, 4, 3, 2]))); // TODO: drop from core-js@4 assert.true(new Set([1]).isSubsetOf([1, 2, 3])); assert.false(new Set([1]).isSubsetOf([2, 3, 4])); assert.true(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2, 1])); assert.false(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2])); assert.true(new Set([1]).isSubsetOf(createIterable([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(createIterable([2, 3, 4]))); assert.throws(() => new Set([1, 2, 3]).isSubsetOf(), TypeError); assert.throws(() => isSubsetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.is-superset-of.js000066400000000000000000000031261451776221300240570ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#isSupersetOf', assert => { const { isSupersetOf } = Set.prototype; assert.isFunction(isSupersetOf); assert.arity(isSupersetOf, 1); assert.name(isSupersetOf, 'isSupersetOf'); assert.looksNative(isSupersetOf); assert.nonEnumerable(Set.prototype, 'isSupersetOf'); assert.true(new Set([1, 2, 3]).isSupersetOf(new Set([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(new Set([1]))); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf(new Set([1, 2, 3]))); assert.false(new Set([5, 4, 3, 2]).isSupersetOf(new Set([1, 2, 3]))); assert.true(new Set([1, 2, 3]).isSupersetOf(createSetLike([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(createSetLike([1]))); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf(createSetLike([1, 2, 3]))); assert.false(new Set([5, 4, 3, 2]).isSupersetOf(createSetLike([1, 2, 3]))); // TODO: drop from core-js@4 assert.true(new Set([1, 2, 3]).isSupersetOf([1])); assert.false(new Set([2, 3, 4]).isSupersetOf([1])); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf([1, 2, 3])); assert.false(new Set([5, 4, 3, 2]).isSupersetOf([1, 2, 3])); assert.true(new Set([1, 2, 3]).isSupersetOf(createIterable([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isSupersetOf(), TypeError); assert.throws(() => isSupersetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.join.js000066400000000000000000000013441451776221300221310ustar00rootroot00000000000000/* eslint-disable unicorn/require-array-join-separator -- required for testing */ QUnit.test('Set#join', assert => { const { join } = Set.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.looksNative(join); assert.nonEnumerable(Set.prototype, 'join'); assert.same(new Set([1, 2, 3]).join(), '1,2,3'); assert.same(new Set([1, 2, 3]).join(undefined), '1,2,3'); assert.same(new Set([1, 2, 3]).join('|'), '1|2|3'); assert.throws(() => join.call(new Map()), TypeError); assert.throws(() => join.call({}), TypeError); assert.throws(() => join.call([]), TypeError); assert.throws(() => join.call(undefined), TypeError); assert.throws(() => join.call(null), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.map.js000066400000000000000000000023301451776221300217430ustar00rootroot00000000000000QUnit.test('Set#map', assert => { const { map } = Set.prototype; const { from } = Array; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Set.prototype, 'map'); const set = new Set([1]); const context = {}; set.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set().map(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it ** 2)), [1, 4, 9]); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it % 2)), [1, 0]); assert.throws(() => map.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.of.js000066400000000000000000000010121451776221300215660ustar00rootroot00000000000000QUnit.test('Set.of', assert => { const { of } = Set; const toArray = Array.from; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(Set, 'of'); assert.true(Set.of() instanceof Set); assert.deepEqual(toArray(Set.of(1)), [1]); assert.deepEqual(toArray(Set.of(1, 2, 3, 2, 1)), [1, 2, 3]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-global/esnext.set.reduce.js000066400000000000000000000034231451776221300224410ustar00rootroot00000000000000QUnit.test('Set#reduce', assert => { const { reduce } = Set.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Set.prototype, 'reduce'); const set = new Set([1]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Set([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Set([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 2, 'correct start index without initial accumulator'); }); assert.same(new Set([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Set([1, 2, 3]).reduce((memo, value, key, s) => { s.delete(2); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, '13', 'correct order #2'); assert.throws(() => reduce.call(new Map(), () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.some.js000066400000000000000000000024251451776221300221360ustar00rootroot00000000000000QUnit.test('Set#some', assert => { const { some } = Set.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Set.prototype, 'some'); const set = new Set([1]); const context = {}; set.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set([1, 2, 3]).some(it => typeof it == 'number')); assert.false(new Set(['1', '2', '3']).some(it => typeof it == 'number')); assert.true(new Set([1, '2', 3]).some(it => typeof it == 'number')); assert.false(new Set().some(it => typeof it == 'number')); assert.throws(() => some.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.symmetric-difference.js000066400000000000000000000032011451776221300252700ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#symmetricDifference', assert => { const { symmetricDifference } = Set.prototype; const { from } = Array; assert.isFunction(symmetricDifference); assert.arity(symmetricDifference, 1); assert.name(symmetricDifference, 'symmetricDifference'); assert.looksNative(symmetricDifference); assert.nonEnumerable(Set.prototype, 'symmetricDifference'); const set = new Set([1]); assert.notSame(set.symmetricDifference(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(new Set([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(new Set([3, 4]))), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createSetLike([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createSetLike([3, 4]))), [1, 2, 4]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([3, 4])), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([3, 4]))), [1, 2, 4]); assert.throws(() => new Set([1, 2, 3]).symmetricDifference(), TypeError); assert.throws(() => symmetricDifference.call({}, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.set.union.js000066400000000000000000000024121451776221300223170ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; QUnit.test('Set#union', assert => { const { union } = Set.prototype; const { from } = Array; assert.isFunction(union); assert.arity(union, 1); assert.name(union, 'union'); assert.looksNative(union); assert.nonEnumerable(Set.prototype, 'union'); const set = new Set([1]); assert.notSame(set.union(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).union(new Set([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union(new Set([3, 4]))), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createSetLike([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union(createSetLike([3, 4]))), [1, 2, 3, 4]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).union([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union([3, 4])), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createIterable([3, 4]))), [1, 2, 3, 4]); assert.throws(() => new Set([1, 2, 3]).union(), TypeError); assert.throws(() => union.call({}, [1, 2, 3]), TypeError); assert.throws(() => union.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => union.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.string.at.js000066400000000000000000000102351451776221300223100ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; QUnit.test('String#at', assert => { const { at } = String.prototype; assert.isFunction(at); assert.arity(at, 1); assert.name(at, 'at'); assert.looksNative(at); assert.nonEnumerable(String.prototype, 'at'); // String that starts with a BMP symbol // assert.same('abc\uD834\uDF06def'.at(-Infinity), ''); // assert.same('abc\uD834\uDF06def'.at(-1), ''); assert.same('abc\uD834\uDF06def'.at(-0), 'a'); assert.same('abc\uD834\uDF06def'.at(+0), 'a'); assert.same('abc\uD834\uDF06def'.at(1), 'b'); assert.same('abc\uD834\uDF06def'.at(3), '\uD834\uDF06'); assert.same('abc\uD834\uDF06def'.at(4), '\uDF06'); assert.same('abc\uD834\uDF06def'.at(5), 'd'); // assert.same('abc\uD834\uDF06def'.at(42), ''); // assert.same('abc\uD834\uDF06def'.at(Infinity), ''); assert.same('abc\uD834\uDF06def'.at(null), 'a'); assert.same('abc\uD834\uDF06def'.at(undefined), 'a'); assert.same('abc\uD834\uDF06def'.at(), 'a'); assert.same('abc\uD834\uDF06def'.at(false), 'a'); assert.same('abc\uD834\uDF06def'.at(NaN), 'a'); assert.same('abc\uD834\uDF06def'.at(''), 'a'); assert.same('abc\uD834\uDF06def'.at('_'), 'a'); assert.same('abc\uD834\uDF06def'.at('1'), 'b'); assert.same('abc\uD834\uDF06def'.at([]), 'a'); assert.same('abc\uD834\uDF06def'.at({}), 'a'); assert.same('abc\uD834\uDF06def'.at(-0.9), 'a'); assert.same('abc\uD834\uDF06def'.at(1.9), 'b'); assert.same('abc\uD834\uDF06def'.at(7.9), 'f'); // assert.same('abc\uD834\uDF06def'.at(2 ** 32), ''); // String that starts with an astral symbol // assert.same('\uD834\uDF06def'.at(-Infinity), ''); // assert.same('\uD834\uDF06def'.at(-1), ''); assert.same('\uD834\uDF06def'.at(-0), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(0), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(1), '\uDF06'); assert.same('\uD834\uDF06def'.at(2), 'd'); assert.same('\uD834\uDF06def'.at(3), 'e'); assert.same('\uD834\uDF06def'.at(4), 'f'); // assert.same('\uD834\uDF06def'.at(42), ''); // assert.same('\uD834\uDF06def'.at(Infinity), ''); assert.same('\uD834\uDF06def'.at(null), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(undefined), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(false), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(NaN), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at(''), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at('_'), '\uD834\uDF06'); assert.same('\uD834\uDF06def'.at('1'), '\uDF06'); // Lone high surrogates // assert.same('\uD834abc'.at(-Infinity), ''); // assert.same('\uD834abc'.at(-1), ''); assert.same('\uD834abc'.at(-0), '\uD834'); assert.same('\uD834abc'.at(0), '\uD834'); assert.same('\uD834abc'.at(1), 'a'); // assert.same('\uD834abc'.at(42), ''); // assert.same('\uD834abc'.at(Infinity), ''); assert.same('\uD834abc'.at(null), '\uD834'); assert.same('\uD834abc'.at(undefined), '\uD834'); assert.same('\uD834abc'.at(), '\uD834'); assert.same('\uD834abc'.at(false), '\uD834'); assert.same('\uD834abc'.at(NaN), '\uD834'); assert.same('\uD834abc'.at(''), '\uD834'); assert.same('\uD834abc'.at('_'), '\uD834'); assert.same('\uD834abc'.at('1'), 'a'); // Lone low surrogates // assert.same('\uDF06abc'.at(-Infinity), ''); // assert.same('\uDF06abc'.at(-1), ''); assert.same('\uDF06abc'.at(-0), '\uDF06'); assert.same('\uDF06abc'.at(0), '\uDF06'); assert.same('\uDF06abc'.at(1), 'a'); // assert.same('\uDF06abc'.at(42), ''); // assert.same('\uDF06abc'.at(Infinity), ''); assert.same('\uDF06abc'.at(null), '\uDF06'); assert.same('\uDF06abc'.at(undefined), '\uDF06'); assert.same('\uDF06abc'.at(), '\uDF06'); assert.same('\uDF06abc'.at(false), '\uDF06'); assert.same('\uDF06abc'.at(NaN), '\uDF06'); assert.same('\uDF06abc'.at(''), '\uDF06'); assert.same('\uDF06abc'.at('_'), '\uDF06'); assert.same('\uDF06abc'.at('1'), 'a'); assert.same(at.call(42, 0), '4'); assert.same(at.call(42, 1), '2'); assert.same(at.call({ toString() { return 'abc'; }, }, 2), 'c'); if (STRICT) { assert.throws(() => at.call(null, 0), TypeError); assert.throws(() => at.call(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-global/esnext.string.code-points.js000066400000000000000000000027621451776221300241360ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#codePoints', assert => { const { codePoints } = String.prototype; assert.isFunction(codePoints); assert.arity(codePoints, 0); assert.name(codePoints, 'codePoints'); assert.looksNative(codePoints); assert.nonEnumerable(String.prototype, 'codePoints'); let iterator = 'qwe'.codePoints(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'String Iterator'); assert.same(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: { codePoint: 113, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 119, position: 1 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 101, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); iterator = '𠮷𠮷𠮷'.codePoints(); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 4 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.throws(() => codePoints.call(Symbol()), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-global/esnext.string.cooked.js000066400000000000000000000015461451776221300231550ustar00rootroot00000000000000QUnit.test('String.cooked', assert => { const { cooked } = String; assert.isFunction(cooked); assert.arity(cooked, 1); assert.name(cooked, 'cooked'); assert.looksNative(cooked); assert.nonEnumerable(String, 'cooked'); assert.same(cooked(['Hi\\n', '!'], 'Bob'), 'Hi\\nBob!', 'template is an array'); assert.same(cooked('test', 0, 1, 2), 't0e1s2t', 'template is a string'); assert.same(cooked('test', 0), 't0est', 'lacks substituting'); assert.same(cooked([]), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('cooked test'); assert.throws(() => cooked([symbol]), TypeError, 'throws on symbol #1'); assert.throws(() => cooked('test', symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => cooked([undefined]), TypeError); assert.throws(() => cooked(null), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.string.dedent.js000066400000000000000000000030731451776221300231510ustar00rootroot00000000000000const freeze = Object.freeze || Object; QUnit.test('String.dedent', assert => { const { cooked, dedent } = String; assert.isFunction(dedent); assert.arity(dedent, 1); assert.name(dedent, 'dedent'); assert.looksNative(dedent); assert.nonEnumerable(String, 'dedent'); assert.same(dedent` qwe asd zxc `, 'qwe\nasd\nzxc', '#1'); assert.same(dedent` qwe asd zxc `, ' qwe\nasd\n zxc', '#2'); assert.same(dedent` qwe asd ${ ' zxc' } `, ' qwe\n asd\n zxc', '#3'); assert.same(dedent({ raw: freeze(['\n qwe\n ']) }), 'qwe', '#4'); assert.same(dedent({ raw: freeze(['\n qwe', '\n ']) }, 1), 'qwe1', '#5'); assert.same(dedent(cooked)` qwe asd zxc `, ' qwe\nasd\n zxc', '#6'); const tag = (it => it)` abc `; assert.same(dedent(tag), dedent(tag), '#7'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => dedent({ raw: freeze(['\n', Symbol('dedent test'), '\n']) }), TypeError, 'throws on symbol'); } assert.throws(() => dedent([]), TypeError, '[]'); assert.throws(() => dedent(['qwe']), TypeError, '[qwe]'); assert.throws(() => dedent({ raw: freeze([]) }), TypeError, 'empty tpl'); assert.throws(() => dedent({ raw: freeze(['qwe']) }), TypeError, 'wrong start'); assert.throws(() => dedent({ raw: freeze(['\n', 'qwe']) }), TypeError, 'wrong start'); assert.throws(() => dedent({ raw: freeze(['\n qwe', 5, '\n ']) }, 1, 2), TypeError, 'wrong part'); assert.throws(() => dedent([undefined]), TypeError); assert.throws(() => dedent(null), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.suppressed-error.constructor.js000066400000000000000000000041161451776221300263100ustar00rootroot00000000000000QUnit.test('SuppressedError', assert => { assert.isFunction(SuppressedError); assert.arity(SuppressedError, 3); assert.name(SuppressedError, 'SuppressedError'); assert.looksNative(SuppressedError); assert.true(new SuppressedError() instanceof SuppressedError); assert.true(new SuppressedError() instanceof Error); assert.true(SuppressedError() instanceof SuppressedError); assert.true(SuppressedError() instanceof Error); assert.same(SuppressedError().error, undefined); assert.same(SuppressedError().suppressed, undefined); assert.same(SuppressedError().message, ''); assert.same(SuppressedError().cause, undefined); assert.false('cause' in SuppressedError()); assert.same(SuppressedError().name, 'SuppressedError'); assert.same(new SuppressedError().error, undefined); assert.same(new SuppressedError().suppressed, undefined); assert.same(new SuppressedError().message, ''); assert.same(new SuppressedError().cause, undefined); assert.false('cause' in new SuppressedError()); assert.same(new SuppressedError().name, 'SuppressedError'); const error1 = SuppressedError(1, 2, 3, { cause: 4 }); assert.same(error1.error, 1); assert.same(error1.suppressed, 2); assert.same(error1.message, '3'); assert.same(error1.cause, undefined); assert.false('cause' in error1); assert.same(error1.name, 'SuppressedError'); const error2 = new SuppressedError(1, 2, 3, { cause: 4 }); assert.same(error2.error, 1); assert.same(error2.suppressed, 2); assert.same(error2.message, '3'); assert.same(error2.cause, undefined); assert.false('cause' in error2); assert.same(error2.name, 'SuppressedError'); assert.throws(() => SuppressedError(1, 2, Symbol('SuppressedError constructor test')), 'throws on symbol as a message'); assert.same(({}).toString.call(SuppressedError()), '[object Error]', 'Object#toString'); assert.same(SuppressedError.prototype.constructor, SuppressedError, 'prototype constructor'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(SuppressedError.prototype.hasOwnProperty('cause'), 'prototype has not cause'); }); core-js-3.33.2/tests/unit-global/esnext.symbol.async-dispose.js000066400000000000000000000012501451776221300244610ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.asyncDispose', assert => { assert.true('asyncDispose' in Symbol, 'Symbol.asyncDispose available'); assert.true(Object(Symbol.asyncDispose) instanceof Symbol, 'Symbol.asyncDispose is symbol'); // Node 20.4.0 add `Symbol.asyncDispose`, but with incorrect descriptor // https://github.com/nodejs/node/issues/48699 if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncDispose'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.dispose.js000066400000000000000000000012051451776221300233460ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.dispose', assert => { assert.true('dispose' in Symbol, 'Symbol.dispose available'); assert.true(Object(Symbol.dispose) instanceof Symbol, 'Symbol.dispose is symbol'); // Node 20.4.0 add `Symbol.dispose`, but with incorrect descriptor // https://github.com/nodejs/node/issues/48699 if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'dispose'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.is-registered-symbol.js000066400000000000000000000022641451776221300257570ustar00rootroot00000000000000QUnit.test('Symbol.isRegisteredSymbol', assert => { const { isRegisteredSymbol } = Symbol; assert.isFunction(isRegisteredSymbol, 'Symbol.isRegisteredSymbol is function'); assert.nonEnumerable(Symbol, 'isRegisteredSymbol'); assert.arity(isRegisteredSymbol, 1, 'Symbol.isRegisteredSymbol arity is 1'); assert.name(isRegisteredSymbol, 'isRegisteredSymbol', 'Symbol.isRegisteredSymbol.name is "isRegisteredSymbol"'); assert.looksNative(isRegisteredSymbol, 'isRegisteredSymbol looks like native'); assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered'); assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered, boxed'); const symbol = Symbol('Symbol.isRegisteredSymbol test'); assert.false(isRegisteredSymbol(symbol), 'non-registered'); assert.false(isRegisteredSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isRegisteredSymbol(1), '1'); assert.false(isRegisteredSymbol(true), 'true'); assert.false(isRegisteredSymbol('1'), 'string'); assert.false(isRegisteredSymbol(null), 'null'); assert.false(isRegisteredSymbol(), 'undefined'); assert.false(isRegisteredSymbol({}), 'object'); assert.false(isRegisteredSymbol([]), 'array'); }); core-js-3.33.2/tests/unit-global/esnext.symbol.is-registered.js000066400000000000000000000020521451776221300244470ustar00rootroot00000000000000QUnit.test('Symbol.isRegistered', assert => { const { isRegistered } = Symbol; assert.isFunction(isRegistered, 'Symbol.isRegistered is function'); assert.nonEnumerable(Symbol, 'isRegistered'); assert.arity(isRegistered, 1, 'Symbol.isRegistered arity is 1'); assert.name(isRegistered, 'isRegisteredSymbol', 'Symbol.isRegistered.name is "isRegisteredSymbol"'); assert.looksNative(isRegistered, 'isRegistered looks like native'); assert.true(isRegistered(Symbol.for('foo')), 'registered'); assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered, boxed'); const symbol = Symbol('Symbol.isRegistered test'); assert.false(isRegistered(symbol), 'non-registered'); assert.false(isRegistered(Object(symbol)), 'non-registered, boxed'); assert.false(isRegistered(1), '1'); assert.false(isRegistered(true), 'true'); assert.false(isRegistered('1'), 'string'); assert.false(isRegistered(null), 'null'); assert.false(isRegistered(), 'undefined'); assert.false(isRegistered({}), 'object'); assert.false(isRegistered([]), 'array'); }); core-js-3.33.2/tests/unit-global/esnext.symbol.is-well-known-symbol.js000066400000000000000000000024701451776221300257160ustar00rootroot00000000000000QUnit.test('Symbol.isWellKnownSymbol', assert => { const { isWellKnownSymbol } = Symbol; assert.isFunction(isWellKnownSymbol, 'Symbol.isWellKnownSymbol is function'); assert.nonEnumerable(Symbol, 'isWellKnownSymbol'); assert.arity(isWellKnownSymbol, 1, 'Symbol.isWellKnownSymbol arity is 1'); assert.name(isWellKnownSymbol, 'isWellKnownSymbol', 'Symbol.isWellKnownSymbol.name is "isWellKnownSymbol"'); assert.looksNative(isWellKnownSymbol, 'isWellKnownSymbol looks like native'); assert.true(isWellKnownSymbol(Symbol.iterator), 'registered-1'); assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnownSymbol(Symbol.patternMatch), 'registered-3'); assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4, boxed'); const symbol = Symbol('Symbol.isWellKnownSymbol test'); assert.false(isWellKnownSymbol(symbol), 'non-registered'); assert.false(isWellKnownSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnownSymbol(1), '1'); assert.false(isWellKnownSymbol(true), 'true'); assert.false(isWellKnownSymbol('1'), 'string'); assert.false(isWellKnownSymbol(null), 'null'); assert.false(isWellKnownSymbol(), 'undefined'); assert.false(isWellKnownSymbol({}), 'object'); assert.false(isWellKnownSymbol([]), 'array'); }); core-js-3.33.2/tests/unit-global/esnext.symbol.is-well-known.js000066400000000000000000000022421451776221300244100ustar00rootroot00000000000000QUnit.test('Symbol.isWellKnown', assert => { const { isWellKnown } = Symbol; assert.isFunction(isWellKnown, 'Symbol.isWellKnown is function'); assert.nonEnumerable(Symbol, 'isWellKnown'); assert.arity(isWellKnown, 1, 'Symbol.isWellKnown arity is 1'); assert.name(isWellKnown, 'isWellKnownSymbol', 'Symbol.isWellKnown.name is "isWellKnownSymbol"'); assert.looksNative(isWellKnown, 'isWellKnown looks like native'); assert.true(isWellKnown(Symbol.iterator), 'registered-1'); assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnown(Symbol.patternMatch), 'registered-3'); assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4, boxed'); const symbol = Symbol('Symbol.isWellKnown test'); assert.false(isWellKnown(symbol), 'non-registered'); assert.false(isWellKnown(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnown(1), '1'); assert.false(isWellKnown(true), 'true'); assert.false(isWellKnown('1'), 'string'); assert.false(isWellKnown(null), 'null'); assert.false(isWellKnown(), 'undefined'); assert.false(isWellKnown({}), 'object'); assert.false(isWellKnown([]), 'array'); }); core-js-3.33.2/tests/unit-global/esnext.symbol.matcher.js000066400000000000000000000010721451776221300233250ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.matcher', assert => { assert.true('matcher' in Symbol, 'Symbol.matcher available'); assert.nonEnumerable(Symbol, 'matcher'); assert.true(Object(Symbol.matcher) instanceof Symbol, 'Symbol.matcher is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'matcher'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.metadata-key.js000066400000000000000000000011261451776221300242500ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.metadataKey', assert => { assert.true('metadataKey' in Symbol, 'Symbol.metadataKey available'); assert.nonEnumerable(Symbol, 'metadataKey'); assert.true(Object(Symbol.metadataKey) instanceof Symbol, 'Symbol.metadataKey is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'metadataKey'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.metadata.js000066400000000000000000000011011451776221300234530ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.metadata', assert => { assert.true('metadata' in Symbol, 'Symbol.metadata available'); assert.nonEnumerable(Symbol, 'metadata'); assert.true(Object(Symbol.metadata) instanceof Symbol, 'Symbol.metadata is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'metadata'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.observable.js000066400000000000000000000011171451776221300240260ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.observable', assert => { assert.true('observable' in Symbol, 'Symbol.observable available'); assert.nonEnumerable(Symbol, 'observable'); assert.true(Object(Symbol.observable) instanceof Symbol, 'Symbol.observable is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'observable'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.pattern-match.js000066400000000000000000000011351451776221300244510ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.patternMatch', assert => { assert.true('patternMatch' in Symbol, 'Symbol.patternMatch available'); assert.nonEnumerable(Symbol, 'patternMatch'); assert.true(Object(Symbol.patternMatch) instanceof Symbol, 'Symbol.patternMatch is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'patternMatch'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.symbol.replace-all.js000066400000000000000000000011221451776221300240570ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('Symbol.replaceAll', assert => { assert.true('replaceAll' in Symbol, 'Symbol.replaceAll is available'); assert.nonEnumerable(Symbol, 'replaceAll'); assert.true(Object(Symbol.replaceAll) instanceof Symbol, 'Symbol.replaceAll is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'replaceAll'); assert.false(descriptor.enumerable, 'non-enumerable'); assert.false(descriptor.writable, 'non-writable'); assert.false(descriptor.configurable, 'non-configurable'); } }); core-js-3.33.2/tests/unit-global/esnext.typed-array.filter-out.js000066400000000000000000000031731451776221300247340ustar00rootroot00000000000000// TODO: Remove from `core-js@4` import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.filterOut', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { filterOut } = TypedArray.prototype; assert.isFunction(filterOut, `${ name }::filterOut is function`); assert.arity(filterOut, 1, `${ name }::filterOut arity is 1`); assert.name(filterOut, 'filterOut', `${ name }::filterOut name is 'filterOut'`); assert.looksNative(filterOut, `${ name }::filterOut looks native`); const array = new TypedArray([1]); const context = {}; array.filterOut(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5, 6, 7, 8, 9]).filterOut(it => it % 2); assert.true(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [2, 4, 6, 8], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).filterOut((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => filterOut.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/esnext.typed-array.filter-reject.js000066400000000000000000000032121451776221300253730ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.filterReject', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { filterReject } = TypedArray.prototype; assert.isFunction(filterReject, `${ name }::filterReject is function`); assert.arity(filterReject, 1, `${ name }::filterReject arity is 1`); assert.name(filterReject, 'filterReject', `${ name }::filterReject name is 'filterReject'`); assert.looksNative(filterReject, `${ name }::filterReject looks native`); const array = new TypedArray([1]); const context = {}; array.filterReject(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5, 6, 7, 8, 9]).filterReject(it => it % 2); assert.true(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [2, 4, 6, 8], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).filterReject((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => filterReject.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/esnext.typed-array.from-async.js000066400000000000000000000065431451776221300247240ustar00rootroot00000000000000import { createAsyncIterable, createIterable } from '../helpers/helpers.js'; import { DESCRIPTORS, STRICT_THIS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) { // we can't implement %TypedArray% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) QUnit.test(`%TypedArray%.fromAsync, ${ name }`, assert => { const { fromAsync } = TypedArray; assert.isFunction(fromAsync); assert.arity(fromAsync, 1); assert.name(fromAsync, 'fromAsync'); assert.looksNative(fromAsync); return TypedArray.fromAsync(createAsyncIterable([1, 2, 3]), it => it ** 2).then(it => { assert.arrayEqual(it, [1, 4, 9], 'async iterable and mapfn'); return TypedArray.fromAsync(createAsyncIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return TypedArray.fromAsync(createAsyncIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'async iterable without mapfn'); return TypedArray.fromAsync(createIterable([1, 2, 3]), arg => arg ** 2); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and mapfn'); return TypedArray.fromAsync(createIterable([1, 2, 3]), arg => Promise.resolve(arg ** 2)); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and async mapfn'); return TypedArray.fromAsync(createIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return TypedArray.fromAsync(createIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'iterable and without mapfn'); return TypedArray.fromAsync([1, Promise.resolve(2), 3]); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'array'); return TypedArray.fromAsync('123'); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'string'); return TypedArray.fromAsync({ length: 1, 0: 1 }); }).then(it => { assert.arrayEqual(it, [1], 'non-iterable'); return TypedArray.fromAsync(createIterable([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); function C() { /* empty */ } return TypedArray.fromAsync.call(C, [1], {}); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return TypedArray.fromAsync(undefined, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return TypedArray.fromAsync(null, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return TypedArray.fromAsync([1], null); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return TypedArray.fromAsync([1], {}); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); }); }); } core-js-3.33.2/tests/unit-global/esnext.typed-array.group-by.js000066400000000000000000000035011451776221300244010ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; const { getPrototypeOf } = Object; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.groupBy', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { groupBy } = TypedArray.prototype; assert.isFunction(groupBy, `${ name }::groupBy is function`); assert.arity(groupBy, 1, `${ name }::groupBy arity is 1`); assert.name(groupBy, 'groupBy', `${ name }::groupBy name is 'groupBy'`); assert.looksNative(groupBy, `${ name }::groupBy looks native`); const array = new TypedArray([1]); const context = {}; array.groupBy(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(getPrototypeOf(new TypedArray([1]).groupBy(it => it)), null, 'null proto'); assert.true(new TypedArray([1]).groupBy(it => it)[1] instanceof TypedArray, 'instance'); assert.deepEqual( new TypedArray([1, 2, 3]).groupBy(it => it % 2), { 1: new TypedArray([1, 3]), 0: new TypedArray([2]) }, '#1', ); assert.deepEqual(new TypedArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]).groupBy(it => `i${ it % 5 }`), { i1: new TypedArray([1, 6, 11]), i2: new TypedArray([2, 7, 12]), i3: new TypedArray([3, 8]), i4: new TypedArray([4, 9]), i0: new TypedArray([5, 10]), }, '#2'); assert.throws(() => groupBy.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/esnext.typed-array.to-spliced.js000066400000000000000000000036341451776221300247070ustar00rootroot00000000000000// TODO: Remove from `core-js@4` import { DESCRIPTORS, TYPED_ARRAYS_WITH_BIG_INT } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toSpliced', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray, $ } of TYPED_ARRAYS_WITH_BIG_INT) { const { toSpliced } = TypedArray.prototype; assert.isFunction(toSpliced, `${ name }::toSpliced is function`); assert.arity(toSpliced, 2, `${ name }::toSpliced arity is 1`); assert.name(toSpliced, 'toSpliced', `${ name }::toSpliced name is 'toSpliced'`); assert.looksNative(toSpliced, `${ name }::toSpliced looks native`); let array = new TypedArray([$(1), $(2), $(3), $(4), $(5)]); assert.notSame(array.toSpliced(2), array, 'immutable'); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).toSpliced(2), new TypedArray([$(1), $(2)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).toSpliced(-2), new TypedArray([$(1), $(2), $(3)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).toSpliced(2, 2), new TypedArray([$(1), $(2), $(5)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).toSpliced(2, -2), new TypedArray([$(1), $(2), $(3), $(4), $(5)])); assert.deepEqual(new TypedArray([$(1), $(2), $(3), $(4), $(5)]).toSpliced(2, 2, $(6), $(7)), new TypedArray([$(1), $(2), $(6), $(7), $(5)])); array = new TypedArray([$(1)]); assert.deepEqual(array.toSpliced(1, 0, { valueOf() { array[0] = $(2); return $(3); }, }), new TypedArray([$(2), $(3)]), 'operations order'); assert.throws(() => toSpliced.call(null), TypeError, "isn't generic #1"); assert.throws(() => toSpliced.call(undefined), TypeError, "isn't generic #2"); assert.throws(() => toSpliced.call([$(1), $(2)]), TypeError, "isn't generic #3"); } }); core-js-3.33.2/tests/unit-global/esnext.typed-array.unique-by.js000066400000000000000000000022531451776221300245560ustar00rootroot00000000000000import { DESCRIPTORS, TYPED_ARRAYS } from '../helpers/constants.js'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.uniqueBy', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const { name, TypedArray } of TYPED_ARRAYS) { const { uniqueBy } = TypedArray.prototype; assert.isFunction(uniqueBy, `${ name }::uniqueBy is function`); assert.arity(uniqueBy, 1, `${ name }::uniqueBy arity is 1`); assert.name(uniqueBy, 'uniqueBy', `${ name }::uniqueBy name is 'uniqueBy'`); assert.looksNative(uniqueBy, `${ name }::uniqueBy looks native`); const array = new TypedArray([1, 2, 3, 2, 1]); assert.notSame(array.uniqueBy(), array); assert.deepEqual(array.uniqueBy(), new TypedArray([1, 2, 3])); let values = ''; new TypedArray([1, 2, 3]).uniqueBy(value => { values += value; }); assert.same(values, '123'); assert.throws(() => uniqueBy.call(null, () => { /* empty */ }), TypeError); assert.throws(() => uniqueBy.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => uniqueBy.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.33.2/tests/unit-global/esnext.weak-map.delete-all.js000066400000000000000000000027711451776221300241160ustar00rootroot00000000000000QUnit.test('WeakMap#deleteAll', assert => { const { deleteAll } = WeakMap.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(WeakMap.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.true(set.deleteAll(a, b)); assert.false(set.has(a)); assert.false(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.false(set.deleteAll(c, d)); assert.true(set.has(a)); assert.true(set.has(b)); assert.false(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.false(set.deleteAll(d, e)); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.true(set.deleteAll()); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.weak-map.emplace.js000066400000000000000000000036251451776221300235130ustar00rootroot00000000000000QUnit.test('WeakMap#emplace', assert => { const { emplace } = WeakMap.prototype; assert.isFunction(emplace); assert.arity(emplace, 2); assert.name(emplace, 'emplace'); assert.looksNative(emplace); assert.nonEnumerable(WeakMap.prototype, 'emplace'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); let handler = { update(value, key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, a, 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return value ** 2; }, insert() { assert.avoid(); }, }; assert.same(map.emplace(a, handler), 4, 'returns a correct value'); handler = { update() { assert.avoid(); }, insert(key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(key, b, 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return 3; }, }; assert.same(map.emplace(b, handler), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).emplace(b, { insert: () => 3 }), 3); assert.same(new WeakMap([[a, 2]]).emplace(a, { update: value => value ** 2 }), 4); handler = { update() { /* empty */ }, insert() { /* empty */ } }; assert.throws(() => new WeakMap().emplace(a), TypeError); assert.throws(() => emplace.call({}, a, handler), TypeError); assert.throws(() => emplace.call([], a, handler), TypeError); assert.throws(() => emplace.call(undefined, a, handler), TypeError); assert.throws(() => emplace.call(null, a, handler), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.weak-map.from.js000066400000000000000000000015771451776221300230540ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('WeakMap.from', assert => { const { from } = WeakMap; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(WeakMap, 'from'); assert.true(WeakMap.from() instanceof WeakMap); const array = []; assert.same(WeakMap.from([[array, 2]]).get(array), 2); assert.same(WeakMap.from(createIterable([[array, 2]])).get(array), 2); const pair = [{}, 1]; const context = {}; WeakMap.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([{}, 1])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-global/esnext.weak-map.of.js000066400000000000000000000007351451776221300225100ustar00rootroot00000000000000QUnit.test('WeakMap.of', assert => { const { of } = WeakMap; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(WeakMap, 'of'); const array = []; assert.true(WeakMap.of() instanceof WeakMap); assert.same(WeakMap.of([array, 2]).get(array), 2); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-global/esnext.weak-map.upsert.js000066400000000000000000000027631451776221300234310ustar00rootroot00000000000000QUnit.test('WeakMap#upsert', assert => { const { upsert } = WeakMap.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.looksNative(upsert); assert.nonEnumerable(WeakMap.prototype, 'upsert'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); assert.same(map.upsert(a, function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert(b, value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).upsert(b, null, () => 3), 3); assert.same(new WeakMap([[a, 2]]).upsert(a, value => value ** 2), 4); assert.throws(() => new WeakMap().upsert(a), TypeError); assert.throws(() => upsert.call({}, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.weak-set.add-all.js000066400000000000000000000016211451776221300234130ustar00rootroot00000000000000QUnit.test('WeakSet#addAll', assert => { const { addAll } = WeakSet.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.looksNative(addAll); assert.nonEnumerable(WeakSet.prototype, 'addAll'); const a = []; const b = []; const c = []; let set = new WeakSet([a]); assert.same(set.addAll(b), set); set = new WeakSet([a]).addAll(b, c); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); set = new WeakSet([a]).addAll(a, b); assert.true(set.has(a)); assert.true(set.has(b)); set = new WeakSet([a]).addAll(); assert.true(set.has(a)); assert.throws(() => addAll.call({ add() { /* empty */ } }, a, b, c)); assert.throws(() => addAll.call({}, a, b, c), TypeError); assert.throws(() => addAll.call(undefined, a, b, c), TypeError); assert.throws(() => addAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.weak-set.delete-all.js000066400000000000000000000026751451776221300241370ustar00rootroot00000000000000QUnit.test('WeakSet#deleteAll', assert => { const { deleteAll } = WeakSet.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(WeakSet.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakSet([a, b, c]); assert.true(set.deleteAll(a, b)); assert.false(set.has(a)); assert.false(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.false(set.deleteAll(c, d)); assert.true(set.has(a)); assert.true(set.has(b)); assert.false(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.false(set.deleteAll(d, e)); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.true(set.deleteAll()); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-global/esnext.weak-set.from.js000066400000000000000000000015531451776221300230640ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; QUnit.test('WeakSet.from', assert => { const { from } = WeakSet; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(WeakSet, 'from'); assert.true(WeakSet.from() instanceof WeakSet); const array = []; assert.true(WeakSet.from([array]).has(array)); assert.true(WeakSet.from(createIterable([array])).has(array)); const object = {}; const context = {}; WeakSet.from([object], function (element, index) { assert.same(element, object); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from({})); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-global/esnext.weak-set.of.js000066400000000000000000000007161451776221300225250ustar00rootroot00000000000000QUnit.test('WeakSet.of', assert => { const { of } = WeakSet; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(WeakSet, 'of'); const array = []; assert.true(WeakSet.of() instanceof WeakSet); assert.true(WeakSet.of(array).has(array)); assert.throws(() => of(1)); let arg = null; function F(it) { arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-global/web.atob.js000066400000000000000000000025211451776221300205720ustar00rootroot00000000000000// based on https://github.com/davidchambers/Base64.js/blob/master/test/base64.js import { NODE } from '../helpers/constants.js'; QUnit.test('atob', assert => { assert.isFunction(atob); assert.arity(atob, 1); assert.name(atob, 'atob'); if (!NODE) assert.looksNative(atob); assert.same(atob(''), ''); assert.same(atob('Zg=='), 'f'); assert.same(atob('Zm8='), 'fo'); assert.same(atob('Zm9v'), 'foo'); assert.same(atob('cXV1eA=='), 'quux'); assert.same(atob('ISIjJCU='), '!"#$%'); assert.same(atob('JicoKSor'), "&'()*+"); assert.same(atob('LC0uLzAxMg=='), ',-./012'); assert.same(atob('MzQ1Njc4OTo='), '3456789:'); assert.same(atob('Ozw9Pj9AQUJD'), ';<=>?@ABC'); assert.same(atob('REVGR0hJSktMTQ=='), 'DEFGHIJKLM'); assert.same(atob('Tk9QUVJTVFVWV1g='), 'NOPQRSTUVWX'); assert.same(atob('WVpbXF1eX2BhYmM='), 'YZ[\\]^_`abc'); assert.same(atob('ZGVmZ2hpamtsbW5vcA=='), 'defghijklmnop'); assert.same(atob('cXJzdHV2d3h5ent8fX4='), 'qrstuvwxyz{|}~'); assert.same(atob(' '), ''); assert.same(atob(42), atob('42')); assert.same(atob(null), atob('null')); assert.throws(() => atob(), TypeError, 'no args'); assert.throws(() => atob('a'), 'invalid #1'); assert.throws(() => atob('a '), 'invalid #2'); assert.throws(() => atob('aaaaa'), 'invalid #3'); assert.throws(() => atob('[object Object]'), 'invalid #4'); }); core-js-3.33.2/tests/unit-global/web.btoa.js000066400000000000000000000024101451776221300205670ustar00rootroot00000000000000// based on https://github.com/davidchambers/Base64.js/blob/master/test/base64.js import { NODE } from '../helpers/constants.js'; QUnit.test('btoa', assert => { assert.isFunction(btoa); assert.arity(btoa, 1); assert.name(btoa, 'btoa'); if (!NODE) assert.looksNative(btoa); assert.same(btoa(''), ''); assert.same(btoa('f'), 'Zg=='); assert.same(btoa('fo'), 'Zm8='); assert.same(btoa('foo'), 'Zm9v'); assert.same(btoa('quux'), 'cXV1eA=='); assert.same(btoa('!"#$%'), 'ISIjJCU='); assert.same(btoa("&'()*+"), 'JicoKSor'); assert.same(btoa(',-./012'), 'LC0uLzAxMg=='); assert.same(btoa('3456789:'), 'MzQ1Njc4OTo='); assert.same(btoa(';<=>?@ABC'), 'Ozw9Pj9AQUJD'); assert.same(btoa('DEFGHIJKLM'), 'REVGR0hJSktMTQ=='); assert.same(btoa('NOPQRSTUVWX'), 'Tk9QUVJTVFVWV1g='); assert.same(btoa('YZ[\\]^_`abc'), 'WVpbXF1eX2BhYmM='); assert.same(btoa('defghijklmnop'), 'ZGVmZ2hpamtsbW5vcA=='); assert.same(btoa('qrstuvwxyz{|}~'), 'cXJzdHV2d3h5ent8fX4='); assert.same(btoa('qrstuvwxyz{|}~'), 'cXJzdHV2d3h5ent8fX4='); assert.same(btoa(42), btoa('42')); assert.same(btoa(null), btoa('null')); assert.same(btoa({ x: 1 }), btoa('[object Object]')); assert.throws(() => btoa(), TypeError, 'no args'); assert.throws(() => btoa('✈'), 'non-ASCII'); }); core-js-3.33.2/tests/unit-global/web.dom-collections.for-each.js000066400000000000000000000011601451776221300244210ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; QUnit.test('forEach method on iterable DOM collections', assert => { let absent = true; const collections = [ 'NodeList', 'DOMTokenList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { absent = false; assert.isFunction(Collection.prototype.forEach, `${ name }::forEach is a function`); assert.same(Collection.prototype.forEach, Array.prototype.forEach, `${ name }::forEach is equal of Array::forEach`); } } if (absent) { assert.required('DOM collections are absent'); } }); core-js-3.33.2/tests/unit-global/web.dom-collections.iterator.js000066400000000000000000000043531451776221300245750ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('Iterable DOM collections', assert => { let absent = true; let collections = [ 'CSSRuleList', 'CSSStyleDeclaration', 'CSSValueList', 'ClientRectList', 'DOMRectList', 'DOMStringList', 'DOMTokenList', 'DataTransferItemList', 'FileList', 'HTMLAllCollection', 'HTMLCollection', 'HTMLFormElement', 'HTMLSelectElement', 'MediaList', 'MimeTypeArray', 'NamedNodeMap', 'NodeList', 'PaintRequestList', 'Plugin', 'PluginArray', 'SVGLengthList', 'SVGNumberList', 'SVGPathSegList', 'SVGPointList', 'SVGStringList', 'SVGTransformList', 'SourceBufferList', 'StyleSheetList', 'TextTrackCueList', 'TextTrackList', 'TouchList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { assert.same(Collection.prototype[Symbol.toStringTag], name, `${ name }::@@toStringTag is '${ name }'`); assert.isFunction(Collection.prototype[Symbol.iterator], `${ name }::@@iterator is function`); absent = false; } } if (GLOBAL.NodeList && GLOBAL.document && document.querySelectorAll && document.querySelectorAll('div') instanceof NodeList) { assert.isFunction(document.querySelectorAll('div')[Symbol.iterator], 'works with document.querySelectorAll'); } collections = [ 'NodeList', 'DOMTokenList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { assert.isFunction(Collection.prototype.values, `${ name }::values is function`); assert.same(Collection.prototype.values, Array.prototype.values, `${ name }::values is equal of Array::values`); assert.isFunction(Collection.prototype.keys, `${ name }::keys is function`); assert.same(Collection.prototype.keys, Array.prototype.keys, `${ name }::keys is equal of Array::keys`); assert.isFunction(Collection.prototype.entries, `${ name }::entries is function`); assert.same(Collection.prototype.entries, Array.prototype.entries, `${ name }::entries is equal of Array::entries`); } } if (absent) { assert.required('DOM collections are absent'); } }); core-js-3.33.2/tests/unit-global/web.dom-exception.constructor.js000066400000000000000000000113401451776221300250030ustar00rootroot00000000000000import { DESCRIPTORS, NODE } from '../helpers/constants.js'; const errors = { IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 }, }; const HAS_STACK = 'stack' in Error('1'); QUnit.test('DOMException', assert => { assert.isFunction(DOMException); assert.arity(DOMException, 0); assert.name(DOMException, 'DOMException'); // assert.looksNative(DOMException); // FF43- bug let error = new DOMException({}, 'Foo'); assert.true(error instanceof DOMException, 'new DOMException({}, "Foo") instanceof DOMException'); assert.same(error.message, '[object Object]', 'new DOMException({}, "Foo").message'); assert.same(error.name, 'Foo', 'new DOMException({}, "Foo").name'); assert.same(error.code, 0, 'new DOMException({}, "Foo").code'); assert.same(String(error), 'Foo: [object Object]', 'String(new DOMException({}, "Foo"))'); // Safari 10.1 bug assert.same(error.constructor, DOMException, 'new DOMException({}, "Foo").constructor'); assert.same(error[Symbol.toStringTag], 'DOMException', 'DOMException.prototype[Symbol.toStringTag]'); if (HAS_STACK) assert.true('stack' in error, "'stack' in new DOMException()"); assert.same(new DOMException().message, '', 'new DOMException().message'); assert.same(new DOMException(undefined).message, '', 'new DOMException(undefined).message'); assert.same(new DOMException(42).name, 'Error', 'new DOMException(42).name'); assert.same(new DOMException(42, undefined).name, 'Error', 'new DOMException(42, undefined).name'); for (const name in errors) { error = new DOMException(42, name); assert.true(error instanceof DOMException, `new DOMException({}, "${ name }") instanceof DOMException`); assert.same(error.message, '42', `new DOMException({}, "${ name }").message`); assert.same(error.name, name, `new DOMException({}, "${ name }").name`); if (errors[name].m) assert.same(error.code, errors[name].c, `new DOMException({}, "${ name }").code`); // NodeJS and Deno set codes to deprecated errors else if (!NODE) assert.same(error.code, 0, `new DOMException({}, "${ name }").code`); assert.same(String(error), `${ name }: 42`, `String(new DOMException({}, "${ name }"))`); // Safari 10.1 bug if (HAS_STACK) assert.true('stack' in error, `'stack' in new DOMException({}, "${ name }")`); assert.same(DOMException[errors[name].s], errors[name].c, `DOMException.${ errors[name].s }`); assert.same(DOMException.prototype[errors[name].s], errors[name].c, `DOMException.prototype.${ errors[name].s }`); } assert.throws(() => DOMException(42, 'DataCloneError'), "DOMException(42, 'DataCloneError')"); const symbol = Symbol('DOMException constructor test'); assert.throws(() => new DOMException(symbol, 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); assert.throws(() => new DOMException(42, symbol), 'new DOMException(42, Symbol())'); if (DESCRIPTORS) { // assert.throws(() => DOMException.prototype.message, 'DOMException.prototype.message'); // FF55- , Safari 10.1 bug // assert.throws(() => DOMException.prototype.name, 'DOMException.prototype.name'); // FF55-, Safari 10.1 bug bug // assert.throws(() => DOMException.prototype.code, 'DOMException.prototype.code'); // Safari 10.1 bug // assert.throws(() => DOMException.prototype.toString(), 'DOMException.prototype.toString()'); // FF55- bug } }); core-js-3.33.2/tests/unit-global/web.queue-microtask.js000066400000000000000000000010551451776221300227640ustar00rootroot00000000000000import { NODE } from '../helpers/constants.js'; import { timeLimitedPromise } from '../helpers/helpers.js'; QUnit.test('queueMicrotask', assert => { assert.isFunction(queueMicrotask); assert.arity(queueMicrotask, 1); assert.name(queueMicrotask, 'queueMicrotask'); if (!NODE) assert.looksNative(queueMicrotask); return timeLimitedPromise(3e3, resolve => { let called = false; queueMicrotask(() => { called = true; resolve(); }); assert.false(called, 'async'); }).then(() => { assert.required('works'); }); }); core-js-3.33.2/tests/unit-global/web.self.js000066400000000000000000000011251451776221300205750ustar00rootroot00000000000000/* eslint-disable no-restricted-globals -- safe */ import { DESCRIPTORS } from '../helpers/constants.js'; QUnit.test('self', assert => { assert.same(self, Object(self), 'is object'); assert.same(self.Math, Math, 'contains globals'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(self, 'self'); // can't be properly defined (non-configurable) in some ancient engines like PhantomJS // assert.isFunction(descriptor.get, 'a getter'); // assert.true(descriptor.configurable, 'configurable'); assert.true(descriptor.enumerable, 'enumerable'); } }); core-js-3.33.2/tests/unit-global/web.set-immediate.js000066400000000000000000000023161451776221300223760ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; QUnit.test('setImmediate / clearImmediate', assert => { assert.isFunction(setImmediate, 'setImmediate is function'); assert.isFunction(clearImmediate, 'clearImmediate is function'); assert.name(setImmediate, 'setImmediate'); assert.name(clearImmediate, 'clearImmediate'); let called = false; const promise = timeLimitedPromise(1e3, resolve => { setImmediate(() => { called = true; resolve(); }); }).then(() => { assert.required('setImmediate works'); }, () => { assert.avoid('setImmediate works'); }).then(() => { return timeLimitedPromise(1e3, resolve => { setImmediate((a, b) => { resolve(a + b); }, 'a', 'b'); }); }).then(it => { assert.same(it, 'ab', 'setImmediate works with additional args'); }, () => { assert.avoid('setImmediate works with additional args'); }).then(() => { return timeLimitedPromise(50, resolve => { clearImmediate(setImmediate(resolve)); }); }).then(() => { assert.avoid('clearImmediate works'); }, () => { assert.required('clearImmediate works'); }); assert.false(called, 'setImmediate is async'); return promise; }); core-js-3.33.2/tests/unit-global/web.set-interval.js000066400000000000000000000015551451776221300222700ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; QUnit.test('setInterval / clearInterval', assert => { assert.isFunction(setInterval, 'setInterval is function'); assert.isFunction(clearInterval, 'clearInterval is function'); assert.name(setInterval, 'setInterval'); assert.name(clearInterval, 'clearInterval'); return timeLimitedPromise(1e4, (resolve, reject) => { let i = 0; const interval = setInterval((a, b) => { if (a + b !== 'ab' || i > 2) reject({ a, b, i }); if (i++ === 2) { clearInterval(interval); setTimeout(resolve, 30); } }, 5, 'a', 'b'); }).then(() => { assert.required('setInterval & clearInterval works with additional args'); }, (error = {}) => { assert.avoid(`setInterval & clearInterval works with additional args: ${ error.a }, ${ error.b }, times: ${ error.i }`); }); }); core-js-3.33.2/tests/unit-global/web.set-timeout.js000066400000000000000000000015611451776221300221270ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; QUnit.test('setTimeout / clearTimeout', assert => { assert.isFunction(setTimeout, 'setTimeout is function'); assert.isFunction(clearTimeout, 'clearTimeout is function'); assert.name(setTimeout, 'setTimeout'); assert.name(clearTimeout, 'clearTimeout'); return timeLimitedPromise(1e3, resolve => { setTimeout((a, b) => { resolve(a + b); }, 10, 'a', 'b'); }).then(it => { assert.same(it, 'ab', 'setTimeout works with additional args'); }, () => { assert.avoid('setTimeout works with additional args'); }).then(() => { return timeLimitedPromise(50, resolve => { clearTimeout(setTimeout(resolve, 10)); }); }).then(() => { assert.avoid('clearImmediate works with wrapped setTimeout'); }, () => { assert.required('clearImmediate works with wrapped setTimeout'); }); }); core-js-3.33.2/tests/unit-global/web.structured-clone.js000066400000000000000000000377351451776221300231660ustar00rootroot00000000000000// Originally from: https://github.com/web-platform-tests/wpt/blob/4b35e758e2fc4225368304b02bcec9133965fd1a/IndexedDB/structured-clone.any.js // Copyright © web-platform-tests contributors. Available under the 3-Clause BSD License. import { GLOBAL, NODE } from '../helpers/constants.js'; import { bufferToArray, fromSource } from '../helpers/helpers.js'; const { from } = Array; const { assign, getPrototypeOf, keys } = Object; QUnit.module('structuredClone', () => { QUnit.test('identity', assert => { assert.isFunction(structuredClone, 'structuredClone is a function'); assert.name(structuredClone, 'structuredClone'); assert.arity(structuredClone, 1); if (!NODE) assert.looksNative(structuredClone); assert.throws(() => structuredClone(), 'throws without arguments'); assert.same(structuredClone(1, null), 1, 'null as options'); assert.same(structuredClone(1, undefined), 1, 'undefined as options'); }); function cloneTest(value, verifyFunc) { verifyFunc(value, structuredClone(value)); } // Specialization of cloneTest() for objects, with common asserts. function cloneObjectTest(assert, value, verifyFunc) { cloneTest(value, (orig, clone) => { assert.notSame(orig, clone, 'clone should have different reference'); assert.same(typeof clone, 'object', 'clone should be an object'); // https://github.com/qunitjs/node-qunit/issues/146 assert.true(getPrototypeOf(orig) === getPrototypeOf(clone), 'clone should have same prototype'); verifyFunc(orig, clone); }); } // ECMAScript types // Primitive values: Undefined, Null, Boolean, Number, BigInt, String const booleans = [false, true]; const numbers = [ NaN, -Infinity, -Number.MAX_VALUE, -0xFFFFFFFF, -0x80000000, -0x7FFFFFFF, -1, -Number.MIN_VALUE, -0, 0, 1, Number.MIN_VALUE, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, Number.MAX_VALUE, Infinity, ]; const bigints = fromSource(`[ -12345678901234567890n, -1n, 0n, 1n, 12345678901234567890n, ]`) || []; const strings = [ '', 'this is a sample string', 'null(\0)', ]; QUnit.test('primitives', assert => { const primitives = [undefined, null, ...booleans, ...numbers, ...bigints, ...strings]; for (const value of primitives) cloneTest(value, (orig, clone) => { assert.same(orig, clone, 'primitives should be same after cloned'); }); }); // "Primitive" Objects (Boolean, Number, BigInt, String) QUnit.test('primitive objects', assert => { const primitives = [...booleans, ...numbers, ...bigints, ...strings]; for (const value of primitives) cloneObjectTest(assert, Object(value), (orig, clone) => { assert.same(orig.valueOf(), clone.valueOf(), 'primitive wrappers should have same value'); }); }); // Dates QUnit.test('Date', assert => { const dates = [ new Date(-1e13), new Date(-1e12), new Date(-1e9), new Date(-1e6), new Date(-1e3), new Date(0), new Date(1e3), new Date(1e6), new Date(1e9), new Date(1e12), new Date(1e13), ]; for (const date of dates) cloneTest(date, (orig, clone) => { assert.notSame(orig, clone); assert.same(typeof clone, 'object'); assert.same(getPrototypeOf(orig), getPrototypeOf(clone)); assert.same(orig.valueOf(), clone.valueOf()); }); }); // Regular Expressions QUnit.test('RegExp', assert => { const regexes = [ new RegExp(), /abc/, /abc/g, /abc/i, /abc/gi, /abc/, /abc/g, /abc/i, /abc/gi, ]; const giuy = fromSource('/abc/giuy'); if (giuy) regexes.push(giuy); for (const regex of regexes) cloneObjectTest(assert, regex, (orig, clone) => { assert.same(orig.toString(), clone.toString(), `regex ${ regex }`); }); }); if (fromSource('ArrayBuffer.prototype.slice || DataView')) { // ArrayBuffer if (typeof Uint8Array == 'function') QUnit.test('ArrayBuffer', assert => { // Crashes cloneObjectTest(assert, new Uint8Array([0, 1, 254, 255]).buffer, (orig, clone) => { assert.arrayEqual(new Uint8Array(orig), new Uint8Array(clone)); }); }); // TODO SharedArrayBuffer // Array Buffer Views if (typeof Int8Array != 'undefined') { QUnit.test('%TypedArray%', assert => { const arrays = [ new Uint8Array([]), new Uint8Array([0, 1, 254, 255]), new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), new Int8Array([0, 1, 254, 255]), new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN]), new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN]), ]; if (typeof Uint8ClampedArray != 'undefined') { arrays.push(new Uint8ClampedArray([0, 1, 254, 255])); } for (const array of arrays) cloneObjectTest(assert, array, (orig, clone) => { assert.arrayEqual(orig, clone); }); }); if (typeof DataView != 'undefined') QUnit.test('DataView', assert => { const array = new Int8Array([1, 2, 3, 4]); const view = new DataView(array.buffer); cloneObjectTest(assert, array, (orig, clone) => { assert.same(orig.byteLength, clone.byteLength); assert.same(orig.byteOffset, clone.byteOffset); assert.arrayEqual(new Int8Array(view.buffer), array); }); }); } if ('resizable' in ArrayBuffer.prototype) { QUnit.test('Resizable ArrayBuffer', assert => { const array = [1, 2, 3, 4, 5, 6, 7, 8]; let buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); let copy = structuredClone(buffer); assert.arrayEqual(bufferToArray(copy), array, 'resizable-ab-1'); assert.true(copy.resizable, 'resizable-ab-1'); buffer = new ArrayBuffer(8); new Int8Array(buffer).set(array); copy = structuredClone(buffer); assert.arrayEqual(bufferToArray(copy), array, 'non-resizable-ab-1'); assert.false(copy.resizable, 'non-resizable-ab-1'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); let tarray = new Int8Array(buffer); tarray.set(array); copy = structuredClone(tarray).buffer; assert.arrayEqual(bufferToArray(copy), array, 'resizable-ab-2'); assert.true(copy.resizable, 'resizable-ab-2'); buffer = new ArrayBuffer(8); tarray = new Int8Array(buffer); tarray.set(array); copy = structuredClone(tarray).buffer; assert.arrayEqual(bufferToArray(copy), array, 'non-resizable-ab-2'); assert.false(copy.resizable, 'non-resizable-ab-2'); }); } } // Map QUnit.test('Map', assert => { cloneObjectTest(assert, new Map([[1, 2], [3, 4]]), (orig, clone) => { assert.deepEqual(from(orig.keys()), from(clone.keys())); assert.deepEqual(from(orig.values()), from(clone.values())); }); }); // Set QUnit.test('Set', assert => { cloneObjectTest(assert, new Set([1, 2, 3, 4]), (orig, clone) => { assert.deepEqual(from(orig.values()), from(clone.values())); }); }); // Error QUnit.test('Error', assert => { const errors = [ ['Error', new Error()], ['Error', new Error('msg', { cause: 42 })], ['EvalError', new EvalError()], ['EvalError', new EvalError('msg', { cause: 42 })], ['RangeError', new RangeError()], ['RangeError', new RangeError('msg', { cause: 42 })], ['ReferenceError', new ReferenceError()], ['ReferenceError', new ReferenceError('msg', { cause: 42 })], ['SyntaxError', new SyntaxError()], ['SyntaxError', new SyntaxError('msg', { cause: 42 })], ['TypeError', new TypeError()], ['TypeError', new TypeError('msg', { cause: 42 })], ['URIError', new URIError()], ['URIError', new URIError('msg', { cause: 42 })], ['AggregateError', new AggregateError([1, 2])], ['AggregateError', new AggregateError([1, 2], 'msg', { cause: 42 })], ]; const compile = fromSource('WebAssembly.CompileError()'); const link = fromSource('WebAssembly.LinkError()'); const runtime = fromSource('WebAssembly.RuntimeError()'); if (compile && compile.name === 'CompileError') errors.push(['CompileError', compile]); if (link && link.name === 'LinkError') errors.push(['LinkError', link]); if (runtime && runtime.name === 'RuntimeError') errors.push(['RuntimeError', runtime]); for (const [name, error] of errors) cloneObjectTest(assert, error, (orig, clone) => { assert.same(orig.constructor, clone.constructor, `${ name }#constructor`); assert.same(orig.name, clone.name, `${ name }#name`); assert.same(orig.message, clone.message, `${ name }#message`); assert.same(orig.stack, clone.stack, `${ name }#stack`); assert.same(orig.cause, clone.cause, `${ name }#cause`); assert.deepEqual(orig.errors, clone.errors, `${ name }#errors`); }); }); // Arrays QUnit.test('Array', assert => { const arrays = [ [], [1, 2, 3], Array(1), assign( ['foo', 'bar'], { 10: true, 11: false, 20: 123, 21: 456, 30: null }), assign( ['foo', 'bar'], { a: true, b: false, foo: 123, bar: 456, '': null }), ]; for (const array of arrays) cloneObjectTest(assert, array, (orig, clone) => { assert.deepEqual(orig, clone, `array content should be same: ${ array }`); assert.deepEqual(orig.length, clone.length, `array length should be same: ${ array }`); assert.deepEqual(keys(orig), keys(clone), `array key should be same: ${ array }`); for (const key of keys(orig)) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); // Objects QUnit.test('Object', assert => { cloneObjectTest(assert, { foo: true, bar: false }, (orig, clone) => { assert.deepEqual(keys(orig), keys(clone)); for (const key of keys(orig)) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); // [Serializable] Platform objects // Geometry types if (typeof DOMMatrix == 'function') { QUnit.test('Geometry types, DOMMatrix', assert => { cloneObjectTest(assert, new DOMMatrix(), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMMatrixReadOnly == 'function' && typeof DOMMatrixReadOnly.fromMatrix == 'function') { QUnit.test('Geometry types, DOMMatrixReadOnly', assert => { cloneObjectTest(assert, new DOMMatrixReadOnly(), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMPoint == 'function') { QUnit.test('Geometry types, DOMPoint', assert => { cloneObjectTest(assert, new DOMPoint(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMPointReadOnly == 'function' && typeof DOMPointReadOnly.fromPoint == 'function') { QUnit.test('Geometry types, DOMPointReadOnly', assert => { cloneObjectTest(assert, new DOMPointReadOnly(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMQuad == 'function' && typeof DOMPoint == 'function') { QUnit.test('Geometry types, DOMQuad', assert => { cloneObjectTest(assert, new DOMQuad( new DOMPoint(1, 2, 3, 4), new DOMPoint(2, 2, 3, 4), new DOMPoint(1, 3, 3, 4), new DOMPoint(1, 2, 4, 4), ), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.deepEqual(orig[key], clone[key], `Property ${ key }`); } }); }); } if (fromSource('new DOMRect(1, 2, 3, 4)')) { QUnit.test('Geometry types, DOMRect', assert => { cloneObjectTest(assert, new DOMRect(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMRectReadOnly == 'function' && typeof DOMRectReadOnly.fromRect == 'function') { QUnit.test('Geometry types, DOMRectReadOnly', assert => { cloneObjectTest(assert, new DOMRectReadOnly(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } // Safari 8- does not support `{ colorSpace }` option if (fromSource('new ImageData(new ImageData(8, 8).data, 8, 8, { colorSpace: new ImageData(8, 8).colorSpace })')) { QUnit.test('ImageData', assert => { const imageData = new ImageData(8, 8); for (let i = 0; i < 256; ++i) { imageData.data[i] = i; } cloneObjectTest(assert, imageData, (orig, clone) => { assert.same(orig.width, clone.width); assert.same(orig.height, clone.height); assert.same(orig.colorSpace, clone.colorSpace); assert.arrayEqual(orig.data, clone.data); }); }); } if (fromSource('new Blob(["test"])')) QUnit.test('Blob', assert => { cloneObjectTest( assert, new Blob(['This is a test.'], { type: 'a/b' }), (orig, clone) => { assert.same(orig.size, clone.size); assert.same(orig.type, clone.type); // TODO: async // assert.same(await orig.text(), await clone.text()); }); }); QUnit.test('DOMException', assert => { const errors = [ new DOMException(), new DOMException('foo', 'DataCloneError'), ]; for (const error of errors) cloneObjectTest(assert, error, (orig, clone) => { assert.same(orig.name, clone.name); assert.same(orig.message, clone.message); assert.same(orig.code, clone.code); assert.same(orig.stack, clone.stack); }); }); if (fromSource('new File(["test"], "foo.txt")')) QUnit.test('File', assert => { cloneObjectTest( assert, new File(['This is a test.'], 'foo.txt', { type: 'c/d' }), (orig, clone) => { assert.same(orig.size, clone.size); assert.same(orig.type, clone.type); assert.same(orig.name, clone.name); assert.same(orig.lastModified, clone.lastModified); // TODO: async // assert.same(await orig.text(), await clone.text()); }); }); // FileList if (fromSource('new File(["test"], "foo.txt")') && fromSource('new DataTransfer()')) QUnit.test('FileList', assert => { const transfer = new DataTransfer(); transfer.items.add(new File(['test'], 'foo.txt')); cloneObjectTest( assert, transfer.files, (orig, clone) => { assert.same(1, clone.length); assert.same(orig[0].size, clone[0].size); assert.same(orig[0].type, clone[0].type); assert.same(orig[0].name, clone[0].name); assert.same(orig[0].lastModified, clone[0].lastModified); }, ); }); // Non-serializable types QUnit.test('Non-serializable types', assert => { const nons = [ function () { return 1; }, Symbol('desc'), GLOBAL, ]; const event = fromSource('new Event("")'); const port = fromSource('new MessageChannel().port1'); // NodeJS events are simple objects if (event && !NODE) nons.push(event); if (port) nons.push(port); for (const it of nons) { // native NodeJS `structuredClone` throws a `TypeError` on transferable non-serializable instead of `DOMException` // https://github.com/nodejs/node/issues/40841 assert.throws(() => structuredClone(it)); } }); }); core-js-3.33.2/tests/unit-global/web.url-search-params.js000066400000000000000000000754171451776221300232110ustar00rootroot00000000000000import { DESCRIPTORS, NODE } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; const { getPrototypeOf, getOwnPropertyDescriptor } = Object; QUnit.test('URLSearchParams', assert => { assert.isFunction(URLSearchParams); assert.arity(URLSearchParams, 0); assert.name(URLSearchParams, 'URLSearchParams'); if (!NODE) assert.looksNative(URLSearchParams); assert.same(String(new URLSearchParams()), ''); assert.same(String(new URLSearchParams('')), ''); assert.same(String(new URLSearchParams('a=b')), 'a=b'); assert.same(String(new URLSearchParams(new URLSearchParams('a=b'))), 'a=b'); assert.same(String(new URLSearchParams([])), ''); assert.same(String(new URLSearchParams([[1, 2], ['a', 'b']])), '1=2&a=b'); assert.same(String(new URLSearchParams(createIterable([createIterable(['a', 'b']), createIterable(['c', 'd'])]))), 'a=b&c=d'); assert.same(String(new URLSearchParams({})), ''); assert.same(String(new URLSearchParams({ 1: 2, a: 'b' })), '1=2&a=b'); assert.same(String(new URLSearchParams('?a=b')), 'a=b', 'leading ? should be ignored'); assert.same(String(new URLSearchParams('??a=b')), '%3Fa=b'); assert.same(String(new URLSearchParams('?')), ''); assert.same(String(new URLSearchParams('??')), '%3F='); assert.same(String(new URLSearchParams('a=b c')), 'a=b+c'); assert.same(String(new URLSearchParams('a=b&b=c&a=d')), 'a=b&b=c&a=d'); assert.same(String(new URLSearchParams('a==')), 'a=%3D'); assert.same(String(new URLSearchParams('a=b=')), 'a=b%3D'); assert.same(String(new URLSearchParams('a=b=c')), 'a=b%3Dc'); assert.same(String(new URLSearchParams('a==b')), 'a=%3Db'); let params = new URLSearchParams('a=b'); assert.true(params.has('a'), 'search params object has name "a"'); assert.false(params.has('b'), 'search params object has not got name "b"'); params = new URLSearchParams('a=b&c'); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('c'), 'search params object has name "c"'); params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8'); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('a b'), 'search params object has name "a b"'); assert.true(params.has(' '), 'search params object has name " "'); assert.false(params.has('c'), 'search params object did not have the name "c"'); assert.true(params.has(' c'), 'search params object has name " c"'); assert.true(params.has('møø'), 'search params object has name "møø"'); params = new URLSearchParams('a=b+c'); assert.same(params.get('a'), 'b c', 'parse +'); params = new URLSearchParams('a+b=c'); assert.same(params.get('a b'), 'c', 'parse +'); params = new URLSearchParams('a=b c'); assert.same(params.get('a'), 'b c', 'parse " "'); params = new URLSearchParams('a b=c'); assert.same(params.get('a b'), 'c', 'parse " "'); params = new URLSearchParams('a=b%20c'); assert.same(params.get('a'), 'b c', 'parse %20'); params = new URLSearchParams('a%20b=c'); assert.same(params.get('a b'), 'c', 'parse %20'); params = new URLSearchParams('a=b\0c'); assert.same(params.get('a'), 'b\0c', 'parse \\0'); params = new URLSearchParams('a\0b=c'); assert.same(params.get('a\0b'), 'c', 'parse \\0'); params = new URLSearchParams('a=b%00c'); assert.same(params.get('a'), 'b\0c', 'parse %00'); params = new URLSearchParams('a%00b=c'); assert.same(params.get('a\0b'), 'c', 'parse %00'); params = new URLSearchParams('a=b\u2384'); assert.same(params.get('a'), 'b\u2384', 'parse \u2384'); params = new URLSearchParams('a\u2384b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse \u2384'); params = new URLSearchParams('a=b%e2%8e%84'); assert.same(params.get('a'), 'b\u2384', 'parse %e2%8e%84'); params = new URLSearchParams('a%e2%8e%84b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse %e2%8e%84'); params = new URLSearchParams('a=b\uD83D\uDCA9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a\uD83D\uDCA9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a=b%f0%9f%92%a9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); params = new URLSearchParams('a%f0%9f%92%a9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); params = new URLSearchParams(); params.set('query', '+15555555555'); assert.same(params.toString(), 'query=%2B15555555555'); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); params = new URLSearchParams(params.toString()); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); const testData = [ { input: '?a=%', output: [['a', '%']], name: 'handling %' }, { input: { '+': '%C2' }, output: [['+', '%C2']], name: 'object with +' }, { input: { c: 'x', a: '?' }, output: [['c', 'x'], ['a', '?']], name: 'object with two keys' }, { input: [['c', 'x'], ['a', '?']], output: [['c', 'x'], ['a', '?']], name: 'array with two keys' }, // eslint-disable-next-line @stylistic/js/max-len -- ignore // !!! { input: { 'a\0b': '42', 'c\uD83D': '23', dሴ: 'foo' }, output: [['a\0b', '42'], ['c\uFFFD', '23'], ['d\u1234', 'foo']], name: 'object with NULL, non-ASCII, and surrogate keys' }, ]; for (const { input, output, name } of testData) { params = new URLSearchParams(input); let i = 0; params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey, `construct with ${ name }`); assert.same(value, reqValue, `construct with ${ name }`); }); } assert.throws(() => { URLSearchParams(''); }, 'throws w/o `new`'); assert.throws(() => { new URLSearchParams([[1, 2, 3]]); }, 'sequence elements must be pairs #1'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1, 2, 3])])]); }, 'sequence elements must be pairs #2'); assert.throws(() => { new URLSearchParams([[1]]); }, 'sequence elements must be pairs #3'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1])])]); }, 'sequence elements must be pairs #4'); }); QUnit.test('URLSearchParams#append', assert => { const { append } = URLSearchParams.prototype; assert.isFunction(append); assert.arity(append, 2); assert.name(append, 'append'); assert.enumerable(URLSearchParams.prototype, 'append'); if (!NODE) assert.looksNative(append); assert.same(new URLSearchParams().append('a', 'b'), undefined, 'void'); let params = new URLSearchParams(); params.append('a', 'b'); assert.same(String(params), 'a=b'); params.append('a', 'b'); assert.same(String(params), 'a=b&a=b'); params.append('a', 'c'); assert.same(String(params), 'a=b&a=b&a=c'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined'); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined&undefined=undefined'); params = new URLSearchParams(); params.append(null, null); assert.same(String(params), 'null=null'); params.append(null, null); assert.same(String(params), 'null=null&null=null'); params = new URLSearchParams(); params.append('first', 1); params.append('second', 2); params.append('third', ''); params.append('first', 10); assert.true(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.same(params.get('second'), '2', 'search params object has name "second" with value "2"'); assert.same(params.get('third'), '', 'search params object has name "third" with value ""'); params.append('first', 10); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.throws(() => { return new URLSearchParams('').append(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#delete', assert => { const $delete = URLSearchParams.prototype.delete; assert.isFunction($delete); assert.arity($delete, 1); assert.enumerable(URLSearchParams.prototype, 'delete'); if (!NODE) assert.looksNative($delete); let params = new URLSearchParams('a=b&c=d'); params.delete('a'); assert.same(String(params), 'c=d'); params = new URLSearchParams('a=a&b=b&a=a&c=c'); params.delete('a'); assert.same(String(params), 'b=b&c=c'); params = new URLSearchParams('a=a&=&b=b&c=c'); params.delete(''); assert.same(String(params), 'a=a&b=b&c=c'); params = new URLSearchParams('a=a&null=null&b=b'); params.delete(null); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams('a=a&undefined=undefined&b=b'); params.delete(undefined); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams(); params.append('first', 1); assert.true(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); params.delete('first'); assert.false(params.has('first'), 'search params object has no "first" name'); params.append('first', 1); params.append('first', 10); params.delete('first'); assert.false(params.has('first'), 'search params object has no "first" name'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', 2); assert.same(String(params), 'a=1&a=null&a=3&b=4'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', null); assert.same(String(params), 'a=1&a=2&a=3&b=4'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', undefined); assert.same(String(params), 'b=4'); if (DESCRIPTORS) { let url = new URL('http://example.com/?param1¶m2'); url.searchParams.delete('param1'); url.searchParams.delete('param2'); assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); assert.same(url.search, '', 'url.search does not have ?'); url = new URL('http://example.com/?'); url.searchParams.delete('param1'); // assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); // Safari bug assert.same(url.search, '', 'url.search does not have ?'); } assert.throws(() => { return new URLSearchParams('').delete(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#get', assert => { const { get } = URLSearchParams.prototype; assert.isFunction(get); assert.arity(get, 1); assert.name(get, 'get'); assert.enumerable(URLSearchParams.prototype, 'get'); if (!NODE) assert.looksNative(get); let params = new URLSearchParams('a=b&c=d'); assert.same(params.get('a'), 'b'); assert.same(params.get('c'), 'd'); assert.same(params.get('e'), null); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.get('a'), 'b'); params = new URLSearchParams('=b&c=d'); assert.same(params.get(''), 'b'); params = new URLSearchParams('a=&c=d&a=e'); assert.same(params.get('a'), ''); params = new URLSearchParams('first=second&third&&'); assert.true(params.has('first'), 'Search params object has name "first"'); assert.same(params.get('first'), 'second', 'Search params object has name "first" with value "second"'); assert.same(params.get('third'), '', 'Search params object has name "third" with the empty value.'); assert.same(params.get('fourth'), null, 'Search params object has no "fourth" name and value.'); assert.same(new URLSearchParams('a=b c').get('a'), 'b c'); assert.same(new URLSearchParams('a b=c').get('a b'), 'c'); assert.same(new URLSearchParams('a=b%20c').get('a'), 'b c', 'parse %20'); assert.same(new URLSearchParams('a%20b=c').get('a b'), 'c', 'parse %20'); assert.same(new URLSearchParams('a=b\0c').get('a'), 'b\0c', 'parse \\0'); assert.same(new URLSearchParams('a\0b=c').get('a\0b'), 'c', 'parse \\0'); assert.same(new URLSearchParams('a=b%2Bc').get('a'), 'b+c', 'parse %2B'); assert.same(new URLSearchParams('a%2Bb=c').get('a+b'), 'c', 'parse %2B'); assert.same(new URLSearchParams('a=b%00c').get('a'), 'b\0c', 'parse %00'); assert.same(new URLSearchParams('a%00b=c').get('a\0b'), 'c', 'parse %00'); assert.same(new URLSearchParams('a==').get('a'), '=', 'parse ='); assert.same(new URLSearchParams('a=b=').get('a'), 'b=', 'parse ='); assert.same(new URLSearchParams('a=b=c').get('a'), 'b=c', 'parse ='); assert.same(new URLSearchParams('a==b').get('a'), '=b', 'parse ='); assert.same(new URLSearchParams('a=b\u2384').get('a'), 'b\u2384', 'parse \\u2384'); assert.same(new URLSearchParams('a\u2384b=c').get('a\u2384b'), 'c', 'parse \\u2384'); assert.same(new URLSearchParams('a=b%e2%8e%84').get('a'), 'b\u2384', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a%e2%8e%84b=c').get('a\u2384b'), 'c', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a=b\uD83D\uDCA9c').get('a'), 'b\uD83D\uDCA9c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a\uD83D\uDCA9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a=b%f0%9f%92%a9c').get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('a%f0%9f%92%a9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('=').get(''), '', 'parse ='); assert.throws(() => { return new URLSearchParams('').get(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#getAll', assert => { const { getAll } = URLSearchParams.prototype; assert.isFunction(getAll); assert.arity(getAll, 1); assert.name(getAll, 'getAll'); assert.enumerable(URLSearchParams.prototype, 'getAll'); if (!NODE) assert.looksNative(getAll); let params = new URLSearchParams('a=b&c=d'); assert.arrayEqual(params.getAll('a'), ['b']); assert.arrayEqual(params.getAll('c'), ['d']); assert.arrayEqual(params.getAll('e'), []); params = new URLSearchParams('a=b&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['b', 'e']); params = new URLSearchParams('=b&c=d'); assert.arrayEqual(params.getAll(''), ['b']); params = new URLSearchParams('a=&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['', 'e']); params = new URLSearchParams('a=1&a=2&a=3&a'); assert.arrayEqual(params.getAll('a'), ['1', '2', '3', ''], 'search params object has expected name "a" values'); params.set('a', 'one'); assert.arrayEqual(params.getAll('a'), ['one'], 'search params object has expected name "a" values'); assert.throws(() => { return new URLSearchParams('').getAll(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#has', assert => { const { has } = URLSearchParams.prototype; assert.isFunction(has); assert.arity(has, 1); assert.name(has, 'has'); assert.enumerable(URLSearchParams.prototype, 'has'); if (!NODE) assert.looksNative(has); let params = new URLSearchParams('a=b&c=d'); assert.true(params.has('a')); assert.true(params.has('c')); assert.false(params.has('e')); params = new URLSearchParams('a=b&c=d&a=e'); assert.true(params.has('a')); params = new URLSearchParams('=b&c=d'); assert.true(params.has('')); params = new URLSearchParams('null=a'); assert.true(params.has(null)); params = new URLSearchParams('a=b&c=d&&'); params.append('first', 1); params.append('first', 2); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('c'), 'search params object has name "c"'); assert.true(params.has('first'), 'search params object has name "first"'); assert.false(params.has('d'), 'search params object has no name "d"'); params.delete('first'); assert.false(params.has('first'), 'search params object has no name "first"'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); assert.true(params.has('a', 2)); assert.true(params.has('a', null)); assert.false(params.has('a', 4)); assert.true(params.has('b', 4)); assert.false(params.has('b', null)); assert.true(params.has('b', undefined)); assert.false(params.has('c', undefined)); assert.throws(() => { return new URLSearchParams('').has(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#set', assert => { const { set } = URLSearchParams.prototype; assert.isFunction(set); assert.arity(set, 2); assert.name(set, 'set'); assert.enumerable(URLSearchParams.prototype, 'set'); if (!NODE) assert.looksNative(set); let params = new URLSearchParams('a=b&c=d'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params = new URLSearchParams('a=b&c=d&a=e'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params.set('e', 'f'); assert.same(String(params), 'a=B&c=d&e=f'); params = new URLSearchParams('a=1&a=2&a=3'); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); params.set('first', 4); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); assert.same(String(params), 'a=1&a=2&a=3&first=4'); params.set('a', 4); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '4', 'search params object has name "a" with value "4"'); assert.same(String(params), 'a=4&first=4'); assert.throws(() => { return new URLSearchParams('').set(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#sort', assert => { const { sort } = URLSearchParams.prototype; assert.isFunction(sort); assert.arity(sort, 0); assert.name(sort, 'sort'); assert.enumerable(URLSearchParams.prototype, 'sort'); if (!NODE) assert.looksNative(sort); let params = new URLSearchParams('a=1&b=4&a=3&b=2'); params.sort(); assert.same(String(params), 'a=1&a=3&b=4&b=2'); params.delete('a'); params.append('a', '0'); params.append('b', '0'); params.sort(); assert.same(String(params), 'a=0&b=4&b=2&b=0'); const testData = [ { input: 'z=b&a=b&z=a&a=a', output: [['a', 'b'], ['a', 'a'], ['z', 'b'], ['z', 'a']], }, { input: '\uFFFD=x&\uFFFC&\uFFFD=a', output: [['\uFFFC', ''], ['\uFFFD', 'x'], ['\uFFFD', 'a']], }, { input: 'ffi&🌈', // 🌈 > code point, but < code unit because two code units output: [['🌈', ''], ['ffi', '']], }, { input: 'é&e\uFFFD&e\u0301', output: [['e\u0301', ''], ['e\uFFFD', ''], ['é', '']], }, { input: 'z=z&a=a&z=y&a=b&z=x&a=c&z=w&a=d&z=v&a=e&z=u&a=f&z=t&a=g', output: [ ['a', 'a'], ['a', 'b'], ['a', 'c'], ['a', 'd'], ['a', 'e'], ['a', 'f'], ['a', 'g'], ['z', 'z'], ['z', 'y'], ['z', 'x'], ['z', 'w'], ['z', 'v'], ['z', 'u'], ['z', 't'], ], }, { input: 'bbb&bb&aaa&aa=x&aa=y', output: [['aa', 'x'], ['aa', 'y'], ['aaa', ''], ['bb', ''], ['bbb', '']], }, { input: 'z=z&=f&=t&=x', output: [['', 'f'], ['', 't'], ['', 'x'], ['z', 'z']], }, { input: 'a🌈&a💩', output: [['a🌈', ''], ['a💩', '']], }, ]; for (const { input, output } of testData) { let i = 0; params = new URLSearchParams(input); params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); i = 0; const url = new URL(`?${ input }`, 'https://example/'); params = url.searchParams; params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); } if (DESCRIPTORS) { const url = new URL('http://example.com/?'); url.searchParams.sort(); assert.same(url.href, 'http://example.com/', 'Sorting non-existent params removes ? from URL'); assert.same(url.search, '', 'Sorting non-existent params removes ? from URL'); } }); QUnit.test('URLSearchParams#toString', assert => { const { toString } = URLSearchParams.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); if (!NODE) assert.looksNative(toString); let params = new URLSearchParams(); params.append('a', 'b c'); assert.same(String(params), 'a=b+c'); params.delete('a'); params.append('a b', 'c'); assert.same(String(params), 'a+b=c'); params = new URLSearchParams(); params.append('a', ''); assert.same(String(params), 'a='); params.append('a', ''); assert.same(String(params), 'a=&a='); params.append('', 'b'); assert.same(String(params), 'a=&a=&=b'); params.append('', ''); assert.same(String(params), 'a=&a=&=b&='); params.append('', ''); assert.same(String(params), 'a=&a=&=b&=&='); params = new URLSearchParams(); params.append('', 'b'); assert.same(String(params), '=b'); params.append('', 'b'); assert.same(String(params), '=b&=b'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append('a', 'b+c'); assert.same(String(params), 'a=b%2Bc'); params.delete('a'); params.append('a+b', 'c'); assert.same(String(params), 'a%2Bb=c'); params = new URLSearchParams(); params.append('=', 'a'); assert.same(String(params), '%3D=a'); params.append('b', '='); assert.same(String(params), '%3D=a&b=%3D'); params = new URLSearchParams(); params.append('&', 'a'); assert.same(String(params), '%26=a'); params.append('b', '&'); assert.same(String(params), '%26=a&b=%26'); params = new URLSearchParams(); params.append('a', '\r'); assert.same(String(params), 'a=%0D'); params = new URLSearchParams(); params.append('a', '\n'); assert.same(String(params), 'a=%0A'); params = new URLSearchParams(); params.append('a', '\r\n'); assert.same(String(params), 'a=%0D%0A'); params = new URLSearchParams(); params.append('a', 'b%c'); assert.same(String(params), 'a=b%25c'); params.delete('a'); params.append('a%b', 'c'); assert.same(String(params), 'a%25b=c'); params = new URLSearchParams(); params.append('a', 'b\0c'); assert.same(String(params), 'a=b%00c'); params.delete('a'); params.append('a\0b', 'c'); assert.same(String(params), 'a%00b=c'); params = new URLSearchParams(); params.append('a', 'b\uD83D\uDCA9c'); assert.same(String(params), 'a=b%F0%9F%92%A9c'); params.delete('a'); params.append('a\uD83D\uDCA9b', 'c'); assert.same(String(params), 'a%F0%9F%92%A9b=c'); params = new URLSearchParams('a=b&c=d&&e&&'); assert.same(String(params), 'a=b&c=d&e='); params = new URLSearchParams('a = b &a=b&c=d%20'); assert.same(String(params), 'a+=+b+&a=b&c=d+'); params = new URLSearchParams('a=&a=b'); assert.same(String(params), 'a=&a=b'); }); QUnit.test('URLSearchParams#forEach', assert => { const { forEach } = URLSearchParams.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.enumerable(URLSearchParams.prototype, 'forEach'); if (!NODE) assert.looksNative(forEach); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let result = ''; params.forEach((value, key, that) => { assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); assert.same(that, params); result += key; }); assert.same(result, 'abc'); new URL('http://a.b/c').searchParams.forEach(() => { assert.avoid(); }); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); params = url.searchParams; result = ''; params.forEach((val, key) => { url.search = 'x=1&y=2&z=3'; result += key + val; }); assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); result = ''; params.forEach((value, key) => { params.delete('b'); result += key + value; }); assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#entries', assert => { const { entries } = URLSearchParams.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); assert.enumerable(URLSearchParams.prototype, 'entries'); if (!NODE) assert.looksNative(entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params.entries(); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams.entries().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.entries(); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.entries(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().entries()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#keys', assert => { const { keys } = URLSearchParams.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.name(keys, 'keys'); assert.enumerable(URLSearchParams.prototype, 'keys'); if (!NODE) assert.looksNative(keys); let iterator = new URLSearchParams('a=1&b=2&c=3').keys(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams.keys().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const key = entry.value; url.search = 'x=1&y=2&z=3'; result += key; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.keys(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, 'ac'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().keys()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#values', assert => { const { values } = URLSearchParams.prototype; assert.isFunction(values); assert.arity(values, 0); assert.name(values, 'values'); assert.enumerable(URLSearchParams.prototype, 'values'); if (!NODE) assert.looksNative(values); let iterator = new URLSearchParams('a=1&b=2&c=3').values(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, '123'); assert.true(new URL('http://a.b/c').searchParams.values().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=a&b=b&c=c&d=d'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const { value } = entry; url.search = 'x=x&y=y&z=z'; result += value; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.values(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, '13'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().values()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#@@iterator', assert => { const entries = URLSearchParams.prototype[Symbol.iterator]; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); if (!NODE) assert.looksNative(entries); assert.same(entries, URLSearchParams.prototype.entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params[Symbol.iterator](); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams[Symbol.iterator]().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams()[Symbol.iterator]()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#size', assert => { const params = new URLSearchParams('a=1&b=2&b=3'); assert.true('size' in params); assert.same(params.size, 3); if (DESCRIPTORS) { assert.true('size' in URLSearchParams.prototype); const { enumerable, configurable, get } = getOwnPropertyDescriptor(URLSearchParams.prototype, 'size'); assert.true(enumerable, 'enumerable'); assert.true(configurable, 'configurable'); if (!NODE) assert.looksNative(get); assert.throws(() => get.call([])); } }); QUnit.test('URLSearchParams#@@toStringTag', assert => { const params = new URLSearchParams('a=b'); assert.same(({}).toString.call(params), '[object URLSearchParams]'); }); if (typeof Request == 'function') { QUnit.test('URLSearchParams with Request', assert => { const async = assert.async(); new Request('http://zloirock.ru', { body: new URLSearchParams({ foo: 'baz' }), method: 'POST' }).text().then(text => { assert.same(text, 'foo=baz'); async(); }); }); } core-js-3.33.2/tests/unit-global/web.url.can-parse.js000066400000000000000000000032431451776221300223210ustar00rootroot00000000000000import { NODE } from '../helpers/constants.js'; QUnit.test('URL.canParse', assert => { const { canParse } = URL; assert.isFunction(canParse); assert.arity(canParse, 1); assert.name(canParse, 'canParse'); if (!NODE) assert.looksNative(canParse); assert.false(canParse(undefined), 'undefined'); assert.false(canParse(undefined, undefined), 'undefined, undefined'); assert.true(canParse('q:w'), 'q:w'); assert.true(canParse('q:w', undefined), 'q:w, undefined'); // assert.false(canParse(undefined, 'q:w'), 'undefined, q:w'); // fails in Chromium on Windows assert.true(canParse('q:/w'), 'q:/w'); assert.true(canParse('q:/w', undefined), 'q:/w, undefined'); assert.true(canParse(undefined, 'q:/w'), 'undefined, q:/w'); assert.false(canParse('https://login:password@examp:le.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'https://login:password@examp:le.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.true(canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.true(canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment', undefined), 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment, undefined'); assert.true(canParse('x', 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'x, https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.throws(() => canParse(), 'no args'); assert.throws(() => canParse({ toString() { throw new Error('thrower'); } }), 'conversion thrower #1'); assert.throws(() => canParse('q:w', { toString() { throw new Error('thrower'); } }), 'conversion thrower #2'); }); core-js-3.33.2/tests/unit-global/web.url.js000066400000000000000000000677011451776221300204620ustar00rootroot00000000000000/* eslint-disable unicorn/relative-url-style -- required for testing */ import { DESCRIPTORS, NODE } from '../helpers/constants.js'; import urlTestData from '../wpt-url-resources/urltestdata.js'; import settersTestData from '../wpt-url-resources/setters.js'; import toASCIITestData from '../wpt-url-resources/toascii.js'; const { hasOwnProperty } = Object.prototype; QUnit.test('URL constructor', assert => { assert.isFunction(URL); if (!NODE) assert.arity(URL, 1); assert.name(URL, 'URL'); if (!NODE) assert.looksNative(URL); assert.same(String(new URL('http://www.domain.com/a/b')), 'http://www.domain.com/a/b'); assert.same(String(new URL('/c/d', 'http://www.domain.com/a/b')), 'http://www.domain.com/c/d'); assert.same(String(new URL('b/c', 'http://www.domain.com/a/b')), 'http://www.domain.com/a/b/c'); assert.same(String(new URL('b/c', new URL('http://www.domain.com/a/b'))), 'http://www.domain.com/a/b/c'); assert.same(String(new URL({ toString: () => 'https://example.org/' })), 'https://example.org/'); assert.same(String(new URL('nonspecial://example.com/')), 'nonspecial://example.com/'); assert.same(String(new URL('https://測試')), 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(new URL('https://xxпривет.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('https://xxПРИВЕТ.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('http://Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https://Example.com/', 'https://example.org/')), 'https://example.com/'); assert.same(String(new URL('nonspecial://Example.com/', 'https://example.org/')), 'nonspecial://Example.com/'); assert.same(String(new URL('http:Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https:Example.com/', 'https://example.org/')), 'https://example.org/Example.com/'); assert.same(String(new URL('nonspecial:Example.com/', 'https://example.org/')), 'nonspecial:Example.com/'); assert.same(String(new URL('http://0300.168.0xF0')), 'http://192.168.0.240/'); assert.same(String(new URL('http://[20:0:0:1:0:0:0:ff]')), 'http://[20:0:0:1::ff]/'); // assert.same(String(new URL('http://257.168.0xF0')), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // TypeError in Chrome and Safari assert.same(String(new URL('http://0300.168.0xG0')), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(new URL('file:///var/log/system.log')), 'file:///var/log/system.log', 'file scheme'); // assert.same(String(new URL('file://nnsc.nsf.net/bar/baz')), 'file://nnsc.nsf.net/bar/baz', 'file scheme'); // 'file:///bar/baz' in FF // assert.same(String(new URL('file://localhost/bar/baz')), 'file:///bar/baz', 'file scheme'); // 'file://localhost/bar/baz' in Chrome assert.throws(() => new URL(), 'TypeError: Failed to construct URL: 1 argument required, but only 0 present.'); assert.throws(() => new URL(''), 'TypeError: Failed to construct URL: Invalid URL'); // Node 19.7 // https://github.com/nodejs/node/issues/46755 // assert.throws(() => new URL('', 'about:blank'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('abc'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('//abc'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('http:///www.domain.com/', 'abc'), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('http:///www.domain.com/', null), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('//abc', null), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:ff'), 'incorrect IPv6'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:fg]'), 'incorrect IPv6'); // assert.throws(() => new URL('http://a%b'), 'forbidden host code point'); // no error in FF assert.throws(() => new URL('1http://zloirock.ru'), 'incorrect scheme'); }); QUnit.test('URL#href', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'href')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'href'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.href, 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.href, 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://測試'; assert.same(url.href, 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(url), 'https://xn--g6w251d/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxпривет.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxПРИВЕТ.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/'); assert.same(String(url), 'http://192.168.0.240/'); url = new URL('http://zloirock.ru/'); url.href = 'http://[20:0:0:1:0:0:0:ff]'; assert.same(url.href, 'http://[20:0:0:1::ff]/'); assert.same(String(url), 'http://[20:0:0:1::ff]/'); // url = new URL('http://zloirock.ru/'); // url.href = 'http://257.168.0xF0'; // TypeError and Safari // assert.same(url.href, 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome // assert.same(String(url), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xG0'; assert.same(url.href, 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(url), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); url = new URL('http://192.168.0.240/'); url.href = 'file:///var/log/system.log'; assert.same(url.href, 'file:///var/log/system.log', 'file -> ip'); assert.same(String(url), 'file:///var/log/system.log', 'file -> ip'); url = new URL('file:///var/log/system.log'); url.href = 'http://0300.168.0xF0'; // Node 19.7 // https://github.com/nodejs/node/issues/46755 // assert.same(url.href, 'http://192.168.0.240/', 'file -> http'); // assert.same(String(url), 'http://192.168.0.240/', 'file -> http'); // assert.throws(() => new URL('http://zloirock.ru/').href = undefined, 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '//abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:ff', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:fg]', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://a%b', 'forbidden host code point'); // no error in Chrome and FF // assert.throws(() => new URL('http://zloirock.ru/').href = '1http://zloirock.ru', 'incorrect scheme'); // no error in Chrome } }); QUnit.test('URL#origin', assert => { const url = new URL('http://es6.zloirock.ru/tests.html'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'origin')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'origin'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); } assert.same(url.origin, 'http://es6.zloirock.ru'); assert.same(new URL('https://測試/tests').origin, 'https://xn--g6w251d'); }); QUnit.test('URL#protocol', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'protocol')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'protocol'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.protocol, 'http:'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.protocol = 'https'; assert.same(url.protocol, 'https:'); assert.same(String(url), 'https://zloirock.ru/'); // https://nodejs.org/api/url.html#url_special_schemes // url = new URL('http://zloirock.ru/'); // url.protocol = 'fish'; // assert.same(url.protocol, 'http:'); // assert.same(url.href, 'http://zloirock.ru/'); // assert.same(String(url), 'http://zloirock.ru/'); url = new URL('http://zloirock.ru/'); url.protocol = '1http'; assert.same(url.protocol, 'http:'); assert.same(url.href, 'http://zloirock.ru/', 'incorrect scheme'); assert.same(String(url), 'http://zloirock.ru/', 'incorrect scheme'); } }); QUnit.test('URL#username', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'username')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'username'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.username, ''); url = new URL('http://username@zloirock.ru/'); assert.same(url.username, 'username'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; assert.same(url.username, 'username'); assert.same(String(url), 'http://username@zloirock.ru/'); } }); QUnit.test('URL#password', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'password')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'password'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.password, ''); url = new URL('http://username:password@zloirock.ru/'); assert.same(url.password, 'password'); // url = new URL('http://:password@zloirock.ru/'); // TypeError in FF // assert.same(url.password, 'password'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; url.password = 'password'; assert.same(url.password, 'password'); assert.same(String(url), 'http://username:password@zloirock.ru/'); // url = new URL('http://zloirock.ru/'); // url.password = 'password'; // assert.same(url.password, 'password'); // '' in FF // assert.same(String(url), 'http://:password@zloirock.ru/'); // 'http://zloirock.ru/' in FF } }); QUnit.test('URL#host', assert => { let url = new URL('http://zloirock.ru:81/path'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'host')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'host'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.host, 'zloirock.ru:81'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/path'); url.host = 'example.com:82'; assert.same(url.host, 'example.com:82'); assert.same(String(url), 'http://example.com:82/path'); // url = new URL('http://zloirock.ru:81/path'); // url.host = 'other?domain.com'; // assert.same(String(url), 'http://other:81/path'); // 'http://other/?domain.com/path' in Safari url = new URL('https://www.mydomain.com:8080/path/'); url.host = 'www.otherdomain.com:80'; assert.same(url.href, 'https://www.otherdomain.com:80/path/', 'set default port for another protocol'); // url = new URL('https://www.mydomain.com:8080/path/'); // url.host = 'www.otherdomain.com:443'; // assert.same(url.href, 'https://www.otherdomain.com/path/', 'set default port'); url = new URL('http://zloirock.ru/foo'); url.host = '測試'; assert.same(url.host, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxпривет.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxПРИВЕТ.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = '0300.168.0xF0'; assert.same(url.host, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.host = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.host, '[20:0:0:1::ff]'); // ':0' in Chrome, 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://[20:0/foo' in Chrome, 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.host = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:ff'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = 'a%b'; // assert.same(url.host, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#hostname', assert => { let url = new URL('http://zloirock.ru:81/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'hostname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hostname'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hostname, 'zloirock.ru'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/'); url.hostname = 'example.com'; assert.same(url.hostname, 'example.com'); assert.same(String(url), 'http://example.com:81/'); // url = new URL('http://zloirock.ru:81/'); // url.hostname = 'example.com:82'; // assert.same(url.hostname, 'example.com'); // '' in Chrome // assert.same(String(url), 'http://example.com:81/'); // 'http://example.com:82:81/' in Chrome url = new URL('http://zloirock.ru/foo'); url.hostname = '測試'; assert.same(url.hostname, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxпривет.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxПРИВЕТ.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = '0300.168.0xF0'; assert.same(url.hostname, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.hostname = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.hostname, '[20:0:0:1::ff]'); // 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.hostname = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:ff'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff/' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = 'a%b'; // assert.same(url.hostname, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#port', assert => { let url = new URL('http://zloirock.ru:1337/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'port')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'port'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.port, '1337'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.port = 80; assert.same(url.port, ''); assert.same(String(url), 'http://zloirock.ru/'); url.port = 1337; assert.same(url.port, '1337'); assert.same(String(url), 'http://zloirock.ru:1337/'); // url.port = 'abcd'; // assert.same(url.port, '1337'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1337/'); // 'http://zloirock.ru:0/' in Chrome // url.port = '5678abcd'; // assert.same(url.port, '5678'); // '1337' in FF // assert.same(String(url), 'http://zloirock.ru:5678/'); // 'http://zloirock.ru:1337/"' in FF url.port = 1234.5678; assert.same(url.port, '1234'); assert.same(String(url), 'http://zloirock.ru:1234/'); // url.port = 1e10; // assert.same(url.port, '1234'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1234/'); // 'http://zloirock.ru:0/' in Chrome } }); QUnit.test('URL#pathname', assert => { let url = new URL('http://zloirock.ru/foo/bar'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'pathname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'pathname'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.pathname, '/foo/bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.pathname = 'bar/baz'; assert.same(url.pathname, '/bar/baz'); assert.same(String(url), 'http://zloirock.ru/bar/baz'); } }); QUnit.test('URL#search', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'search')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'search'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.search, ''); url = new URL('http://zloirock.ru/?foo=bar'); assert.same(url.search, '?foo=bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/?'); assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/?'); url.search = 'foo=bar'; assert.same(url.search, '?foo=bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url.search = '?bar=baz'; assert.same(url.search, '?bar=baz'); assert.same(String(url), 'http://zloirock.ru/?bar=baz'); url.search = ''; assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/'); } }); QUnit.test('URL#searchParams', assert => { let url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'searchParams')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'searchParams'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); } assert.true(url.searchParams instanceof URLSearchParams); assert.same(url.searchParams.get('foo'), 'bar'); assert.same(url.searchParams.get('bar'), 'baz'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.searchParams.append('foo', 'bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/'); url.search = 'foo=bar'; assert.same(url.searchParams.get('foo'), 'bar'); url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); url.search = ''; assert.false(url.searchParams.has('foo')); } }); QUnit.test('URL#hash', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'hash')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hash'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hash, ''); url = new URL('http://zloirock.ru/#foo'); assert.same(url.hash, '#foo'); url = new URL('http://zloirock.ru/#'); assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/#'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/#'); url.hash = 'foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = ''; assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/'); // url.hash = '#'; // assert.same(url.hash, ''); // assert.same(String(url), 'http://zloirock.ru/'); // 'http://zloirock.ru/#' in FF url.hash = '#foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = '#foo#bar'; assert.same(url.hash, '#foo#bar'); assert.same(String(url), 'http://zloirock.ru/#foo#bar'); url = new URL('http://zloirock.ru/'); url.hash = 'абa'; assert.same(url.hash, '#%D0%B0%D0%B1a'); // url = new URL('http://zloirock.ru/'); // url.hash = '\udc01\ud802a'; // assert.same(url.hash, '#%EF%BF%BD%EF%BF%BDa', 'unmatched surrogates'); } }); QUnit.test('URL#toJSON', assert => { const { toJSON } = URL.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 0); assert.name(toJSON, 'toJSON'); assert.enumerable(URL.prototype, 'toJSON'); if (!NODE) assert.looksNative(toJSON); const url = new URL('http://zloirock.ru/'); assert.same(url.toJSON(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toJSON(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#toString', assert => { const { toString } = URL.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.enumerable(URL.prototype, 'toString'); if (!NODE) assert.looksNative(toString); const url = new URL('http://zloirock.ru/'); assert.same(url.toString(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toString(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#@@toStringTag', assert => { const url = new URL('http://zloirock.ru/'); assert.same(({}).toString.call(url), '[object URL]'); }); QUnit.test('URL.sham', assert => { assert.same(URL.sham, DESCRIPTORS ? undefined : true); }); // `core-js` URL implementation pass all (exclude some encoding-related) tests // from the next 3 test cases, but URLs from all of popular browsers fail a serious part of tests. // Replacing all of them does not looks like a good idea, so next test cases disabled by default. // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT URL constructor tests', assert => { for (const expected of urlTestData) { if (typeof expected == 'string') continue; const name = `Parsing: <${ expected.input }> against <${ expected.base }>`; if (expected.failure) { assert.throws(() => new URL(expected.input, expected.base || 'about:blank'), name); } else { const url = new URL(expected.input, expected.base || 'about:blank'); assert.same(url.href, expected.href, `${ name }: href`); assert.same(url.protocol, expected.protocol, `${ name }: protocol`); assert.same(url.username, expected.username, `${ name }: username`); assert.same(url.password, expected.password, `${ name }: password`); assert.same(url.host, expected.host, `${ name }: host`); assert.same(url.hostname, expected.hostname, `${ name }: hostname`); assert.same(url.port, expected.port, `${ name }: port`); assert.same(url.pathname, expected.pathname, `${ name }: pathname`); assert.same(url.search, expected.search, `${ name }: search`); if ('searchParams' in expected) { assert.same(url.searchParams.toString(), expected.searchParams, `${ name }: searchParams`); } assert.same(url.hash, expected.hash, `${ name }: hash`); if ('origin' in expected) { assert.same(url.origin, expected.origin, `${ name }: origin`); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url if (DESCRIPTORS) QUnit.skip('WPT URL setters tests', assert => { for (const setter in settersTestData) { const testCases = settersTestData[setter]; for (const { href, newValue, comment, expected } of testCases) { let name = `Setting <${ href }>.${ setter } = '${ newValue }'.`; if (comment) name += ` ${ comment }`; const url = new URL(href); url[setter] = newValue; for (const attribute in expected) { assert.same(url[attribute], expected[attribute], name); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT conversion to ASCII tests', assert => { for (const { comment, input, output } of toASCIITestData) { let name = `Parsing: <${ input }>`; if (comment) name += ` ${ comment }`; if (output === null) { assert.throws(() => new URL(`https://${ input }/x`), name); } else { const url = new URL(`https://${ input }/x`); assert.same(url.host, output, name); assert.same(url.hostname, output, name); assert.same(url.pathname, '/x', name); assert.same(url.href, `https://${ output }/x`, name); } } }); core-js-3.33.2/tests/unit-karma/000077500000000000000000000000001451776221300163665ustar00rootroot00000000000000core-js-3.33.2/tests/unit-karma/karma.conf.js000066400000000000000000000011571451776221300207470ustar00rootroot00000000000000'use strict'; const { chromium, firefox, webkit } = require('playwright'); Object.assign(process.env, { CHROMIUM_BIN: chromium.executablePath(), FIREFOX_BIN: firefox.executablePath(), WEBKIT_BIN: webkit.executablePath(), }); module.exports = config => config.set({ plugins: [ 'karma-*', '@onslip/karma-playwright-launcher', ], files: process.argv.find(it => it.startsWith('-f=')).slice(3).split(','), frameworks: ['qunit'], basePath: '.', browsers: [ 'ChromiumHeadless', 'FirefoxHeadless', 'WebKitHeadless', 'PhantomJS', ], logLevel: config.LOG_ERROR, singleRun: true, }); core-js-3.33.2/tests/unit-karma/package-lock.json000066400000000000000000002616521451776221300216160ustar00rootroot00000000000000{ "name": "tests/unit-karma", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/unit-karma", "devDependencies": { "@onslip/karma-playwright-launcher": "^0.3.0", "@playwright/browser-chromium": "^1.39.0", "@playwright/browser-firefox": "^1.39.0", "@playwright/browser-webkit": "^1.39.0", "karma": "^6.4.2", "karma-phantomjs-launcher": "~1.0.4", "karma-qunit": "^4.1.2", "phantomjs-prebuilt": "~2.1.16", "playwright": "^1.39.0", "qunit": "^2.20.0" } }, "node_modules/@colors/colors": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "dev": true, "engines": { "node": ">=0.1.90" } }, "node_modules/@onslip/karma-playwright-launcher": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@onslip/karma-playwright-launcher/-/karma-playwright-launcher-0.3.0.tgz", "integrity": "sha512-myCCa/e7IhHcjHvyHbCe9U+IsYP9+pFuN5aEL2xvpsktkeX6fvzJ8aMCXQGnF5dz3VrGUexQ2UgeRNOQIO5hsg==", "dev": true, "dependencies": { "playwright": "^1.0.0" } }, "node_modules/@playwright/browser-chromium": { "version": "1.39.0", "resolved": "https://registry.npmjs.org/@playwright/browser-chromium/-/browser-chromium-1.39.0.tgz", "integrity": "sha512-s1WPO0qOE7PIZcdcJEd4CHQgXf9rOwy00Den8DsXTI26n/Eqa2HzFSbLRE1Eh2nIJZFSGyKLbopHR0HkT8ClZw==", "dev": true, "hasInstallScript": true, "dependencies": { "playwright-core": "1.39.0" }, "engines": { "node": ">=16" } }, "node_modules/@playwright/browser-firefox": { "version": "1.39.0", "resolved": "https://registry.npmjs.org/@playwright/browser-firefox/-/browser-firefox-1.39.0.tgz", "integrity": "sha512-QwtxRw63W8hAxAkqY5qCZl1yxs7Skin2tBpv1GhXrjVcZmrZdfGie/c9BbFkU1pZq8n0z+sPzu4kanMTR8F9qQ==", "dev": true, "hasInstallScript": true, "dependencies": { "playwright-core": "1.39.0" }, "engines": { "node": ">=16" } }, "node_modules/@playwright/browser-webkit": { "version": "1.39.0", "resolved": "https://registry.npmjs.org/@playwright/browser-webkit/-/browser-webkit-1.39.0.tgz", "integrity": "sha512-hqGFV0wNo+Z05W/ySyikdPsw+C3/xwZ7Q6rxhHdP8BJBqaA4vmGMTlyF5hOHVUQpd1QuGMq7vkiFgEKNNjzZSg==", "dev": true, "hasInstallScript": true, "dependencies": { "playwright-core": "1.39.0" }, "engines": { "node": ">=16" } }, "node_modules/@socket.io/component-emitter": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, "node_modules/@types/cookie": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==", "dev": true }, "node_modules/@types/cors": { "version": "2.8.15", "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.15.tgz", "integrity": "sha512-n91JxbNLD8eQIuXDIChAN1tCKNWCEgpceU9b7ZMbFA+P+Q4yIeh80jizFLEvolRPc1ES0VdwFlGv+kJTSirogw==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/node": { "version": "20.8.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" } }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" }, "engines": { "node": ">= 8" } }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "dependencies": { "safer-buffer": "~2.1.0" } }, "node_modules/assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true, "engines": { "node": ">=0.8" } }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true, "engines": { "node": "*" } }, "node_modules/aws4": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", "dev": true, "engines": { "node": "^4.5.0 || >= 5.9" } }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, "dependencies": { "tweetnacl": "^0.14.3" } }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "dependencies": { "fill-range": "^7.0.1" }, "engines": { "node": ">=8" } }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, "engines": { "node": "*" } }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/call-bind": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "get-intrinsic": "^1.2.1", "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "dev": true }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "funding": [ { "type": "individual", "url": "https://paulmillr.com/funding/" } ], "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "engines": { "node": ">= 8.10.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, "engines": { "node": ">= 0.8" } }, "node_modules/commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, "engines": { "node": ">= 10" } }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/concat-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "engines": [ "node >= 0.8" ], "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "node_modules/connect": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", "dev": true, "dependencies": { "debug": "2.6.9", "finalhandler": "1.1.2", "parseurl": "~1.3.3", "utils-merge": "1.0.1" }, "engines": { "node": ">= 0.10.0" } }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", "dev": true, "dependencies": { "object-assign": "^4", "vary": "^1" }, "engines": { "node": ">= 0.10" } }, "node_modules/custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", "dev": true }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, "dependencies": { "assert-plus": "^1.0.0" }, "engines": { "node": ">=0.10" } }, "node_modules/date-format": { "version": "4.0.14", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", "dev": true, "engines": { "node": ">=4.0" } }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "dependencies": { "ms": "2.0.0" } }, "node_modules/define-data-property": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true, "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", "integrity": "sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==", "dev": true }, "node_modules/dom-serialize": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", "integrity": "sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ==", "dev": true, "dependencies": { "custom-event": "~1.0.0", "ent": "~2.2.0", "extend": "^3.0.0", "void-elements": "^2.0.0" } }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/engine.io": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.3.tgz", "integrity": "sha512-IML/R4eG/pUS5w7OfcDE0jKrljWS9nwnEfsxWCIJF5eO6AHo6+Hlv+lQbdlAYsiJPHzUthLm1RUjnBzWOs45cw==", "dev": true, "dependencies": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", "cookie": "~0.4.1", "cors": "~2.8.5", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", "ws": "~8.11.0" }, "engines": { "node": ">=10.2.0" } }, "node_modules/engine.io-parser": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", "dev": true, "engines": { "node": ">=10.0.0" } }, "node_modules/engine.io/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/engine.io/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", "integrity": "sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==", "dev": true }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", "dev": true }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "dev": true }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "node_modules/extract-zip": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", "dev": true, "dependencies": { "concat-stream": "^1.6.2", "debug": "^2.6.9", "mkdirp": "^0.5.4", "yauzl": "^2.10.0" }, "bin": { "extract-zip": "cli.js" } }, "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "dev": true, "engines": [ "node >=0.6.0" ] }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, "dependencies": { "pend": "~1.2.0" } }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", "dev": true, "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "on-finished": "~2.3.0", "parseurl": "~1.3.3", "statuses": "~1.5.0", "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" } }, "node_modules/finalhandler/node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", "dev": true, "dependencies": { "ee-first": "1.1.1" }, "engines": { "node": ">= 0.8" } }, "node_modules/flatted": { "version": "3.2.9", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, "node_modules/follow-redirects": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true, "funding": [ { "type": "individual", "url": "https://github.com/sponsors/RubenVerborgh" } ], "engines": { "node": ">=4.0" }, "peerDependenciesMeta": { "debug": { "optional": true } } }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true, "engines": { "node": "*" } }, "node_modules/form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", "mime-types": "^2.1.12" }, "engines": { "node": ">= 0.12" } }, "node_modules/fs-extra": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", "integrity": "sha512-VerQV6vEKuhDWD2HGOybV6v5I73syoc/cXAbKlgTC7M/oFVEtklWlp9QH2Ijw3IaWDOQcMkldSPa7zXy79Z/UQ==", "dev": true, "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^2.1.0", "klaw": "^1.0.0" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } }, "node_modules/get-intrinsic": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "dependencies": { "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, "dependencies": { "assert-plus": "^1.0.0" } }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", "dev": true }, "node_modules/globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", "dev": true }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "node_modules/har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/har-validator": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", "deprecated": "this library is no longer supported", "dev": true, "dependencies": { "ajv": "^6.12.3", "har-schema": "^2.0.0" }, "engines": { "node": ">=6" } }, "node_modules/has-property-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "dependencies": { "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/hasha": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", "integrity": "sha512-jZ38TU/EBiGKrmyTNNZgnvCZHNowiRI4+w/I9noMlekHTZH3KyGgvJLmhSgykeAQ9j2SYPDosM0Bg3wHfzibAQ==", "dev": true, "dependencies": { "is-stream": "^1.0.1", "pinkie-promise": "^2.0.0" }, "engines": { "node": ">=0.10.0" } }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "dev": true, "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "dev": true, "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" }, "engines": { "node": ">= 0.8" } }, "node_modules/http-errors/node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/http-proxy": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" }, "engines": { "node": ">=8.0.0" } }, "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", "dev": true, "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", "sshpk": "^1.7.0" }, "engines": { "node": ">=0.8", "npm": ">=1.3.7" } }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, "engines": { "node": ">=0.10.0" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "engines": { "node": ">=0.12.0" } }, "node_modules/is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, "node_modules/isbinaryfile": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", "dev": true, "engines": { "node": ">= 8.0.0" }, "funding": { "url": "https://github.com/sponsors/gjtorikian/" } }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", "dev": true }, "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, "node_modules/jsonfile": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", "dev": true, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "node_modules/jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.4.0", "verror": "1.10.0" }, "engines": { "node": ">=0.6.0" } }, "node_modules/karma": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/karma/-/karma-6.4.2.tgz", "integrity": "sha512-C6SU/53LB31BEgRg+omznBEMY4SjHU3ricV6zBcAe1EeILKkeScr+fZXtaI5WyDbkVowJxxAI6h73NcFPmXolQ==", "dev": true, "dependencies": { "@colors/colors": "1.5.0", "body-parser": "^1.19.0", "braces": "^3.0.2", "chokidar": "^3.5.1", "connect": "^3.7.0", "di": "^0.0.1", "dom-serialize": "^2.2.1", "glob": "^7.1.7", "graceful-fs": "^4.2.6", "http-proxy": "^1.18.1", "isbinaryfile": "^4.0.8", "lodash": "^4.17.21", "log4js": "^6.4.1", "mime": "^2.5.2", "minimatch": "^3.0.4", "mkdirp": "^0.5.5", "qjobs": "^1.2.0", "range-parser": "^1.2.1", "rimraf": "^3.0.2", "socket.io": "^4.4.1", "source-map": "^0.6.1", "tmp": "^0.2.1", "ua-parser-js": "^0.7.30", "yargs": "^16.1.1" }, "bin": { "karma": "bin/karma" }, "engines": { "node": ">= 10" } }, "node_modules/karma-phantomjs-launcher": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz", "integrity": "sha512-tf4P3plsE7wb5Pqh8GJ6RnElxfI/UM4MtVnjbSIZFpdFJlKnjRzfIx8MLCcSYJBwZ1+qSKFz4uBe3XNoq2t3KA==", "deprecated": "PhantomJS development have stopped, use puppeteer or similar", "dev": true, "dependencies": { "lodash": "^4.0.1", "phantomjs-prebuilt": "^2.1.7" }, "peerDependencies": { "karma": ">=0.9" } }, "node_modules/karma-qunit": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/karma-qunit/-/karma-qunit-4.1.2.tgz", "integrity": "sha512-taTPqBeHCOlkeKTSzQgIKzAUb79vw3rfbCph+xwwh63tyGjNtljwx91VArhIM9DzIIR3gB9G214wQg+oXI9ycw==", "dev": true, "peerDependencies": { "karma": "^4.0.0 || ^5.0.0 || ^6.0.0", "qunit": "^2.0.0" } }, "node_modules/kew": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", "integrity": "sha512-IG6nm0+QtAMdXt9KvbgbGdvY50RSrw+U4sGZg+KlrSKPJEwVE5JVoI3d7RWfSMdBQneRheeAOj3lIjX5VL/9RQ==", "dev": true }, "node_modules/klaw": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", "dev": true, "optionalDependencies": { "graceful-fs": "^4.1.9" } }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "node_modules/log4js": { "version": "6.9.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.9.1.tgz", "integrity": "sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==", "dev": true, "dependencies": { "date-format": "^4.0.14", "debug": "^4.3.4", "flatted": "^3.2.7", "rfdc": "^1.3.0", "streamroller": "^3.1.5" }, "engines": { "node": ">=8.0" } }, "node_modules/log4js/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/log4js/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", "dev": true, "bin": { "mime": "cli.js" }, "engines": { "node": ">=4.0.0" } }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/node-watch": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.3.tgz", "integrity": "sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true, "engines": { "node": "*" } }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/object-inspect": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, "dependencies": { "ee-first": "1.1.1" }, "engines": { "node": ">= 0.8" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true }, "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", "dev": true }, "node_modules/phantomjs-prebuilt": { "version": "2.1.16", "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", "integrity": "sha512-PIiRzBhW85xco2fuj41FmsyuYHKjKuXWmhjy3A/Y+CMpN/63TV+s9uzfVhsUwFe0G77xWtHBG8xmXf5BqEUEuQ==", "deprecated": "this package is now deprecated", "dev": true, "hasInstallScript": true, "dependencies": { "es6-promise": "^4.0.3", "extract-zip": "^1.6.5", "fs-extra": "^1.0.0", "hasha": "^2.2.0", "kew": "^0.7.0", "progress": "^1.1.8", "request": "^2.81.0", "request-progress": "^2.0.1", "which": "^1.2.10" }, "bin": { "phantomjs": "bin/phantomjs" } }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", "dev": true, "dependencies": { "pinkie": "^2.0.0" }, "engines": { "node": ">=0.10.0" } }, "node_modules/playwright": { "version": "1.39.0", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", "dev": true, "dependencies": { "playwright-core": "1.39.0" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=16" }, "optionalDependencies": { "fsevents": "2.3.2" } }, "node_modules/playwright-core": { "version": "1.39.0", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", "dev": true, "bin": { "playwright-core": "cli.js" }, "engines": { "node": ">=16" } }, "node_modules/playwright/node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, "node_modules/progress": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha512-UdA8mJ4weIkUBO224tIarHzuHs4HuYiJvsuGT7j/SPQiUJVjYvNDBIPa0hAorduOfjGohB/qHWRa/lrrWX/mXw==", "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", "dev": true }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", "dev": true, "engines": { "node": ">=0.9" } }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dev": true, "dependencies": { "side-channel": "^1.0.4" }, "engines": { "node": ">=0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/qunit": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.20.0.tgz", "integrity": "sha512-N8Fp1J55waE+QG1KwX2LOyqulZUToRrrPBqDOfYfuAMkEglFL15uwvmH1P4Tq/omQ/mGbBI8PEB3PhIfvUb+jg==", "dev": true, "dependencies": { "commander": "7.2.0", "node-watch": "0.7.3", "tiny-glob": "0.2.9" }, "bin": { "qunit": "bin/qunit.js" }, "engines": { "node": ">=10" } }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/raw-body": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, "engines": { "node": ">= 0.8" } }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "dependencies": { "picomatch": "^2.2.1" }, "engines": { "node": ">=8.10.0" } }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", "caseless": "~0.12.0", "combined-stream": "~1.0.6", "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, "engines": { "node": ">= 6" } }, "node_modules/request-progress": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", "integrity": "sha512-dxdraeZVUNEn9AvLrxkgB2k6buTlym71dJk1fk4v8j3Ou3RKNm07BcgbHdj2lLgYGfqX71F+awb1MR+tWPFJzA==", "dev": true, "dependencies": { "throttleit": "^1.0.0" } }, "node_modules/request/node_modules/qs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true, "engines": { "node": ">=0.6" } }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "dev": true }, "node_modules/rfdc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", "dev": true }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, "node_modules/set-function-length": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", "object-inspect": "^1.9.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/socket.io": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", "integrity": "sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==", "dev": true, "dependencies": { "accepts": "~1.3.4", "base64id": "~2.0.0", "cors": "~2.8.5", "debug": "~4.3.2", "engine.io": "~6.5.2", "socket.io-adapter": "~2.5.2", "socket.io-parser": "~4.2.4" }, "engines": { "node": ">=10.2.0" } }, "node_modules/socket.io-adapter": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", "dev": true, "dependencies": { "ws": "~8.11.0" } }, "node_modules/socket.io-parser": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", "dev": true, "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1" }, "engines": { "node": ">=10.0.0" } }, "node_modules/socket.io-parser/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/socket.io-parser/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/socket.io/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/socket.io/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/sshpk": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", "dev": true, "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", "dashdash": "^1.12.0", "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, "bin": { "sshpk-conv": "bin/sshpk-conv", "sshpk-sign": "bin/sshpk-sign", "sshpk-verify": "bin/sshpk-verify" }, "engines": { "node": ">=0.10.0" } }, "node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/streamroller": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.5.tgz", "integrity": "sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==", "dev": true, "dependencies": { "date-format": "^4.0.14", "debug": "^4.3.4", "fs-extra": "^8.1.0" }, "engines": { "node": ">=8.0" } }, "node_modules/streamroller/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/streamroller/node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" }, "engines": { "node": ">=6 <7 || >=8" } }, "node_modules/streamroller/node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "dev": true, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "node_modules/streamroller/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==", "dev": true }, "node_modules/tiny-glob": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", "dev": true, "dependencies": { "globalyzer": "0.1.0", "globrex": "^0.1.2" } }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", "dev": true, "dependencies": { "rimraf": "^3.0.0" }, "engines": { "node": ">=8.17.0" } }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, "engines": { "node": ">=0.6" } }, "node_modules/tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, "dependencies": { "psl": "^1.1.28", "punycode": "^2.1.1" }, "engines": { "node": ">=0.8" } }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, "dependencies": { "safe-buffer": "^5.0.1" }, "engines": { "node": "*" } }, "node_modules/tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", "dev": true }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dev": true, "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" }, "engines": { "node": ">= 0.6" } }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", "dev": true }, "node_modules/ua-parser-js": { "version": "0.7.37", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.37.tgz", "integrity": "sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/ua-parser-js" }, { "type": "paypal", "url": "https://paypal.me/faisalman" }, { "type": "github", "url": "https://github.com/sponsors/faisalman" } ], "engines": { "node": "*" } }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true, "engines": { "node": ">= 4.0.0" } }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "dependencies": { "punycode": "^2.1.0" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", "dev": true, "engines": { "node": ">= 0.4.0" } }, "node_modules/uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, "bin": { "uuid": "bin/uuid" } }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", "dev": true, "engines": [ "node >=0.6.0" ], "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } }, "node_modules/verror/node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", "dev": true }, "node_modules/void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", "integrity": "sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "dependencies": { "isexe": "^2.0.0" }, "bin": { "which": "bin/which" } }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", "dev": true, "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" }, "engines": { "node": ">=10" } }, "node_modules/yargs-parser": { "version": "20.2.9", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } } } } core-js-3.33.2/tests/unit-karma/package.json000066400000000000000000000006611451776221300206570ustar00rootroot00000000000000{ "name": "tests/unit-karma", "devDependencies": { "@onslip/karma-playwright-launcher": "^0.3.0", "@playwright/browser-chromium": "^1.39.0", "@playwright/browser-firefox": "^1.39.0", "@playwright/browser-webkit": "^1.39.0", "karma": "^6.4.2", "karma-phantomjs-launcher": "~1.0.4", "karma-qunit": "^4.1.2", "phantomjs-prebuilt": "~2.1.16", "playwright": "^1.39.0", "qunit": "^2.20.0" } } core-js-3.33.2/tests/unit-karma/runner.mjs000066400000000000000000000005141451776221300204120ustar00rootroot00000000000000if (process.env.CI) await $`playwright install-deps`; await Promise.all([ ['packages/core-js-bundle/index', 'tests/bundles/unit-global'], ['packages/core-js-bundle/minified', 'tests/bundles/unit-global'], ['tests/bundles/unit-pure'], ].map(files => $`karma start -f=${ files.map(file => `../../${ file }.js`).join(',') }`)); core-js-3.33.2/tests/unit-node/000077500000000000000000000000001451776221300162205ustar00rootroot00000000000000core-js-3.33.2/tests/unit-node/package-lock.json000066400000000000000000000044041451776221300214360ustar00rootroot00000000000000{ "name": "tests/unit-node", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tests/unit-node", "devDependencies": { "qunit": "^2.20.0" } }, "node_modules/commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, "engines": { "node": ">= 10" } }, "node_modules/globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", "dev": true }, "node_modules/globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", "dev": true }, "node_modules/node-watch": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.3.tgz", "integrity": "sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/qunit": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.20.0.tgz", "integrity": "sha512-N8Fp1J55waE+QG1KwX2LOyqulZUToRrrPBqDOfYfuAMkEglFL15uwvmH1P4Tq/omQ/mGbBI8PEB3PhIfvUb+jg==", "dev": true, "dependencies": { "commander": "7.2.0", "node-watch": "0.7.3", "tiny-glob": "0.2.9" }, "bin": { "qunit": "bin/qunit.js" }, "engines": { "node": ">=10" } }, "node_modules/tiny-glob": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", "dev": true, "dependencies": { "globalyzer": "0.1.0", "globrex": "^0.1.2" } } } } core-js-3.33.2/tests/unit-node/package.json000066400000000000000000000001231451776221300205020ustar00rootroot00000000000000{ "name": "tests/unit-node", "devDependencies": { "qunit": "^2.20.0" } } core-js-3.33.2/tests/unit-node/runner.mjs000066400000000000000000000004141451776221300202430ustar00rootroot00000000000000await Promise.all([ ['packages/core-js/index', 'tests/bundles/unit-global'], ['packages/core-js/index', 'packages/core-js-bundle/index', 'tests/bundles/unit-global'], ['tests/bundles/unit-pure'], ].map(files => $`qunit ${ files.map(file => `${ file }.js`) }`)); core-js-3.33.2/tests/unit-pure/000077500000000000000000000000001451776221300162465ustar00rootroot00000000000000core-js-3.33.2/tests/unit-pure/es.aggregate-error.js000066400000000000000000000052361451776221300222750ustar00rootroot00000000000000import AggregateError from 'core-js-pure/es/aggregate-error'; import Symbol from 'core-js-pure/es/symbol'; import toString from 'core-js-pure/es/object/to-string'; import create from 'core-js-pure/es/object/create'; QUnit.test('AggregateError', assert => { assert.isFunction(AggregateError); assert.arity(AggregateError, 2); assert.name(AggregateError, 'AggregateError'); assert.true(new AggregateError([1]) instanceof AggregateError); assert.true(new AggregateError([1]) instanceof Error); assert.true(AggregateError([1]) instanceof AggregateError); assert.true(AggregateError([1]) instanceof Error); assert.same(AggregateError([1], 'foo').message, 'foo'); assert.same(AggregateError([1], 123).message, '123'); assert.same(AggregateError([1]).message, ''); assert.deepEqual(AggregateError([1, 2, 3]).errors, [1, 2, 3]); assert.throws(() => AggregateError([1], Symbol()), 'throws on symbol as a message'); assert.same(toString(AggregateError([1])), '[object Error]', 'Object#toString'); assert.true(AggregateError([1], 1) instanceof AggregateError, 'no cause, without new'); assert.true(new AggregateError([1], 1) instanceof AggregateError, 'no cause, with new'); assert.true(AggregateError([1], 1, {}) instanceof AggregateError, 'with options, without new'); assert.true(new AggregateError([1], 1, {}) instanceof AggregateError, 'with options, with new'); assert.true(AggregateError([1], 1, 'foo') instanceof AggregateError, 'non-object options, without new'); assert.true(new AggregateError([1], 1, 'foo') instanceof AggregateError, 'non-object options, with new'); assert.same(AggregateError([1], 1, { cause: 7 }).cause, 7, 'cause, without new'); assert.same(new AggregateError([1], 1, { cause: 7 }).cause, 7, 'cause, with new'); assert.same(AggregateError([1], 1, create({ cause: 7 })).cause, 7, 'prototype cause, without new'); assert.same(new AggregateError([1], 1, create({ cause: 7 })).cause, 7, 'prototype cause, with new'); let error = AggregateError([1], 1, { cause: 7 }); assert.deepEqual(error.errors, [1]); assert.same(error.name, 'AggregateError', 'instance name'); assert.same(error.message, '1', 'instance message'); assert.same(error.cause, 7, 'instance cause'); // eslint-disable-next-line no-prototype-builtins -- safe assert.true(error.hasOwnProperty('cause'), 'cause is own'); error = AggregateError([1]); assert.deepEqual(error.errors, [1]); assert.same(error.message, '', 'default instance message'); assert.same(error.cause, undefined, 'default instance cause undefined'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(error.hasOwnProperty('cause'), 'default instance cause missed'); }); core-js-3.33.2/tests/unit-pure/es.array.at.js000066400000000000000000000015711451776221300207370ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import at from 'core-js-pure/es/array/at'; QUnit.test('Array#at', assert => { assert.isFunction(at); assert.same(1, at([1, 2, 3], 0)); assert.same(2, at([1, 2, 3], 1)); assert.same(3, at([1, 2, 3], 2)); assert.same(undefined, at([1, 2, 3], 3)); assert.same(3, at([1, 2, 3], -1)); assert.same(2, at([1, 2, 3], -2)); assert.same(1, at([1, 2, 3], -3)); assert.same(undefined, at([1, 2, 3], -4)); assert.same(1, at([1, 2, 3], 0.4)); assert.same(1, at([1, 2, 3], 0.5)); assert.same(1, at([1, 2, 3], 0.6)); assert.same(1, at([1], NaN)); assert.same(1, at([1])); assert.same(1, at([1, 2, 3], -0)); assert.same(undefined, at(Array(1), 0)); assert.same(1, at({ 0: 1, length: 1 }, 0)); if (STRICT) { assert.throws(() => at(null, 0), TypeError); assert.throws(() => at(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.concat.js000066400000000000000000000030021451776221300215710ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import concat from 'core-js-pure/es/array/concat'; /* eslint-disable no-sparse-arrays -- required for testing */ QUnit.test('Array#concat', assert => { assert.isFunction(concat); let array = [1, 2]; const sparseArray = [1, , 2]; const nonSpreadableArray = [1, 2]; nonSpreadableArray[Symbol.isConcatSpreadable] = false; const arrayLike = { 0: 1, 1: 2, length: 2 }; const spreadableArrayLike = { 0: 1, 1: 2, length: 2, [Symbol.isConcatSpreadable]: true }; assert.deepEqual(concat(array), [1, 2], '#1'); assert.deepEqual(concat(sparseArray), [1, , 2], '#2'); assert.deepEqual(concat(nonSpreadableArray), [[1, 2]], '#3'); assert.deepEqual(concat(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#4'); assert.deepEqual(concat(spreadableArrayLike), [1, 2], '#5'); assert.deepEqual(concat([], array), [1, 2], '#6'); assert.deepEqual(concat([], sparseArray), [1, , 2], '#7'); assert.deepEqual(concat([], nonSpreadableArray), [[1, 2]], '#8'); assert.deepEqual(concat([], arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#9'); assert.deepEqual(concat([], spreadableArrayLike), [1, 2], '#10'); assert.deepEqual(concat(array, sparseArray, nonSpreadableArray, arrayLike, spreadableArrayLike), [ 1, 2, 1, , 2, [1, 2], { 0: 1, 1: 2, length: 2 }, 1, 2, ], '#11'); array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(concat(array).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/es.array.copy-within.js000066400000000000000000000024111451776221300225770ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import copyWithin from 'core-js-pure/es/array/copy-within'; QUnit.test('Array#copyWithin', assert => { assert.isFunction(copyWithin); const array = [1]; assert.same(copyWithin(array, 0), array); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3), [4, 5, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]); if (STRICT) { assert.throws(() => copyWithin(null, 0), TypeError); assert.throws(() => copyWithin(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.every.js000066400000000000000000000023241451776221300214620ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import every from 'core-js-pure/es/array/every'; QUnit.test('Array#every', assert => { assert.isFunction(every); const array = [1]; const context = {}; every(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(every([1, 2, 3], it => typeof it == 'number')); assert.true(every([1, 2, 3], it => it < 4)); assert.false(every([1, 2, 3], it => it < 3)); assert.false(every([1, 2, 3], it => typeof it == 'string')); assert.true(every([1, 2, 3], function () { return +this === 1; }, 1)); let rez = ''; every([1, 2, 3], (value, key) => rez += key); assert.same(rez, '012'); const arr = [1, 2, 3]; assert.true(every(arr, (value, key, that) => that === arr)); if (STRICT) { assert.throws(() => every(null, () => { /* empty */ }), TypeError); assert.throws(() => every(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.fill.js000066400000000000000000000014521451776221300212570ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import fill from 'core-js-pure/es/array/fill'; QUnit.test('Array#fill', assert => { assert.isFunction(fill); const array = fill(Array(5), 5); assert.same(array, array); assert.deepEqual(fill(Array(5), 5), [5, 5, 5, 5, 5]); assert.deepEqual(fill(Array(5), 5, 1), [undefined, 5, 5, 5, 5]); assert.deepEqual(fill(Array(5), 5, 1, 4), [undefined, 5, 5, 5, undefined]); assert.deepEqual(fill(Array(5), 5, 6, 1), [undefined, undefined, undefined, undefined, undefined]); assert.deepEqual(fill(Array(5), 5, -3, 4), [undefined, undefined, 5, 5, undefined]); assert.arrayEqual(fill({ length: 5 }, 5), [5, 5, 5, 5, 5]); if (STRICT) { assert.throws(() => fill(null, 0), TypeError); assert.throws(() => fill(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.filter.js000066400000000000000000000021571451776221300216210ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import filter from 'core-js-pure/es/array/filter'; QUnit.test('Array#filter', assert => { assert.isFunction(filter); let array = [1]; const context = {}; filter(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], filter([1, 2, 3, 'q', {}, 4, true, 5], it => typeof it == 'number')); if (STRICT) { assert.throws(() => filter(null, () => { /* empty */ }), TypeError); assert.throws(() => filter(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(filter(array, Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/es.array.find-index.js000066400000000000000000000011451451776221300223550ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import findIndex from 'core-js-pure/es/array/find-index'; QUnit.test('Array#findIndex', assert => { assert.isFunction(findIndex); const array = [1]; const context = {}; findIndex(array, function (value, key, that) { assert.same(this, context); assert.same(value, 1); assert.same(key, 0); assert.same(that, array); }, context); assert.same(findIndex([1, 3, NaN, 42, {}], it => it === 42), 3); if (STRICT) { assert.throws(() => findIndex(null, 0), TypeError); assert.throws(() => findIndex(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.find-last-index.js000066400000000000000000000023241451776221300233160ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import findLastIndex from 'core-js-pure/es/array/find-last-index'; QUnit.test('Array#findLastIndex', assert => { assert.isFunction(findLastIndex); const array = [1]; const context = {}; findLastIndex(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(findLastIndex([{}, 2, NaN, 42, 1], it => !(it % 2)), 3); assert.same(findLastIndex([{}, 2, NaN, 42, 1], it => it === 43), -1); let values = ''; let keys = ''; findLastIndex([1, 2, 3], (value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); if (STRICT) { assert.throws(() => findLastIndex(null, 0), TypeError); assert.throws(() => findLastIndex(undefined, 0), TypeError); } assert.notThrows(() => findLastIndex({ length: -1, 0: 1, }, () => { throw new Error(); }) === -1, 'uses ToLength'); }); core-js-3.33.2/tests/unit-pure/es.array.find-last.js000066400000000000000000000022531451776221300222120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import findLast from 'core-js-pure/es/array/find-last'; QUnit.test('Array#findLast', assert => { assert.isFunction(findLast); const array = [1]; const context = {}; findLast(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(findLast([{}, 2, NaN, 42, 1], it => !(it % 2)), 42); assert.same(findLast([{}, 2, NaN, 42, 1], it => it === 43), undefined); let values = ''; let keys = ''; findLast([1, 2, 3], (value, key) => { values += value; keys += key; }); assert.same(values, '321'); assert.same(keys, '210'); if (STRICT) { assert.throws(() => findLast(null, 0), TypeError); assert.throws(() => findLast(undefined, 0), TypeError); } assert.notThrows(() => findLast({ length: -1, 0: 1, }, () => { throw new Error(); }) === undefined, 'uses ToLength'); }); core-js-3.33.2/tests/unit-pure/es.array.find.js000066400000000000000000000012031451776221300212430ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import find from 'core-js-pure/es/array/find'; QUnit.test('Array#find', assert => { assert.isFunction(find); const array = [1]; const context = {}; find(array, function (value, key, that) { assert.same(this, context); assert.same(value, 1); assert.same(key, 0); assert.same(that, array); }, context); assert.same(find([1, 3, NaN, 42, {}], it => it === 42), 42); assert.same(find([1, 3, NaN, 42, {}], it => it === 43), undefined); if (STRICT) { assert.throws(() => find(null, 0), TypeError); assert.throws(() => find(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.flat-map.js000066400000000000000000000017521451776221300220350ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import flatMap from 'core-js-pure/es/array/flat-map'; QUnit.test('Array#flatMap', assert => { assert.isFunction(flatMap); assert.deepEqual(flatMap([], it => it), []); assert.deepEqual(flatMap([1, 2, 3], it => it), [1, 2, 3]); assert.deepEqual(flatMap([1, 2, 3], it => [it, it]), [1, 1, 2, 2, 3, 3]); assert.deepEqual(flatMap([1, 2, 3], it => [[it], [it]]), [[1], [1], [2], [2], [3], [3]]); assert.deepEqual(flatMap([1, [2, 3]], () => 1), [1, 1]); const array = [1]; const context = {}; flatMap(array, function (value, index, that) { assert.same(value, 1); assert.same(index, 0); assert.same(that, array); assert.same(this, context); }, context); if (STRICT) { assert.throws(() => flatMap(null, it => it), TypeError); assert.throws(() => flatMap(undefined, it => it), TypeError); } assert.notThrows(() => flatMap({ length: -1 }, () => { throw new Error(); }).length === 0, 'uses ToLength'); }); core-js-3.33.2/tests/unit-pure/es.array.flat.js000066400000000000000000000017541451776221300212640ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; import flat from 'core-js-pure/es/array/flat'; import defineProperty from 'core-js-pure/es/object/define-property'; QUnit.test('Array#flat', assert => { assert.isFunction(flat); assert.deepEqual(flat([]), []); const array = [1, [2, 3], [4, [5, 6]]]; assert.deepEqual(flat(array, 0), array); assert.deepEqual(flat(array, 1), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(flat(array), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(flat(array, 2), [1, 2, 3, 4, 5, 6]); assert.deepEqual(flat(array, 3), [1, 2, 3, 4, 5, 6]); assert.deepEqual(flat(array, -1), array); assert.deepEqual(flat(array, Infinity), [1, 2, 3, 4, 5, 6]); if (STRICT) { assert.throws(() => flat(null), TypeError); assert.throws(() => flat(undefined), TypeError); } if (DESCRIPTORS) { assert.notThrows(() => flat(defineProperty({ length: -1 }, 0, { get() { throw new Error(); }, })).length === 0, 'uses ToLength'); } }); core-js-3.33.2/tests/unit-pure/es.array.for-each.js000066400000000000000000000025111451776221300220120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import forEach from 'core-js-pure/es/array/for-each'; QUnit.test('Array#forEach', assert => { assert.isFunction(forEach); let array = [1]; const context = {}; forEach(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); let result = ''; forEach([1, 2, 3], it => { result += it; }); assert.same(result, '123'); result = ''; forEach([1, 2, 3], (value, key) => { result += key; }); assert.same(result, '012'); result = ''; forEach([1, 2, 3], (value, key, that) => { result += that; }); assert.same(result, '1,2,31,2,31,2,3'); result = ''; forEach([1, 2, 3], function () { result += this; }, 1); assert.same(result, '111'); result = ''; array = []; array[5] = ''; forEach(array, (value, key) => { result += key; }); assert.same(result, '5'); if (STRICT) { assert.throws(() => forEach(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.from.js000066400000000000000000000104351451776221300212750ustar00rootroot00000000000000/* eslint-disable prefer-rest-params -- required for testing */ import { DESCRIPTORS } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; import Symbol from 'core-js-pure/es/symbol'; import defineProperty from 'core-js-pure/es/object/define-property'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import from from 'core-js-pure/es/array/from'; QUnit.test('Array.from', assert => { assert.isFunction(from); assert.arity(from, 1); let types = { 'array-like': { length: '3', 0: '1', 1: '2', 2: '3', }, arguments: function () { return arguments; }('1', '2', '3'), array: ['1', '2', '3'], iterable: createIterable(['1', '2', '3']), string: '123', }; for (const type in types) { const data = types[type]; assert.arrayEqual(from(data), ['1', '2', '3'], `Works with ${ type }`); assert.arrayEqual(from(data, it => it ** 2), [1, 4, 9], `Works with ${ type } + mapFn`); } types = { 'array-like': { length: 1, 0: 1, }, arguments: function () { return arguments; }(1), array: [1], iterable: createIterable([1]), string: '1', }; for (const type in types) { const data = types[type]; const context = {}; assert.arrayEqual(from(data, function (value, key) { assert.same(this, context, `Works with ${ type }, correct callback context`); assert.same(value, type === 'string' ? '1' : 1, `Works with ${ type }, correct callback key`); assert.same(key, 0, `Works with ${ type }, correct callback value`); assert.same(arguments.length, 2, `Works with ${ type }, correct callback arguments number`); return 42; }, context), [42], `Works with ${ type }, correct result`); } const primitives = [false, true, 0]; for (const primitive of primitives) { assert.arrayEqual(from(primitive), [], `Works with ${ primitive }`); } assert.throws(() => from(null), TypeError, 'Throws on null'); assert.throws(() => from(undefined), TypeError, 'Throws on undefined'); assert.arrayEqual(from('𠮷𠮷𠮷'), ['𠮷', '𠮷', '𠮷'], 'Uses correct string iterator'); let done = true; from(createIterable([1, 2, 3], { return() { return done = false; }, }), () => false); assert.true(done, '.return #default'); done = false; try { from(createIterable([1, 2, 3], { return() { return done = true; }, }), () => { throw new Error(); }); } catch { /* empty */ } assert.true(done, '.return #throw'); class C { /* empty */ } let instance = from.call(C, createIterable([1, 2])); assert.true(instance instanceof C, 'generic, iterable case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, iterable case, elements'); instance = from.call(C, { 0: 1, 1: 2, length: 2, }); assert.true(instance instanceof C, 'generic, array-like case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; assert.arrayEqual(from(array), [1, 2, 3], 'Array with custom iterator, elements'); assert.true(done, 'call @@iterator in Array with custom iterator'); array = [1, 2, 3]; delete array[1]; assert.arrayEqual(from(array, String), ['1', 'undefined', '3'], 'Ignores holes'); assert.notThrows(() => from({ length: -1, 0: 1, }, () => { throw new Error(); }), 'Uses ToLength'); assert.arrayEqual(from([], undefined), [], 'Works with undefined as second argument'); assert.throws(() => from([], null), TypeError, 'Throws with null as second argument'); assert.throws(() => from([], 0), TypeError, 'Throws with 0 as second argument'); assert.throws(() => from([], ''), TypeError, 'Throws with "" as second argument'); assert.throws(() => from([], false), TypeError, 'Throws with false as second argument'); assert.throws(() => from([], {}), TypeError, 'Throws with {} as second argument'); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); from.call(C, [1, 2, 3]); assert.false(called, 'Should not call prototype accessors'); } }); core-js-3.33.2/tests/unit-pure/es.array.includes.js000066400000000000000000000013171451776221300221370ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import includes from 'core-js-pure/es/array/includes'; QUnit.test('Array#includes', assert => { assert.isFunction(includes); const object = {}; const array = [1, 2, 3, -0, object]; assert.true(includes(array, 1)); assert.true(includes(array, -0)); assert.true(includes(array, 0)); assert.true(includes(array, object)); assert.false(includes(array, 4)); assert.false(includes(array, -0.5)); assert.false(includes(array, {})); assert.true(includes(Array(1), undefined)); assert.true(includes([NaN], NaN)); if (STRICT) { assert.throws(() => includes(null, 0), TypeError); assert.throws(() => includes(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.index-of.js000066400000000000000000000013621451776221300220420ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import indexOf from 'core-js-pure/es/array/index-of'; QUnit.test('Array#indexOf', assert => { assert.isFunction(indexOf); assert.same(0, indexOf([1, 1, 1], 1)); assert.same(-1, indexOf([1, 2, 3], 1, 1)); assert.same(1, indexOf([1, 2, 3], 2, 1)); assert.same(-1, indexOf([1, 2, 3], 2, -1)); assert.same(1, indexOf([1, 2, 3], 2, -2)); assert.same(-1, indexOf([NaN], NaN)); assert.same(3, indexOf(Array(2).concat([1, 2, 3]), 2)); assert.same(-1, indexOf(Array(1), undefined)); assert.same(0, indexOf([1], 1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => indexOf(null, 0), TypeError); assert.throws(() => indexOf(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.is-array.js000066400000000000000000000005111451776221300220530ustar00rootroot00000000000000import isArray from 'core-js-pure/es/array/is-array'; QUnit.test('Array.isArray', assert => { assert.isFunction(isArray); assert.false(isArray({})); assert.false(isArray(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.true(isArray([])); }); core-js-3.33.2/tests/unit-pure/es.array.iterator.js000066400000000000000000000046331451776221300221660ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import getIterator from 'core-js-pure/es/get-iterator'; import { keys, values, entries } from 'core-js-pure/es/array'; QUnit.test('Array#@@iterator', assert => { assert.isFunction(values); const iterator = getIterator(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.same(String(iterator), '[object Array Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#keys', assert => { assert.isFunction(keys); const iterator = keys(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 0, done: false, }); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: 2, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#values', assert => { assert.isFunction(values); const iterator = values(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#entries', assert => { assert.isFunction(entries); const iterator = entries(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: [1, 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: [2, 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/es.array.join.js000066400000000000000000000006431451776221300212710ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import join from 'core-js-pure/es/array/join'; QUnit.test('Array#join', assert => { assert.isFunction(join); assert.same(join([1, 2, 3], undefined), '1,2,3'); assert.same(join('123'), '1,2,3'); assert.same(join('123', '|'), '1|2|3'); if (STRICT) { assert.throws(() => join(null), TypeError); assert.throws(() => join(undefined), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.last-index-of.js000066400000000000000000000014541451776221300230050ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import lastIndexOf from 'core-js-pure/es/array/last-index-of'; QUnit.test('Array#lastIndexOf', assert => { assert.isFunction(lastIndexOf); assert.same(2, lastIndexOf([1, 1, 1], 1)); assert.same(-1, lastIndexOf([1, 2, 3], 3, 1)); assert.same(1, lastIndexOf([1, 2, 3], 2, 1)); assert.same(-1, lastIndexOf([1, 2, 3], 2, -3)); assert.same(-1, lastIndexOf([1, 2, 3], 1, -4)); assert.same(1, lastIndexOf([1, 2, 3], 2, -2)); assert.same(-1, lastIndexOf([NaN], NaN)); assert.same(1, lastIndexOf([1, 2, 3].concat(Array(2)), 2)); assert.same(0, lastIndexOf([1], 1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => lastIndexOf(null, 0), TypeError); assert.throws(() => lastIndexOf(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.map.js000066400000000000000000000023151451776221300211050ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import map from 'core-js-pure/es/array/map'; QUnit.test('Array#map', assert => { assert.isFunction(map); let array = [1]; const context = {}; map(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([2, 3, 4], map([1, 2, 3], it => it + 1)); assert.deepEqual([1, 3, 5], map([1, 2, 3], (value, key) => value + key)); assert.deepEqual([2, 2, 2], map([1, 2, 3], function () { return +this; }, 2)); if (STRICT) { assert.throws(() => map(null, () => { /* empty */ }), TypeError); assert.throws(() => map(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(map(array, Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/es.array.of.js000066400000000000000000000013701451776221300207340ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import defineProperty from 'core-js-pure/es/object/define-property'; import of from 'core-js-pure/es/array/of'; QUnit.test('Array.of', assert => { assert.isFunction(of); assert.arity(of, 0); assert.deepEqual(of(1), [1]); assert.deepEqual(of(1, 2, 3), [1, 2, 3]); class C { /* empty */ } const instance = of.call(C, 1, 2); assert.true(instance instanceof C); assert.same(instance[0], 1); assert.same(instance[1], 2); assert.same(instance.length, 2); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); of.call(C, 1, 2, 3); assert.false(called, 'Should not call prototype accessors'); } }); core-js-3.33.2/tests/unit-pure/es.array.push.js000066400000000000000000000016231451776221300213100ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; import push from 'core-js-pure/es/array/virtual/push'; import defineProperty from 'core-js-pure/es/object/define-property'; QUnit.test('Array#push', assert => { assert.isFunction(push); const object = { length: 0x100000000 }; assert.same(push.call(object, 1), 0x100000001, 'proper ToLength #1'); assert.same(object[0x100000000], 1, 'proper ToLength #2'); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => push.call(defineProperty([], 'length', { writable: false }), 1), TypeError, 'non-writable length, with arg'); assert.throws(() => push.call(defineProperty([], 'length', { writable: false })), TypeError, 'non-writable length, without arg'); } assert.throws(() => push.call(null), TypeError); assert.throws(() => push.call(undefined), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.reduce-right.js000066400000000000000000000033531451776221300227150ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import reduceRight from 'core-js-pure/es/array/reduce-right'; QUnit.test('Array#reduceRight', assert => { assert.isFunction(reduceRight); const array = [1]; const accumulator = {}; reduceRight(array, function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(reduceRight([1, 2, 3], ((a, b) => a + b), 1), 7, 'works with initial accumulator'); reduceRight([1, 2], (memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same(reduceRight([1, 2, 3], (a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; reduceRight([1, 2, 3], (memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.same(reduceRight({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); assert.throws(() => reduceRight([], () => { /* empty */ }), TypeError); assert.throws(() => reduceRight(Array(5), () => { /* empty */ }), TypeError); if (STRICT) { assert.throws(() => reduceRight(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduceRight(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.reduce.js000066400000000000000000000032441451776221300216010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import reduce from 'core-js-pure/es/array/reduce'; QUnit.test('Array#reduce', assert => { assert.isFunction(reduce); const array = [1]; const accumulator = {}; reduce(array, function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(reduce([1, 2, 3], ((a, b) => a + b), 1), 7, 'works with initial accumulator'); reduce([1, 2], (memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same(reduce([1, 2, 3], (a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; reduce([1, 2, 3], (memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.same(reduce({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); assert.throws(() => reduce([], () => { /* empty */ }), TypeError); assert.throws(() => reduce(Array(5), () => { /* empty */ }), TypeError); if (STRICT) { assert.throws(() => reduce(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.reverse.js000066400000000000000000000007361451776221300220100ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import reverse from 'core-js-pure/es/array/reverse'; QUnit.test('Array#reverse', assert => { assert.isFunction(reverse); const a = [1, 2.2, 3.3]; function fn() { +a; reverse(a); } fn(); assert.arrayEqual(a, [3.3, 2.2, 1]); if (STRICT) { assert.throws(() => reverse(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reverse(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.slice.js000066400000000000000000000025121451776221300214260ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import isArray from 'core-js-pure/es/array/is-array'; import slice from 'core-js-pure/es/array/slice'; QUnit.test('Array#slice', assert => { assert.isFunction(slice); let array = ['1', '2', '3', '4', '5']; assert.deepEqual(slice(array), array); assert.deepEqual(slice(array, 1, 3), ['2', '3']); assert.deepEqual(slice(array, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice(array, 1, -1), ['2', '3', '4']); assert.deepEqual(slice(array, -2, -1), ['4']); assert.deepEqual(slice(array, -2, -3), []); const string = '12345'; assert.deepEqual(slice(string), array); assert.deepEqual(slice(string, 1, 3), ['2', '3']); assert.deepEqual(slice(string, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice(string, 1, -1), ['2', '3', '4']); assert.deepEqual(slice(string, -2, -1), ['4']); assert.deepEqual(slice(string, -2, -3), []); const list = GLOBAL.document && document.body && document.body.childNodes; if (list) { assert.notThrows(() => isArray(slice(list)), 'works with NodeList'); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(slice(array).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/es.array.some.js000066400000000000000000000023561451776221300213000ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import some from 'core-js-pure/es/array/some'; QUnit.test('Array#some', assert => { assert.isFunction(some); let array = [1]; const context = {}; some(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(some([1, '2', 3], it => typeof it == 'number')); assert.true(some([1, 2, 3], it => it < 3)); assert.false(some([1, 2, 3], it => it < 0)); assert.false(some([1, 2, 3], it => typeof it == 'string')); assert.false(some([1, 2, 3], function () { return +this !== 1; }, 1)); let result = ''; some([1, 2, 3], (value, key) => { result += key; return false; }); assert.same(result, '012'); array = [1, 2, 3]; assert.false(some(array, (value, key, that) => that !== array)); if (STRICT) { assert.throws(() => some(null, () => { /* empty */ }), TypeError); assert.throws(() => some(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.sort.js000066400000000000000000000062311451776221300213200ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import sort from 'core-js-pure/es/array/sort'; QUnit.test('Array#sort', assert => { assert.isFunction(sort); assert.notThrows(() => sort([1, 2, 3], undefined), 'works with undefined'); assert.throws(() => sort([1, 2, 3], null), 'throws on null'); assert.throws(() => sort([1, 2, 3], {}), 'throws on {}'); assert.deepEqual(sort([1, 3, 2]), [1, 2, 3], '#1'); assert.deepEqual(sort([1, 3, 2, 11]), [1, 11, 2, 3], '#2'); assert.deepEqual(sort([1, -1, 3, NaN, 2, 0, 11, -0]), [-1, 0, -0, 1, 11, 2, 3, NaN], '#3'); let array = Array(5); array[0] = 1; array[2] = 3; array[4] = 2; let expected = Array(5); expected[0] = 1; expected[1] = 2; expected[2] = 3; assert.deepEqual(sort(array), expected, 'holes'); array = 'zyxwvutsrqponMLKJIHGFEDCBA'.split(''); expected = 'ABCDEFGHIJKLMnopqrstuvwxyz'.split(''); assert.deepEqual(sort(array), expected, 'alpha #1'); array = 'ёяюэьыъщшчцхфутсрПОНМЛКЙИЗЖЕДГВБА'.split(''); expected = 'АБВГДЕЖЗИЙКЛМНОПрстуфхцчшщъыьэюяё'.split(''); assert.deepEqual(sort(array), expected, 'alpha #2'); array = [undefined, 1]; assert.notThrows(() => sort(array, () => { throw 1; }), 'undefined #1'); assert.deepEqual(array, [1, undefined], 'undefined #2'); const object = { valueOf: () => 1, toString: () => -1, }; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; expected = { 0: -1, 1: object, 2: 1, 3: 2, 4: Infinity, 5: NaN, 6: 'X', 7: 'a', 8: true, 9: undefined, length: 11, }; assert.deepEqual(sort(array), expected, 'custom generic'); let index, mod, code, chr, value; expected = Array(516); array = Array(516); for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } sort(array, (a, b) => (a / 4 | 0) - (b / 4 | 0)); assert.true(1 / sort([0, -0])[0] > 0, '-0'); assert.arrayEqual(array, expected, 'stable #1'); let result = ''; array = []; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } sort(array, (a, b) => b.v - a.v); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } assert.same(result, 'DGBEFHACIJK', 'stable #2'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => sort([Symbol(1), Symbol(2)]), 'w/o cmp throws on symbols'); } if (STRICT) { assert.throws(() => sort(null), TypeError, 'ToObject(this)'); assert.throws(() => sort(undefined), TypeError, 'ToObject(this)'); } }); core-js-3.33.2/tests/unit-pure/es.array.splice.js000066400000000000000000000031651451776221300216130ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import splice from 'core-js-pure/es/array/splice'; import defineProperty from 'core-js-pure/es/object/define-property'; QUnit.test('Array#splice', assert => { assert.isFunction(splice); let array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2), [3, 4, 5]); assert.deepEqual(array, [1, 2]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, -2), [4, 5]); assert.deepEqual(array, [1, 2, 3]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, 2), [3, 4]); assert.deepEqual(array, [1, 2, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, -2), []); assert.deepEqual(array, [1, 2, 3, 4, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, 2, 6, 7), [3, 4]); assert.deepEqual(array, [1, 2, 6, 7, 5]); // ES6 semantics array = [0, 1, 2]; assert.deepEqual(splice(array, 0), [0, 1, 2]); array = [0, 1, 2]; assert.deepEqual(splice(array, 1), [1, 2]); array = [0, 1, 2]; assert.deepEqual(splice(array, 2), [2]); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => splice(defineProperty([1, 2, 3], 'length', { writable: false }), 1, 1), TypeError, 'non-writable length'); } assert.throws(() => splice(null), TypeError); assert.throws(() => splice(undefined), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(splice(array).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/es.array.to-reversed.js000066400000000000000000000022631451776221300225710ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import toReversed from 'core-js-pure/es/array/to-reversed'; QUnit.test('Array#toReversed', assert => { assert.isFunction(toReversed); let array = [1, 2]; assert.notSame(toReversed(array), array, 'immutable'); assert.deepEqual(toReversed([1, 2.2, 3.3]), [3.3, 2.2, 1], 'basic'); const object = {}; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; const expected = [ Infinity, undefined, NaN, object, true, 'a', -1, 'X', 1, 2, undefined, ]; assert.deepEqual(toReversed(array), expected, 'non-array target'); array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(toReversed(array) instanceof Array, 'non-generic'); if (STRICT) { assert.throws(() => toReversed(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => toReversed(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.to-sorted.js000066400000000000000000000070401451776221300222500ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import toSorted from 'core-js-pure/es/array/to-sorted'; QUnit.test('Array#toSorted', assert => { assert.isFunction(toSorted); let array = [1]; assert.notSame(toSorted(array), array, 'immutable'); assert.deepEqual(toSorted([1, 3, 2]), [1, 2, 3], '#1'); assert.deepEqual(toSorted([1, 3, 2, 11]), [1, 11, 2, 3], '#2'); assert.deepEqual(toSorted([1, -1, 3, NaN, 2, 0, 11, -0]), [-1, 0, -0, 1, 11, 2, 3, NaN], '#1'); array = Array(5); array[0] = 1; array[2] = 3; array[4] = 2; let expected = Array(5); expected[0] = 1; expected[1] = 2; expected[2] = 3; assert.deepEqual(toSorted(array), expected, 'holes'); array = 'zyxwvutsrqponMLKJIHGFEDCBA'.split(''); expected = 'ABCDEFGHIJKLMnopqrstuvwxyz'.split(''); assert.deepEqual(toSorted(array), expected, 'alpha #1'); array = 'ёяюэьыъщшчцхфутсрПОНМЛКЙИЗЖЕДГВБА'.split(''); expected = 'АБВГДЕЖЗИЙКЛМНОПрстуфхцчшщъыьэюяё'.split(''); assert.deepEqual(toSorted(array), expected, 'alpha #2'); array = [undefined, 1]; assert.notThrows(() => array = toSorted(array, () => { throw 1; }), 'undefined #1'); assert.deepEqual(array, [1, undefined], 'undefined #2'); const object = { valueOf: () => 1, toString: () => -1, }; array = { 0: undefined, 1: 2, 2: 1, 3: 'X', 4: -1, 5: 'a', 6: true, 7: object, 8: NaN, 10: Infinity, length: 11, }; expected = [ -1, object, 1, 2, Infinity, NaN, 'X', 'a', true, undefined, undefined, ]; assert.deepEqual(toSorted(array), expected, 'non-array target'); let index, mod, code, chr, value; expected = Array(516); array = Array(516); for (index = 0; index < 516; index++) { mod = index % 4; array[index] = 515 - index; expected[index] = index - 2 * mod + 3; } assert.arrayEqual(toSorted(array, (a, b) => (a / 4 | 0) - (b / 4 | 0)), expected, 'stable #1'); assert.true(1 / toSorted([0, -0])[0] > 0, '-0'); let result = ''; array = []; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { array.push({ k: chr + index, v: value }); } } array = toSorted(array, (a, b) => b.v - a.v); for (index = 0; index < array.length; index++) { chr = array[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } assert.same(result, 'DGBEFHACIJK', 'stable #2'); assert.notThrows(() => toSorted([1, 2, 3], undefined).length === 3, 'works with undefined'); assert.throws(() => toSorted([1, 2, 3], null), 'throws on null'); assert.throws(() => toSorted([1, 2, 3], {}), 'throws on {}'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => toSorted([Symbol(1), Symbol(2)]), 'w/o cmp throws on symbols'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(toSorted(array) instanceof Array, 'non-generic'); if (STRICT) { assert.throws(() => toSorted(null), TypeError, 'ToObject(this)'); assert.throws(() => toSorted(undefined), TypeError, 'ToObject(this)'); } }); core-js-3.33.2/tests/unit-pure/es.array.to-spliced.js000066400000000000000000000017571451776221300224040ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import toSpliced from 'core-js-pure/es/array/to-spliced'; QUnit.test('Array#toSpliced', assert => { assert.isFunction(toSpliced); let array = [1, 2, 3, 4, 5]; assert.notSame(toSpliced(array, 2), array); assert.deepEqual(toSpliced([1, 2, 3, 4, 5], 2), [1, 2]); assert.deepEqual(toSpliced([1, 2, 3, 4, 5], -2), [1, 2, 3]); assert.deepEqual(toSpliced([1, 2, 3, 4, 5], 2, 2), [1, 2, 5]); assert.deepEqual(toSpliced([1, 2, 3, 4, 5], 2, -2), [1, 2, 3, 4, 5]); assert.deepEqual(toSpliced([1, 2, 3, 4, 5], 2, 2, 6, 7), [1, 2, 6, 7, 5]); if (STRICT) { assert.throws(() => toSpliced(null), TypeError); assert.throws(() => toSpliced(undefined), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(toSpliced(array) instanceof Array, 'non-generic'); }); core-js-3.33.2/tests/unit-pure/es.array.unshift.js000066400000000000000000000014651451776221300220150ustar00rootroot00000000000000import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants.js'; import unshift from 'core-js-pure/es/array/virtual/unshift'; import defineProperty from 'core-js-pure/es/object/define-property'; QUnit.test('Array#unshift', assert => { assert.isFunction(unshift); assert.same(unshift.call([1], 0), 2, 'proper result'); if (STRICT) { if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) { assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false }), 1), TypeError, 'non-writable length, with arg'); assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false })), TypeError, 'non-writable length, without arg'); } assert.throws(() => unshift.call(null), TypeError); assert.throws(() => unshift.call(undefined), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.array.with.js000066400000000000000000000017601451776221300213060ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import withAt from 'core-js-pure/es/array/with'; QUnit.test('Array#with', assert => { assert.isFunction(withAt); let array = [1, 2, 3, 4, 5]; assert.notSame(withAt(array, 2, 1), array); assert.deepEqual(withAt([1, 2, 3, 4, 5], 2, 6), [1, 2, 6, 4, 5]); assert.deepEqual(withAt([1, 2, 3, 4, 5], -2, 6), [1, 2, 3, 6, 5]); assert.deepEqual(withAt([1, 2, 3, 4, 5], '1', 6), [1, 6, 3, 4, 5]); assert.throws(() => withAt([1, 2, 3, 4, 5], 5, 6), RangeError); assert.throws(() => withAt([1, 2, 3, 4, 5], -6, 6), RangeError); if (STRICT) { assert.throws(() => withAt(null, 1, 2), TypeError); assert.throws(() => withAt(undefined, 1, 2), TypeError); } array = [1, 2]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.true(withAt(array, 1, 2) instanceof Array, 'non-generic'); }); core-js-3.33.2/tests/unit-pure/es.date.get-year.js000066400000000000000000000003231451776221300216410ustar00rootroot00000000000000import getYear from 'core-js-pure/es/date/get-year'; QUnit.test('Date#getYear', assert => { assert.isFunction(getYear); const date = new Date(); assert.same(getYear(date), date.getFullYear() - 1900); }); core-js-3.33.2/tests/unit-pure/es.date.now.js000066400000000000000000000002621451776221300207310ustar00rootroot00000000000000import now from 'core-js-pure/es/date/now'; QUnit.test('Date.now', assert => { assert.isFunction(now); assert.epsilon(+new Date(), now(), 10, 'Date.now() ~ +new Date'); }); core-js-3.33.2/tests/unit-pure/es.date.set-year.js000066400000000000000000000003271451776221300216610ustar00rootroot00000000000000import setYear from 'core-js-pure/es/date/set-year'; QUnit.test('Date#setYear', assert => { assert.isFunction(setYear); const date = new Date(); setYear(date, 1); assert.same(date.getFullYear(), 1901); }); core-js-3.33.2/tests/unit-pure/es.date.to-gmt-string.js000066400000000000000000000003411451776221300226370ustar00rootroot00000000000000import toGMTString from 'core-js-pure/es/date/to-gmt-string'; QUnit.test('Date#toGMTString', assert => { assert.isFunction(toGMTString); const date = new Date(); assert.same(toGMTString(date), date.toUTCString()); }); core-js-3.33.2/tests/unit-pure/es.date.to-iso-string.js000066400000000000000000000014741451776221300226520ustar00rootroot00000000000000import toISOString from 'core-js-pure/es/date/to-iso-string'; QUnit.test('Date#toISOString', assert => { assert.isFunction(toISOString); assert.same(toISOString(new Date(0)), '1970-01-01T00:00:00.000Z'); assert.same(toISOString(new Date(1e12 + 1)), '2001-09-09T01:46:40.001Z'); assert.same(toISOString(new Date(-5e13 - 1)), '0385-07-25T07:06:39.999Z'); const future = toISOString(new Date(1e15 + 1)); const properFuture = future === '+033658-09-27T01:46:40.001Z' || future === '33658-09-27T01:46:40.001Z'; assert.true(properFuture); const prehistoric = toISOString(new Date(-1e15 + 1)); const properPrehistoric = prehistoric === '-029719-04-05T22:13:20.001Z' || prehistoric === '-29719-04-05T22:13:20.001Z'; assert.true(properPrehistoric); assert.throws(() => toISOString(new Date(NaN)), RangeError); }); core-js-3.33.2/tests/unit-pure/es.date.to-json.js000066400000000000000000000007131451776221300215200ustar00rootroot00000000000000import toISOString from 'core-js-pure/es/date/to-iso-string'; import toJSON from 'core-js-pure/es/date/to-json'; QUnit.test('Date#toJSON', assert => { assert.isFunction(toJSON); if (Date.prototype.toISOString) { const date = new Date(); assert.same(toJSON(date), toISOString(date), 'base'); } assert.same(toJSON(new Date(NaN)), null, 'not finite'); assert.same(toJSON({ toISOString() { return 42; }, }), 42, 'generic'); }); core-js-3.33.2/tests/unit-pure/es.error.cause.js000066400000000000000000000046271451776221300214530ustar00rootroot00000000000000import { PROTO } from '../helpers/constants.js'; import path from 'core-js-pure/es/error'; import create from 'core-js-pure/es/object/create'; function runErrorTestCase($Error, ERROR_NAME, WEB_ASSEMBLY) { QUnit.test(`${ ERROR_NAME } constructor with 'cause' param`, assert => { assert.isFunction($Error); assert.arity($Error, 1); assert.name($Error, ERROR_NAME); if (PROTO && $Error !== path.Error) { // eslint-disable-next-line no-prototype-builtins -- safe assert.true(path.Error.isPrototypeOf($Error), 'constructor has `Error` in the prototype chain'); } assert.true($Error(1) instanceof $Error, 'no cause, without new'); assert.true(new $Error(1) instanceof $Error, 'no cause, with new'); assert.true($Error(1, {}) instanceof $Error, 'with options, without new'); assert.true(new $Error(1, {}) instanceof $Error, 'with options, with new'); assert.true($Error(1, 'foo') instanceof $Error, 'non-object options, without new'); assert.true(new $Error(1, 'foo') instanceof $Error, 'non-object options, with new'); assert.same($Error(1, { cause: 7 }).cause, 7, 'cause, without new'); assert.same(new $Error(1, { cause: 7 }).cause, 7, 'cause, with new'); assert.same($Error(1, create({ cause: 7 })).cause, 7, 'prototype cause, without new'); assert.same(new $Error(1, create({ cause: 7 })).cause, 7, 'prototype cause, with new'); let error = $Error(1, { cause: 7 }); if (!WEB_ASSEMBLY) assert.same(error.name, ERROR_NAME, 'instance name'); assert.same(error.message, '1', 'instance message'); assert.same(error.cause, 7, 'instance cause'); // eslint-disable-next-line no-prototype-builtins -- safe assert.true(error.hasOwnProperty('cause'), 'cause is own'); error = $Error(); assert.same(error.message, '', 'default instance message'); assert.same(error.cause, undefined, 'default instance cause undefined'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(error.hasOwnProperty('cause'), 'default instance cause missed'); }); } for (const ERROR_NAME of ['Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError']) { runErrorTestCase(path[ERROR_NAME], ERROR_NAME); } if (path.WebAssembly) for (const ERROR_NAME of ['CompileError', 'LinkError', 'RuntimeError']) { if (path.WebAssembly[ERROR_NAME]) runErrorTestCase(path.WebAssembly[ERROR_NAME], ERROR_NAME, true); } core-js-3.33.2/tests/unit-pure/es.escape.js000066400000000000000000000006711451776221300204560ustar00rootroot00000000000000import escape from 'core-js-pure/es/escape'; QUnit.test('escape', assert => { assert.isFunction(escape); assert.arity(escape, 1); assert.same(escape('!q2ф'), '%21q2%u0444'); assert.same(escape(null), 'null'); assert.same(escape(undefined), 'undefined'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => escape(Symbol('escape test')), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.function.bind.js000066400000000000000000000014671451776221300217620ustar00rootroot00000000000000import bind from 'core-js-pure/es/function/bind'; QUnit.test('Function#bind', assert => { assert.isFunction(bind); const object = { a: 42 }; assert.same(bind(function () { return this.a; }, object)(), 42); assert.same(new (bind(() => { /* empty */ }, object))().a, undefined); function C(a, b) { this.a = a; this.b = b; } const instance = new (bind(C, null, 1))(2); assert.true(instance instanceof C); assert.same(instance.a, 1); assert.same(instance.b, 2); assert.same(bind((it => it), null, 42)(), 42); const regExpTest = bind(RegExp.prototype.test, /a/); assert.true(regExpTest('a')); const Date2017 = bind(Date, null, 2017); const date = new Date2017(11); assert.true(date instanceof Date); assert.same(date.getFullYear(), 2017); assert.same(date.getMonth(), 11); }); core-js-3.33.2/tests/unit-pure/es.function.has-instance.js000066400000000000000000000004221451776221300234110ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Function#@@hasInstance', assert => { assert.true(Symbol.hasInstance in Function.prototype); assert.true(Function[Symbol.hasInstance](() => { /* empty */ })); assert.false(Function[Symbol.hasInstance]({})); }); core-js-3.33.2/tests/unit-pure/es.global-this.js000066400000000000000000000003261451776221300214200ustar00rootroot00000000000000import globalThis from 'core-js-pure/es/global-this'; QUnit.test('globalThis', assert => { assert.same(globalThis, Object(globalThis), 'is object'); assert.same(globalThis.Math, Math, 'contains globals'); }); core-js-3.33.2/tests/unit-pure/es.json.stringify.js000066400000000000000000000534371451776221300222140ustar00rootroot00000000000000// Some tests adopted from Test262 project and governed by the BSD license. // Copyright (c) 2012 Ecma International. All rights reserved. /* eslint-disable es/no-bigint,unicorn/no-hex-escape -- testing */ import { DESCRIPTORS, GLOBAL } from '../helpers/constants.js'; import stringify from 'core-js-pure/es/json/stringify'; import Symbol from 'core-js-pure/es/symbol'; import defineProperty from 'core-js-pure/es/object/define-property'; import keys from 'core-js-pure/es/object/keys'; import values from 'core-js-pure/es/object/values'; if (GLOBAL.JSON?.stringify) { QUnit.test('JSON.stringify', assert => { assert.isFunction(stringify); assert.arity(stringify, 3); assert.name(stringify, 'stringify'); assert.same(stringify({ a: 1, b: 2 }, []), '{}', 'replacer-array-empty-1'); assert.same(stringify({ a: 1, b: { c: 2 } }, []), '{}', 'replacer-array-empty-2'); assert.same(stringify([1, { a: 2 }], []), '[1,{}]', 'replacer-array-empty-3'); const num1 = new Number(10); num1.toString = () => 'toString'; num1.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify({ 10: 1, toString: 2, valueOf: 3, }, [num1]), '{"toString":2}', 'replacer-array-number-object'); const obj1 = { 0: 0, 1: 1, '-4': 2, 0.3: 3, '-Infinity': 4, NaN: 5, }; assert.same(stringify(obj1, [ -0, 1, -4, 0.3, -Infinity, NaN, ]), stringify(obj1), 'replacer-array-number'); const str1 = new String('str'); str1.toString = () => 'toString'; str1.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify({ str: 1, toString: 2, valueOf: 3, }, [str1]), '{"toString":2}', 'replacer-array-string-object'); assert.same(stringify({ undefined: 1 }, [undefined]), '{}', 'replacer-array-undefined-1'); // eslint-disable-next-line no-sparse-arrays -- testing assert.same(stringify({ key: 1, undefined: 2 }, [,,,]), '{}', 'replacer-array-undefined-2'); const sparse = Array(3); sparse[1] = 'key'; assert.same(stringify({ undefined: 1, key: 2 }, sparse), '{"key":2}', 'replacer-array-undefined-3'); assert.throws(() => stringify({}, () => { throw new EvalError('should not be called'); }), EvalError, 'replacer-function-abrupt'); const calls = []; const b1 = [1, 2]; const b2 = { c1: true, c2: false }; const a1 = { b1, b2: { toJSON() { return b2; }, }, }; const obj2 = { a1, a2: 'a2' }; assert.same(stringify(obj2, function (key, value) { if (key !== '') calls.push([this, key, value]); return value; }), stringify(obj2), 'replacer-function-arguments-1'); assert.arrayEqual(calls[0], [obj2, 'a1', a1], 'replacer-function-arguments-2'); assert.arrayEqual(calls[1], [a1, 'b1', b1], 'replacer-function-arguments-3'); assert.arrayEqual(calls[2], [b1, '0', 1], 'replacer-function-arguments-4'); assert.arrayEqual(calls[3], [b1, '1', 2], 'replacer-function-arguments-5'); assert.arrayEqual(calls[4], [a1, 'b2', b2], 'replacer-function-arguments-6'); assert.arrayEqual(calls[5], [b2, 'c1', true], 'replacer-function-arguments-7'); assert.arrayEqual(calls[6], [b2, 'c2', false], 'replacer-function-arguments-8'); assert.arrayEqual(calls[7], [obj2, 'a2', 'a2'], 'replacer-function-arguments-9'); const circular1 = [{}]; assert.throws(() => stringify(circular1, () => circular1), TypeError, 'replacer-function-array-circular'); const direct1 = { prop: {} }; assert.throws(() => stringify(direct1, () => direct1), TypeError, 'replacer-function-object-circular-1'); const indirect1 = { p1: { p2: {} } }; assert.throws(() => stringify(indirect1, (key, value) => key === 'p2' ? indirect1 : value), TypeError, 'replacer-function-object-circular-2'); assert.same(stringify(1, () => { /* empty */ }), undefined, 'replacer-function-result-undefined-1'); assert.same(stringify([1], () => { /* empty */ }), undefined, 'replacer-function-result-undefined-2'); assert.same(stringify({ prop: 1 }, () => { /* empty */ }), undefined, 'replacer-function-result-undefined-3'); assert.same(stringify([1], (key, value) => value === 1 ? undefined : value), '[null]', 'replacer-function-result-undefined-4'); assert.same(stringify({ prop: 1 }, (key, value) => value === 1 ? undefined : value), '{}', 'replacer-function-result-undefined-5'); assert.same(stringify({ a: { b: [1] } }, (key, value) => value === 1 ? undefined : value), '{"a":{"b":[null]}}', 'replacer-function-result-undefined-6'); assert.same(stringify(null, (key, value) => { assert.same(value, null); switch (key) { case '': return { a1: null, a2: null }; case 'a1': return { b1: null, b2: null }; case 'a2': return 'a2'; case 'b1': return [null, null]; case 'b2': return { c1: null, c2: null }; case '0': return 1; case '1': return 2; case 'c1': return true; case 'c2': return false; } throw new EvalError('unreachable'); }), stringify({ a1: { b1: [1, 2], b2: { c1: true, c2: false, }, }, a2: 'a2', }), 'replacer-function-result'); assert.same(stringify({ toJSON() { return 'toJSON'; }, }, (_key, value) => `${ value }|replacer`), '"toJSON|replacer"', 'replacer-function-tojson-1'); assert.same(stringify({ toJSON() { return { calls: 'toJSON' }; }, }, (_key, value) => { if (value && value.calls) value.calls += '|replacer'; return value; }), '{"calls":"toJSON|replacer"}', 'replacer-function-tojson-2'); const obj4 = { key: [1] }; const json1 = '{"key":[1]}'; assert.same(stringify(obj4, {}), json1, 'replacer-wrong-type-1'); assert.same(stringify(obj4, new String('str')), json1, 'replacer-wrong-type-2'); assert.same(stringify(obj4, new Number(6.1)), json1, 'replacer-wrong-type-3'); assert.same(stringify(obj4, null), json1, 'replacer-wrong-type-4'); assert.same(stringify(obj4, ''), json1, 'replacer-wrong-type-5'); assert.same(stringify(obj4, 0), json1, 'replacer-wrong-type-6'); assert.same(stringify(obj4, Symbol('stringify replacer test')), json1, 'replacer-wrong-type-7'); assert.same(stringify(obj4, true), json1, 'replacer-wrong-type-8'); const obj5 = { a1: { b1: [1, 2, 3, 4], b2: { c1: 1, c2: 2, }, }, a2: 'a2', }; assert.same(stringify(obj5, null, -1.99999), stringify(obj5, null, -1), 'space-number-float-1'); assert.same(stringify(obj5, null, new Number(5.11111)), stringify(obj5, null, 5), 'space-number-float-2'); assert.same(stringify(obj5, null, 6.99999), stringify(obj5, null, 6), 'space-number-float-3'); assert.same(stringify(obj5, null, new Number(1)), stringify(obj5, null, 1), 'space-number-object-1'); const num2 = new Number(1); num2.toString = () => { throw new EvalError('should not be called'); }; num2.valueOf = () => 3; assert.same(stringify(obj5, null, num2), stringify(obj5, null, 3), 'space-number-object-2'); const abrupt1 = new Number(4); abrupt1.toString = () => { throw new EvalError('t262'); }; abrupt1.valueOf = () => { throw new EvalError('t262'); }; assert.throws(() => stringify(obj5, null, abrupt1), EvalError, 'space-number-object-3'); assert.same(stringify(obj5, null, new Number(-5)), stringify(obj5, null, 0), 'space-number-range-1'); assert.same(stringify(obj5, null, 10), stringify(obj5, null, 100), 'space-number-range-2'); assert.same(stringify(obj5, null, 0), stringify(obj5, null, ''), 'space-number-1'); assert.same(stringify(obj5, null, 4), stringify(obj5, null, ' '), 'space-number-2'); assert.same(stringify(obj5, null, new String('xxx')), stringify(obj5, null, 'xxx'), 'space-string-object-1'); const str2 = new String('xxx'); str2.toString = () => '---'; str2.valueOf = () => { throw new EvalError('should not be called'); }; assert.same(stringify(obj5, null, str2), stringify(obj5, null, '---'), 'space-string-object-2'); const abrupt2 = new String('xxx'); abrupt2.toString = () => { throw new EvalError('t262'); }; abrupt2.valueOf = () => { throw new EvalError('t262'); }; assert.throws(() => stringify(obj5, null, abrupt2), EvalError, 'space-string-object-3'); assert.same(stringify(obj5, null, '0123456789xxxxxxxxx'), stringify(obj5, null, '0123456789'), 'space-string-range'); assert.same(stringify(obj5, null, ''), stringify(obj5), 'space-string-1'); assert.same(stringify(obj5, null, ' '), `{ "a1": { "b1": [ 1, 2, 3, 4 ], "b2": { "c1": 1, "c2": 2 } }, "a2": "a2" }`, 'space-string-2'); assert.same(stringify(obj5), stringify(obj5, null, null), 'space-wrong-type-1'); assert.same(stringify(obj5), stringify(obj5, null, true), 'space-wrong-type-2'); assert.same(stringify(obj5), stringify(obj5, null, new Boolean(false)), 'space-wrong-type-3'); assert.same(stringify(obj5), stringify(obj5, null, Symbol('stringify space test')), 'space-wrong-type-4'); assert.same(stringify(obj5), stringify(obj5, null, {}), 'space-wrong-type-5'); const direct2 = []; direct2.push(direct2); assert.throws(() => stringify(direct2), TypeError, 'value-array-circular-1'); const indirect2 = []; indirect2.push([[indirect2]]); assert.throws(() => stringify(indirect2), TypeError, 'value-array-circular-2'); if (typeof BigInt == 'function') { assert.same(stringify(BigInt(0), (k, v) => typeof v === 'bigint' ? 'bigint' : v), '"bigint"', 'value-bigint-replacer-1'); assert.same(stringify({ x: BigInt(0) }, (k, v) => typeof v === 'bigint' ? 'bigint' : v), '{"x":"bigint"}', 'value-bigint-replacer-2'); assert.throws(() => stringify(BigInt(0)), TypeError, 'value-bigint-1'); assert.throws(() => stringify(Object(BigInt(0))), TypeError, 'value-bigint-2'); assert.throws(() => stringify({ x: BigInt(0) }), TypeError, 'value-bigint-3'); } assert.same(stringify(new Boolean(true)), 'true', 'value-boolean-object-1'); assert.same(stringify({ toJSON() { return { key: new Boolean(false) }; }, }), '{"key":false}', 'value-boolean-object-2'); assert.same(stringify([1], (k, v) => v === 1 ? new Boolean(true) : v), '[true]', 'value-boolean-object-3'); assert.same(stringify(() => { /* empty */ }), undefined, 'value-function-1'); assert.same(stringify([() => { /* empty */ }]), '[null]', 'value-function-2'); assert.same(stringify({ key() { /* empty */ } }), '{}', 'value-function-3'); assert.same(stringify(-0), '0', 'value-number-negative-zero-1'); assert.same(stringify(['-0', 0, -0]), '["-0",0,0]', 'value-number-negative-zero-2'); assert.same(stringify({ key: -0 }), '{"key":0}', 'value-number-negative-zero-3'); assert.same(stringify(Infinity), 'null', 'value-number-non-finite-1'); assert.same(stringify({ key: -Infinity }), '{"key":null}', 'value-number-non-finite-2'); assert.same(stringify([NaN]), '[null]', 'value-number-non-finite-3'); assert.same(stringify(new Number(8.5)), '8.5', 'value-number-object-1'); assert.same(stringify(['str'], (key, value) => { if (value === 'str') { const num = new Number(42); num.toString = () => { throw new EvalError('should not be called'); }; num.valueOf = () => 2; return num; } return value; }), '[2]', 'value-number-object-2'); assert.throws(() => stringify({ key: { toJSON() { const num = new Number(3.14); num.toString = () => { throw new EvalError('t262'); }; num.valueOf = () => { throw new EvalError('t262'); }; return num; }, }, }), EvalError, 'value-number-object-3'); const direct3 = { prop: null }; direct3.prop = direct3; assert.throws(() => stringify(direct3), TypeError, 'value-object-circular-1'); const indirect3 = { p1: { p2: {} } }; indirect3.p1.p2.p3 = indirect3; assert.throws(() => stringify(indirect3), TypeError, 'value-object-circular-2'); assert.same(stringify(null), 'null', 'null'); assert.same(stringify(true), 'true', 'true'); assert.same(stringify(false), 'false', 'false'); assert.same(stringify('str'), '"str"', '"str"'); assert.same(stringify(123), '123', '123'); assert.same(stringify(undefined), undefined, 'undefined'); const charToJson = { '"': '\\"', '\\': '\\\\', '\x00': '\\u0000', '\x01': '\\u0001', '\x02': '\\u0002', '\x03': '\\u0003', '\x04': '\\u0004', '\x05': '\\u0005', '\x06': '\\u0006', '\x07': '\\u0007', '\x08': '\\b', '\x09': '\\t', '\x0A': '\\n', '\x0B': '\\u000b', '\x0C': '\\f', '\x0D': '\\r', '\x0E': '\\u000e', '\x0F': '\\u000f', '\x10': '\\u0010', '\x11': '\\u0011', '\x12': '\\u0012', '\x13': '\\u0013', '\x14': '\\u0014', '\x15': '\\u0015', '\x16': '\\u0016', '\x17': '\\u0017', '\x18': '\\u0018', '\x19': '\\u0019', '\x1A': '\\u001a', '\x1B': '\\u001b', '\x1C': '\\u001c', '\x1D': '\\u001d', '\x1E': '\\u001e', '\x1F': '\\u001f', }; const chars = keys(charToJson).join(''); const charsReversed = keys(charToJson).reverse().join(''); const jsonChars = values(charToJson).join(''); const jsonCharsReversed = values(charToJson).reverse().join(''); const json = stringify({ [`name${ chars }${ charsReversed }`]: `${ charsReversed }${ chars }value` }); for (const chr in charToJson) { const count = json.split(charToJson[chr]).length - 1; assert.same(count, 4, `Every ASCII 0x${ chr.charCodeAt(0).toString(16) } serializes to ${ charToJson[chr] }`); } assert.same( json, `{"name${ jsonChars }${ jsonCharsReversed }":"${ jsonCharsReversed }${ jsonChars }value"}`, 'JSON.stringify(objectUsingControlCharacters)', ); assert.same(stringify('\uD834'), '"\\ud834"', 'JSON.stringify("\\uD834")'); assert.same(stringify('\uDF06'), '"\\udf06"', 'JSON.stringify("\\uDF06")'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'JSON.stringify("\\uD834\\uDF06")'); assert.same(stringify('\uD834\uD834\uDF06\uD834'), '"\\ud834𝌆\\ud834"', 'JSON.stringify("\\uD834\\uD834\\uDF06\\uD834")'); assert.same(stringify('\uD834\uD834\uDF06\uDF06'), '"\\ud834𝌆\\udf06"', 'JSON.stringify("\\uD834\\uD834\\uDF06\\uDF06")'); assert.same(stringify('\uDF06\uD834\uDF06\uD834'), '"\\udf06𝌆\\ud834"', 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uD834")'); assert.same(stringify('\uDF06\uD834\uDF06\uDF06'), '"\\udf06𝌆\\udf06"', 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uDF06")'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'JSON.stringify("\\uDF06\\uD834")'); assert.same(stringify('\uD834\uDF06\uD834\uD834'), '"𝌆\\ud834\\ud834"', 'JSON.stringify("\\uD834\\uDF06\\uD834\\uD834")'); assert.same(stringify('\uD834\uDF06\uD834\uDF06'), '"𝌆𝌆"', 'JSON.stringify("\\uD834\\uDF06\\uD834\\uDF06")'); assert.same(stringify('\uDF06\uDF06\uD834\uD834'), '"\\udf06\\udf06\\ud834\\ud834"', 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uD834")'); assert.same(stringify('\uDF06\uDF06\uD834\uDF06'), '"\\udf06\\udf06𝌆"', 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uDF06")'); assert.same(stringify(new String('str')), '"str"', 'value-string-object-1'); assert.same(stringify({ key: { toJSON() { const str = new String('str'); str.toString = () => 'toString'; str.valueOf = () => { throw new EvalError('should not be called'); }; return str; }, }, }), '{"key":"toString"}', 'value-string-object-2'); assert.throws(() => stringify([true], (key, value) => { if (value === true) { const str = new String('str'); str.toString = () => { throw new EvalError('t262'); }; str.valueOf = () => { throw new EvalError('t262'); }; return str; } return value; }), 'value-string-object-3'); assert.throws(() => stringify({ toJSON() { throw new EvalError('t262'); }, }), EvalError, 'value-tojson-abrupt-1'); let callCount = 0; let $this, $key; const obj6 = { toJSON(key) { callCount += 1; $this = this; $key = key; }, }; assert.same(stringify(obj6), undefined, 'value-tojson-arguments-1'); assert.same(callCount, 1, 'value-tojson-arguments-2'); assert.same($this, obj6, 'value-tojson-arguments-3'); assert.same($key, '', 'value-tojson-arguments-4'); assert.same(stringify([1, obj6, 3]), '[1,null,3]', 'value-tojson-arguments-5'); assert.same(callCount, 2, 'value-tojson-arguments-6'); assert.same($this, obj6, 'value-tojson-arguments-7'); // some old implementations (like WebKit) could pass numbers as keys // assert.same($key, '1', 'value-tojson-arguments-8'); assert.same(stringify({ key: obj6 }), '{}', 'value-tojson-arguments-9'); assert.same(callCount, 3, 'value-tojson-arguments-10'); assert.same($this, obj6, 'value-tojson-arguments-11'); assert.same($key, 'key', 'value-tojson-arguments-12'); const arr1 = []; const circular2 = [arr1]; arr1.toJSON = () => circular2; assert.throws(() => stringify(circular2), TypeError, 'value-tojson-array-circular'); assert.same(stringify({ toJSON: null }), '{"toJSON":null}', 'value-tojson-not-function-1'); assert.same(stringify({ toJSON: false }), '{"toJSON":false}', 'value-tojson-not-function-2'); assert.same(stringify({ toJSON: [] }), '{"toJSON":[]}', 'value-tojson-not-function-3'); assert.same(stringify({ toJSON: /re/ }), '{"toJSON":{}}', 'value-tojson-not-function-4'); const obj7 = {}; const circular3 = { prop: obj7 }; obj7.toJSON = () => circular3; assert.throws(() => stringify(circular3), TypeError, 'value-tojson-object-circular'); assert.same(stringify({ toJSON() { return [false]; } }), '[false]', 'value-tojson-result-1'); const arr2 = [true]; arr2.toJSON = () => { /* empty */ }; assert.same(stringify(arr2), undefined, 'value-tojson-result-2'); const str3 = new String('str'); str3.toJSON = () => null; assert.same(stringify({ key: str3 }), '{"key":null}', 'value-tojson-result-3'); const num3 = new Number(14); num3.toJSON = () => ({ key: 7 }); assert.same(stringify([num3]), '[{"key":7}]', 'value-tojson-result-4'); if (DESCRIPTORS) { // This getter will be triggered during enumeration, but the property it adds should not be enumerated. /* IE issue const o = defineProperty({ p1: 'p1', p2: 'p2', p3: 'p3', }, 'add', { enumerable: true, get() { o.extra = 'extra'; return 'add'; }, }); o.p4 = 'p4'; o[2] = '2'; o[0] = '0'; o[1] = '1'; delete o.p1; delete o.p3; o.p1 = 'p1'; assert.same(stringify(o), '{"0":"0","1":"1","2":"2","p2":"p2","add":"add","p4":"p4","p1":"p1"}', 'property-order'); */ let getCalls = 0; assert.same(stringify(defineProperty({}, 'key', { enumerable: true, get() { getCalls += 1; return true; }, }), ['key', 'key']), '{"key":true}', 'replacer-array-duplicates-1'); assert.same(getCalls, 1, 'replacer-array-duplicates-2'); /* old WebKit bug - however, fixing of this is not in priority const obj3 = defineProperty({}, 'a', { enumerable: true, get() { delete this.b; return 1; }, }); obj3.b = 2; assert.same(stringify(obj3, (key, value) => { if (key === 'b') { assert.same(value, undefined, 'replacer-function-object-deleted-property-1'); return ''; } return value; }), '{"a":1,"b":""}', 'replacer-function-object-deleted-property-2'); */ assert.throws(() => stringify({ key: defineProperty(Array(1), '0', { get() { throw new EvalError('t262'); }, }) }), EvalError, 'value-array-abrupt'); assert.throws(() => stringify(defineProperty({}, 'key', { enumerable: true, get() { throw new EvalError('t262'); }, })), EvalError, 'value-object-abrupt'); assert.throws(() => stringify(defineProperty({}, 'toJSON', { get() { throw new EvalError('t262'); }, })), EvalError, 'value-tojson-abrupt-2'); } }); QUnit.test('Symbols & JSON.stringify', assert => { const symbol1 = Symbol('symbol & stringify test 1'); const symbol2 = Symbol('symbol & stringify test 2'); assert.same(stringify([ 1, symbol1, false, symbol2, {}, ]), '[1,null,false,null,{}]', 'array value'); assert.same(stringify({ symbol: symbol1, }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; object[symbol1] = 1; assert.same(stringify(object), '{"bar":2}', 'object key'); } assert.same(stringify(symbol1), undefined, 'symbol value'); if (typeof symbol1 == 'symbol') { assert.same(stringify(Object(symbol1)), '{}', 'boxed symbol'); } assert.same(stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); QUnit.test('Well‑formed JSON.stringify', assert => { assert.same(stringify({ foo: 'bar' }), '{"foo":"bar"}', 'basic'); assert.same(stringify('\uDEAD'), '"\\udead"', 'r1'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'r2'); assert.same(stringify('\uDF06ab\uD834'), '"\\udf06ab\\ud834"', 'r3'); assert.same(stringify('𠮷'), '"𠮷"', 'r4'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'r5'); assert.same(stringify('\uD834\uD834\uDF06'), '"\\ud834𝌆"', 'r6'); assert.same(stringify('\uD834\uDF06\uDF06'), '"𝌆\\udf06"', 'r7'); assert.same(stringify({ '𠮷': ['\uDF06\uD834'] }), '{"𠮷":["\\udf06\\ud834"]}', 'r8'); }); } core-js-3.33.2/tests/unit-pure/es.map.js000066400000000000000000000264551451776221300200030ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite -- required for testing */ import { createIterable, is, nativeSubclass } from '../helpers/helpers.js'; import { DESCRIPTORS } from '../helpers/constants.js'; import getIterator from 'core-js-pure/es/get-iterator'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import freeze from 'core-js-pure/es/object/freeze'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import keys from 'core-js-pure/es/object/keys'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; import Symbol from 'core-js-pure/es/symbol'; import Set from 'core-js-pure/es/set'; import Map from 'core-js-pure/es/map'; QUnit.test('Map', assert => { assert.isFunction(Map); assert.true('clear' in Map.prototype, 'clear in Map.prototype'); assert.true('delete' in Map.prototype, 'delete in Map.prototype'); assert.true('forEach' in Map.prototype, 'forEach in Map.prototype'); assert.true('get' in Map.prototype, 'get in Map.prototype'); assert.true('has' in Map.prototype, 'has in Map.prototype'); assert.true('set' in Map.prototype, 'set in Map.prototype'); assert.true(new Map() instanceof Map, 'new Map instanceof Map'); assert.same(new Map(createIterable([[1, 1], [2, 2], [3, 3]])).size, 3, 'Init from iterable'); assert.same(new Map([[freeze({}), 1], [2, 3]]).size, 2, 'Support frozen objects'); let done = false; try { new Map(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new Map(array); assert.true(done); const object = {}; new Map().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Map); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof Map, 'correct subclassing with native classes #2'); assert.same(new Subclass().set(1, 2).get(1), 2, 'correct subclassing with native classes #3'); } if (typeof ArrayBuffer == 'function') { const buffer = new ArrayBuffer(8); const map = new Map([[buffer, 8]]); assert.true(map.has(buffer), 'works with ArrayBuffer keys'); } }); QUnit.test('Map#clear', assert => { assert.isFunction(Map.prototype.clear); let map = new Map(); map.clear(); assert.same(map.size, 0); map = new Map().set(1, 2).set(2, 3).set(1, 4); map.clear(); assert.same(map.size, 0); assert.false(map.has(1)); assert.false(map.has(2)); const frozen = freeze({}); map = new Map().set(1, 2).set(frozen, 3); map.clear(); assert.same(map.size, 0, 'Support frozen objects'); assert.false(map.has(1)); assert.false(map.has(frozen)); }); QUnit.test('Map#delete', assert => { assert.isFunction(Map.prototype.delete); const object = {}; const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); assert.same(map.size, 5); assert.true(map.delete(NaN)); assert.same(map.size, 4); assert.false(map.delete(4)); assert.same(map.size, 4); map.delete([]); assert.same(map.size, 4); map.delete(object); assert.same(map.size, 3); const frozen = freeze({}); map.set(frozen, 42); assert.same(map.size, 4); map.delete(frozen); assert.same(map.size, 3); }); QUnit.test('Map#forEach', assert => { assert.isFunction(Map.prototype.forEach); let result = {}; let count = 0; const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); map.forEach((value, key) => { count++; result[value] = key; }); assert.same(count, 5); assert.deepEqual(result, { 1: NaN, 7: 3, 5: 2, 4: 1, 9: object, }); map = new Map(); map.set('0', 9); map.set('1', 9); map.set('2', 9); map.set('3', 9); result = ''; map.forEach((value, key) => { result += key; if (key === '2') { map.delete('2'); map.delete('3'); map.delete('1'); map.set('4', 9); } }); assert.same(result, '0124'); map = new Map([['0', 1]]); result = ''; map.forEach(it => { map.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.same(result, '1'); assert.throws(() => Map.prototype.forEach.call(new Set(), () => { /* empty */ }), 'non-generic'); }); QUnit.test('Map#get', assert => { assert.isFunction(Map.prototype.get); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.same(map.get(NaN), 1); assert.same(map.get(4), undefined); assert.same(map.get({}), undefined); assert.same(map.get(object), object); assert.same(map.get(frozen), 42); assert.same(map.get(2), 5); }); QUnit.test('Map#has', assert => { assert.isFunction(Map.prototype.has); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.true(map.has(NaN)); assert.true(map.has(object)); assert.true(map.has(2)); assert.true(map.has(frozen)); assert.false(map.has(4)); assert.false(map.has({})); }); QUnit.test('Map#set', assert => { assert.isFunction(Map.prototype.set); const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(object, object); assert.same(map.size, 5); const chain = map.set(7, 2); assert.same(chain, map); map.set(7, 2); assert.same(map.size, 6); assert.same(map.get(7), 2); assert.same(map.get(NaN), 1); map.set(NaN, 42); assert.same(map.size, 6); assert.same(map.get(NaN), 42); map.set({}, 11); assert.same(map.size, 7); assert.same(map.get(object), object); map.set(object, 27); assert.same(map.size, 7); assert.same(map.get(object), 27); map = new Map(); map.set(NaN, 2); map.set(NaN, 3); map.set(NaN, 4); assert.same(map.size, 1); const frozen = freeze({}); map = new Map().set(frozen, 42); assert.same(map.get(frozen), 42); }); QUnit.test('Map#size', assert => { const map = new Map(); map.set(2, 1); const { size } = map; assert.same(typeof size, 'number', 'size is number'); assert.same(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Map.prototype, 'size'); const getter = sizeDescriptor && sizeDescriptor.get; const setter = sizeDescriptor && sizeDescriptor.set; assert.same(typeof getter, 'function', 'size is getter'); assert.same(typeof setter, 'undefined', 'size is not setter'); assert.throws(() => Map.prototype.size, TypeError); } }); QUnit.test('Map & -0', assert => { let map = new Map(); map.set(-0, 1); assert.same(map.size, 1); assert.true(map.has(0)); assert.true(map.has(-0)); assert.same(map.get(0), 1); assert.same(map.get(-0), 1); map.forEach((val, key) => { assert.false(is(key, -0)); }); map.delete(-0); assert.same(map.size, 0); map = new Map([[-0, 1]]); map.forEach((val, key) => { assert.false(is(key, -0)); }); map = new Map(); map.set(4, 4); map.set(3, 3); map.set(2, 2); map.set(1, 1); map.set(0, 0); assert.true(map.has(-0)); }); QUnit.test('Map#@@toStringTag', assert => { assert.same(Map.prototype[Symbol.toStringTag], 'Map', 'Map::@@toStringTag is `Map`'); assert.same(String(new Map()), '[object Map]', 'correct stringification'); }); QUnit.test('Map Iterator', assert => { const map = new Map(); map.set('a', 1); map.set('b', 2); map.set('c', 3); map.set('d', 4); const results = []; const iterator = map.keys(); results.push(iterator.next().value); assert.true(map.delete('a')); assert.true(map.delete('b')); assert.true(map.delete('c')); map.set('e'); results.push(iterator.next().value, iterator.next().value); assert.true(iterator.next().done); map.set('f'); assert.true(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Map#keys', assert => { assert.isFunction(Map.prototype.keys); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'a', done: false, }); assert.deepEqual(iterator.next(), { value: 's', done: false, }); assert.deepEqual(iterator.next(), { value: 'd', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#values', assert => { assert.isFunction(Map.prototype.values); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#entries', assert => { assert.isFunction(Map.prototype.entries); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#@@iterator', assert => { const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = getIterator(map); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Map Iterator'); assert.same(String(iterator), '[object Map Iterator]'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/es.math.acosh.js000066400000000000000000000016351451776221300212440ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import acosh from 'core-js-pure/es/math/acosh'; import EPSILON from 'core-js-pure/es/number/epsilon'; QUnit.test('Math.acosh', assert => { assert.isFunction(acosh); assert.same(acosh(NaN), NaN); assert.same(acosh(0.5), NaN); assert.same(acosh(-1), NaN); assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.same(acosh(Infinity), Infinity); assert.epsilon(acosh(1234), 7.811163220849231); assert.epsilon(acosh(8.88), 2.8737631531629235); assert.epsilon(acosh(1e+160), 369.10676205960726); assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); assert.epsilon(acosh(1 + EPSILON), 2.1073424255447017e-8); const checker = createConversionChecker(1234); assert.epsilon(acosh(checker), 7.811163220849231); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.asinh.js000066400000000000000000000014701451776221300212460ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import asinh from 'core-js-pure/es/math/asinh'; QUnit.test('Math.asinh', assert => { assert.isFunction(asinh); assert.same(asinh(NaN), NaN); assert.same(asinh(0), 0); assert.same(asinh(-0), -0); assert.same(asinh(Infinity), Infinity); assert.same(asinh(-Infinity), -Infinity); assert.epsilon(asinh(1234), 7.811163549201245); assert.epsilon(asinh(9.99), 2.997227420191335); assert.epsilon(asinh(1e150), 346.0809111296668); assert.epsilon(asinh(1e7), 16.811242831518268); assert.epsilon(asinh(-1e7), -16.811242831518268); const checker = createConversionChecker(1234); assert.epsilon(asinh(checker), 7.811163549201245); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.atanh.js000066400000000000000000000016131451776221300212360ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import atanh from 'core-js-pure/es/math/atanh'; QUnit.test('Math.atanh', assert => { assert.isFunction(atanh); assert.same(atanh(NaN), NaN); assert.same(atanh(-2), NaN); assert.same(atanh(-1.5), NaN); assert.same(atanh(2), NaN); assert.same(atanh(1.5), NaN); assert.same(atanh(-1), -Infinity); assert.same(atanh(1), Infinity); assert.same(atanh(0), 0); assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); assert.epsilon(atanh(0.5), 0.5493061443340549); assert.epsilon(atanh(-0.5), -0.5493061443340549); assert.epsilon(atanh(0.444), 0.47720201260109457); const checker = createConversionChecker(0.5); assert.epsilon(atanh(checker), 0.5493061443340549); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.cbrt.js000066400000000000000000000012401451776221300210710ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import cbrt from 'core-js-pure/es/math/cbrt'; QUnit.test('Math.cbrt', assert => { assert.isFunction(cbrt); assert.same(cbrt(NaN), NaN); assert.same(cbrt(0), 0); assert.same(cbrt(-0), -0); assert.same(cbrt(Infinity), Infinity); assert.same(cbrt(-Infinity), -Infinity); assert.same(cbrt(-8), -2); assert.same(cbrt(8), 2); assert.epsilon(cbrt(-1000), -10); assert.epsilon(cbrt(1000), 10); const checker = createConversionChecker(1000); assert.epsilon(cbrt(checker), 10); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.clz32.js000066400000000000000000000011071451776221300210760ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import clz32 from 'core-js-pure/es/math/clz32'; QUnit.test('Math.clz32', assert => { assert.isFunction(clz32); assert.same(clz32(0), 32); assert.same(clz32(1), 31); assert.same(clz32(-1), 0); assert.same(clz32(0.6), 32); assert.same(clz32(2 ** 32 - 1), 0); assert.same(clz32(2 ** 32), 32); const checker = createConversionChecker(1); assert.same(clz32(checker), 31, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.cosh.js000066400000000000000000000015201451776221300210740ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import cosh from 'core-js-pure/es/math/cosh'; QUnit.test('Math.cosh', assert => { assert.isFunction(cosh); assert.same(cosh(NaN), NaN); assert.same(cosh(0), 1); assert.same(cosh(-0), 1); assert.same(cosh(Infinity), Infinity); assert.same(cosh(-Infinity), Infinity); assert.epsilon(cosh(12), 81377.395712574, 1e-9); assert.epsilon(cosh(22), 1792456423.065796, 1e-5); assert.epsilon(cosh(-10), 11013.232920103323); assert.epsilon(cosh(-23), 4872401723.124452, 1e-5); assert.epsilon(cosh(710), 1.1169973830808557e+308, 1e+295); const checker = createConversionChecker(12); assert.epsilon(cosh(checker), 81377.395712574, 1e-9, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.expm1.js000066400000000000000000000012271451776221300211760ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import expm1 from 'core-js-pure/es/math/expm1'; QUnit.test('Math.expm1', assert => { assert.isFunction(expm1); assert.same(expm1(NaN), NaN); assert.same(expm1(0), 0); assert.same(expm1(-0), -0); assert.same(expm1(Infinity), Infinity); assert.same(expm1(-Infinity), -1); assert.epsilon(expm1(10), 22025.465794806718); assert.epsilon(expm1(-10), -0.9999546000702375); const checker = createConversionChecker(10); assert.epsilon(expm1(checker), 22025.465794806718); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.fround.js000066400000000000000000000045171451776221300214460ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import fround from 'core-js-pure/es/math/fround'; const { MAX_VALUE, MIN_VALUE } = Number; QUnit.test('Math.fround', assert => { assert.isFunction(fround); assert.same(fround(), NaN); assert.same(fround(undefined), NaN); assert.same(fround(NaN), NaN); assert.same(fround(null), 0); assert.same(fround(0), 0); assert.same(fround(-0), -0); assert.same(fround(MIN_VALUE), 0); assert.same(fround(-MIN_VALUE), -0); assert.same(fround(Infinity), Infinity); assert.same(fround(-Infinity), -Infinity); assert.same(fround(MAX_VALUE), Infinity); assert.same(fround(-MAX_VALUE), -Infinity); assert.same(fround(1.7976931348623157e+308), Infinity); assert.same(fround(-1.7976931348623157e+308), -Infinity); assert.same(fround(3.4028235677973366e+38), Infinity); assert.same(fround(3), 3); assert.same(fround(-3), -3); const maxFloat32 = 3.4028234663852886e+38; const minFloat32 = 1.401298464324817e-45; assert.same(fround(maxFloat32), maxFloat32); assert.same(fround(-maxFloat32), -maxFloat32); assert.same(fround(maxFloat32 + 2 ** 102), maxFloat32); assert.same(fround(minFloat32), minFloat32); assert.same(fround(-minFloat32), -minFloat32); assert.same(fround(minFloat32 / 2), 0); assert.same(fround(-minFloat32 / 2), -0); assert.same(fround(minFloat32 / 2 + 2 ** -202), minFloat32); assert.same(fround(-minFloat32 / 2 - 2 ** -202), -minFloat32); const maxSubnormal32 = 1.1754942106924411e-38; const minNormal32 = 1.1754943508222875e-38; assert.same(fround(1.1754942807573642e-38), maxSubnormal32, 'fround(1.1754942807573642e-38)'); assert.same(fround(1.1754942807573643e-38), minNormal32, 'fround(1.1754942807573643e-38)'); assert.same(fround(1.1754942807573644e-38), minNormal32, 'fround(1.1754942807573644e-38)'); assert.same(fround(-1.1754942807573642e-38), -maxSubnormal32, 'fround(-1.1754942807573642e-38)'); assert.same(fround(-1.1754942807573643e-38), -minNormal32, 'fround(-1.1754942807573643e-38)'); assert.same(fround(-1.1754942807573644e-38), -minNormal32, 'fround(-1.1754942807573644e-38)'); const checker = createConversionChecker(1.1754942807573642e-38); assert.same(fround(checker), maxSubnormal32, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.hypot.js000066400000000000000000000047721451776221300213170ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import hypot from 'core-js-pure/es/math/hypot'; QUnit.test('Math.hypot', assert => { const { sqrt } = Math; assert.isFunction(hypot); assert.same(hypot(), 0); assert.same(hypot(1), 1); assert.same(hypot('', 0), 0); assert.same(hypot(0, ''), 0); assert.same(hypot(Infinity, 0), Infinity, 'Infinity, 0'); assert.same(hypot(-Infinity, 0), Infinity, '-Infinity, 0'); assert.same(hypot(0, Infinity), Infinity, '0, Infinity'); assert.same(hypot(0, -Infinity), Infinity, '0, -Infinity'); assert.same(hypot(Infinity, NaN), Infinity, 'Infinity, NaN'); assert.same(hypot(NaN, -Infinity), Infinity, 'NaN, -Infinity'); assert.same(hypot(NaN, 0), NaN, 'NaN, 0'); assert.same(hypot(0, NaN), NaN, '0, NaN'); assert.same(hypot(0, -0), 0); assert.same(hypot(0, 0), 0); assert.same(hypot(-0, -0), 0); assert.same(hypot(-0, 0), 0); assert.same(hypot(0, 1), 1); assert.same(hypot(0, -1), 1); assert.same(hypot(-0, 1), 1); assert.same(hypot(-0, -1), 1); assert.same(hypot(0), 0); assert.same(hypot(1), 1); assert.same(hypot(2), 2); assert.same(hypot(0, 0, 1), 1); assert.same(hypot(0, 1, 0), 1); assert.same(hypot(1, 0, 0), 1); assert.same(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.same(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); assert.epsilon(hypot(66, 66), 93.33809511662427); assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.same(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.same(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.same(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); assert.same(hypot(-3, 4), 5); assert.same(hypot(3, -4), 5); const checker1 = createConversionChecker(2); const checker2 = createConversionChecker(3); const checker3 = createConversionChecker(4); const checker4 = createConversionChecker(5); assert.same(hypot(checker1, checker2, checker3, checker4), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5), 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.imul.js000066400000000000000000000034341451776221300211140ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import imul from 'core-js-pure/es/math/imul'; QUnit.test('Math.imul', assert => { assert.isFunction(imul); assert.same(imul(0, 0), 0); assert.same(imul(123, 456), 56088); assert.same(imul(-123, 456), -56088); assert.same(imul(123, -456), -56088); assert.same(imul(19088743, 4275878552), 602016552); assert.same(imul(false, 7), 0); assert.same(imul(7, false), 0); assert.same(imul(false, false), 0); assert.same(imul(true, 7), 7); assert.same(imul(7, true), 7); assert.same(imul(true, true), 1); assert.same(imul(undefined, 7), 0); assert.same(imul(7, undefined), 0); assert.same(imul(undefined, undefined), 0); assert.same(imul('str', 7), 0); assert.same(imul(7, 'str'), 0); assert.same(imul({}, 7), 0); assert.same(imul(7, {}), 0); assert.same(imul([], 7), 0); assert.same(imul(7, []), 0); assert.same(imul(0xFFFFFFFF, 5), -5); assert.same(imul(0xFFFFFFFE, 5), -10); assert.same(imul(2, 4), 8); assert.same(imul(-1, 8), -8); assert.same(imul(-2, -2), 4); assert.same(imul(-0, 7), 0); assert.same(imul(7, -0), 0); assert.same(imul(0.1, 7), 0); assert.same(imul(7, 0.1), 0); assert.same(imul(0.9, 7), 0); assert.same(imul(7, 0.9), 0); assert.same(imul(1.1, 7), 7); assert.same(imul(7, 1.1), 7); assert.same(imul(1.9, 7), 7); assert.same(imul(7, 1.9), 7); const checker1 = createConversionChecker(-123); const checker2 = createConversionChecker(456); assert.same(imul(checker1, checker2), -56088, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.log10.js000066400000000000000000000016111451776221300210630ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import log10 from 'core-js-pure/es/math/log10'; QUnit.test('Math.log10', assert => { assert.isFunction(log10); assert.same(log10(''), log10(0)); assert.same(log10(NaN), NaN); assert.same(log10(-1), NaN); assert.same(log10(0), -Infinity); assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); assert.epsilon(log10(0.1), -1); assert.epsilon(log10(0.5), -0.3010299956639812); assert.epsilon(log10(1.5), 0.17609125905568124); assert.epsilon(log10(5), 0.6989700043360189); assert.epsilon(log10(50), 1.6989700043360187); assert.epsilon(log10(1000), 3); const checker = createConversionChecker(0.5); assert.epsilon(log10(checker), -0.3010299956639812); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.log1p.js000066400000000000000000000013241451776221300211640ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import log1p from 'core-js-pure/es/math/log1p'; QUnit.test('Math.log1p', assert => { assert.isFunction(log1p); assert.same(log1p(''), log1p(0)); assert.same(log1p(NaN), NaN); assert.same(log1p(-2), NaN); assert.same(log1p(-1), -Infinity); assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); assert.epsilon(log1p(5), 1.791759469228055); assert.epsilon(log1p(50), 3.9318256327243257); const checker = createConversionChecker(5); assert.epsilon(log1p(checker), 1.791759469228055); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.log2.js000066400000000000000000000013251451776221300210060ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import log2 from 'core-js-pure/es/math/log2'; QUnit.test('Math.log2', assert => { assert.isFunction(log2); assert.same(log2(''), log2(0)); assert.same(log2(NaN), NaN); assert.same(log2(-1), NaN); assert.same(log2(0), -Infinity); assert.same(log2(-0), -Infinity); assert.same(log2(1), 0); assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); assert.epsilon(log2(5), 2.321928094887362); const checker = createConversionChecker(5); assert.epsilon(log2(checker), 2.321928094887362); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.sign.js000066400000000000000000000013261451776221300211040ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import sign from 'core-js-pure/es/math/sign'; QUnit.test('Math.sign', assert => { assert.isFunction(sign); assert.same(sign(NaN), NaN); assert.same(sign(), NaN); assert.same(sign(-0), -0); assert.same(sign(0), 0); assert.same(sign(Infinity), 1); assert.same(sign(-Infinity), -1); assert.same(sign(13510798882111488), 1); assert.same(sign(-13510798882111488), -1); assert.same(sign(42.5), 1); assert.same(sign(-42.5), -1); const checker = createConversionChecker(-42.5); assert.same(sign(checker), -1, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.sinh.js000066400000000000000000000012641451776221300211060ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import sinh from 'core-js-pure/es/math/sinh'; QUnit.test('Math.sinh', assert => { assert.isFunction(sinh); assert.same(sinh(NaN), NaN); assert.same(sinh(0), 0); assert.same(sinh(-0), -0); assert.same(sinh(Infinity), Infinity); assert.same(sinh(-Infinity), -Infinity); assert.epsilon(sinh(-5), -74.20321057778875); assert.epsilon(sinh(2), 3.6268604078470186); assert.same(sinh(-2e-17), -2e-17); const checker = createConversionChecker(-5); assert.epsilon(sinh(checker), -74.20321057778875); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.tanh.js000066400000000000000000000011121451776221300210670ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import tanh from 'core-js-pure/es/math/tanh'; QUnit.test('Math.tanh', assert => { assert.isFunction(tanh); assert.same(tanh(NaN), NaN); assert.same(tanh(0), 0); assert.same(tanh(-0), -0); assert.same(tanh(Infinity), 1); assert.same(tanh(90), 1); assert.epsilon(tanh(10), 0.9999999958776927); const checker = createConversionChecker(10); assert.epsilon(tanh(checker), 0.9999999958776927); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.math.trunc.js000066400000000000000000000023061451776221300212760ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import trunc from 'core-js-pure/es/math/trunc'; QUnit.test('Math.trunc', assert => { assert.isFunction(trunc); assert.same(trunc(NaN), NaN, 'NaN -> NaN'); assert.same(trunc(-0), -0, '-0 -> -0'); assert.same(trunc(0), 0, '0 -> 0'); assert.same(trunc(Infinity), Infinity, 'Infinity -> Infinity'); assert.same(trunc(-Infinity), -Infinity, '-Infinity -> -Infinity'); assert.same(trunc(null), 0, 'null -> 0'); assert.same(trunc({}), NaN, '{} -> NaN'); assert.same(trunc([]), 0, '[] -> 0'); assert.same(trunc(1.01), 1, '1.01 -> 0'); assert.same(trunc(1.99), 1, '1.99 -> 0'); assert.same(trunc(-1), -1, '-1 -> -1'); assert.same(trunc(-1.99), -1, '-1.99 -> -1'); assert.same(trunc(-555.555), -555, '-555.555 -> -555'); assert.same(trunc(9007199254740992), 9007199254740992, '9007199254740992 -> 9007199254740992'); assert.same(trunc(-9007199254740992), -9007199254740992, '-9007199254740992 -> -9007199254740992'); const checker = createConversionChecker(-1.99); assert.same(trunc(checker), -1, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/es.number.constructor.js000066400000000000000000000151551451776221300230750ustar00rootroot00000000000000import globalThis from 'core-js-pure/es/global-this'; import create from 'core-js-pure/es/object/create'; import Number from 'core-js-pure/es/number'; import Symbol from 'core-js-pure/es/symbol'; const NativeNumber = globalThis.Number; const whitespaces = ' \t\u000B\f\u00A0\uFEFF\n\r\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000'; function getCheck(assert) { return function (a, b) { assert.same(Number(a), b, `Number ${ typeof a } ${ a } -> ${ b }`); const x = new Number(a); assert.same(x, Object(x), `new Number ${ typeof a } ${ a } is object`); assert.same({}.toString.call(x).slice(8, -1), 'Number', `classof new Number ${ typeof a } ${ a } is Number`); assert.same(x.valueOf(), b, `new Number(${ typeof a } ${ a }).valueOf() -> ${ b }`); }; } QUnit.test('Number constructor: regression', assert => { const check = getCheck(assert); assert.isFunction(Number); assert.same(Number.prototype.constructor, NativeNumber); assert.same(1.0.constructor, NativeNumber); const constants = ['MAX_VALUE', 'MIN_VALUE', 'NaN', 'NEGATIVE_INFINITY', 'POSITIVE_INFINITY']; for (const constant of constants) { assert.true(constant in Number, `Number.${ constant }`); assert.nonEnumerable(Number, constant); } assert.same(Number(), 0); assert.same(new Number().valueOf(), 0); check(42, 42); check(42.42, 42.42); check(new Number(42), 42); check(new Number(42.42), 42.42); check('42', 42); check('42.42', 42.42); check('0x42', 66); check('0X42', 66); check('0xzzz', NaN); check('0x1g', NaN); check('+0x1', NaN); check('-0x1', NaN); check('+0X1', NaN); check('-0X1', NaN); check(new String('42'), 42); check(new String('42.42'), 42.42); check(new String('0x42'), 66); check(null, 0); check(undefined, NaN); check(false, 0); check(true, 1); check(new Boolean(false), 0); check(new Boolean(true), 1); check({}, NaN); check({ valueOf: '1.1', }, NaN); check({ valueOf: '1.1', toString() { return '2.2'; }, }, 2.2); check({ valueOf() { return '1.1'; }, }, 1.1); check({ valueOf() { return '1.1'; }, toString() { return '2.2'; }, }, 1.1); check({ valueOf() { return '-0x1a2b3c'; }, }, NaN); check({ toString() { return '-0x1a2b3c'; }, }, NaN); check({ valueOf() { return 42; }, }, 42); check({ valueOf() { return '42'; }, }, 42); check({ valueOf() { return null; }, }, 0); check({ toString() { return 42; }, }, 42); check({ toString() { return '42'; }, }, 42); check({ valueOf() { return 1; }, toString() { return 2; }, }, 1); check({ valueOf: 1, toString() { return 2; }, }, 2); let number = 1; assert.same(Number({ valueOf() { return ++number; }, }), 2, 'Number call valueOf only once #1'); assert.same(number, 2, 'Number call valueOf only once #2'); number = 1; assert.same(Number({ toString() { return ++number; }, }), 2, 'Number call toString only once #1'); assert.same(number, 2, 'Number call toString only once #2'); number = 1; assert.same(new Number({ valueOf() { return ++number; }, }).valueOf(), 2, 'new Number call valueOf only once #1'); assert.same(number, 2, 'new Number call valueOf only once #2'); number = 1; assert.same(new Number({ toString() { return ++number; }, }).valueOf(), 2, 'new Number call toString only once #1'); assert.same(number, 2, 'new Number call toString only once #2'); assert.throws(() => Number(create(null)), TypeError, 'Number assert.throws on object w/o valueOf and toString'); assert.throws(() => Number({ valueOf: 1, toString: 2, }), TypeError, 'Number assert.throws on object then valueOf and toString are not functions'); assert.throws(() => new Number(create(null)), TypeError, 'new Number assert.throws on object w/o valueOf and toString'); assert.throws(() => new Number({ valueOf: 1, toString: 2, }), TypeError, 'new Number assert.throws on object then valueOf and toString are not functions'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('Number constructor test'); assert.throws(() => Number(symbol), 'throws on symbol argument'); assert.throws(() => new Number(symbol), 'throws on symbol argument, new'); } number = new Number(42); assert.same(typeof number.constructor(number), 'number'); check(`${ whitespaces }42`, 42); check(`42${ whitespaces }`, 42); check(`${ whitespaces }42${ whitespaces }`, 42); check(`${ whitespaces }0x42`, 66); check(`0x42${ whitespaces }`, 66); check(`${ whitespaces }0x42${ whitespaces }`, 66); check(`${ whitespaces }0X42`, 66); check(`0X42${ whitespaces }`, 66); check(`${ whitespaces }0X42${ whitespaces }`, 66); }); QUnit.test('Number constructor: binary', assert => { const check = getCheck(assert); check('0b1', 1); check('0B1', 1); check('0b12', NaN); check('0b234', NaN); check('0b1!', NaN); check('+0b1', NaN); check('-0b1', NaN); check(' 0b1', 1); check('0b1\n', 1); check('\n 0b1\n ', 1); check(' 0B1', 1); check('0B1\n', 1); check('\n 0B1\n ', 1); check({ valueOf() { return '0b11'; }, }, 3); check({ toString() { return '0b111'; }, }, 7); check({ valueOf() { return '0b101010'; }, }, 42); check({ toString() { return '0b101010'; }, }, 42); check(`${ whitespaces }0b11`, 3); check(`0b11${ whitespaces }`, 3); check(`${ whitespaces }0b11${ whitespaces }`, 3); check(`${ whitespaces }0B11`, 3); check(`0B11${ whitespaces }`, 3); check(`${ whitespaces }0B11${ whitespaces }`, 3); }); QUnit.test('Number constructor: octal', assert => { const check = getCheck(assert); check('0o7', 7); check('0O7', 7); check('0o18', NaN); check('0o89a', NaN); check('0o1!', NaN); check('+0o1', NaN); check('-0o1', NaN); check(' 0o1', 1); check('0o1\n', 1); check('\n 0o1\n ', 1); check(' 0O1', 1); check('0O1\n', 1); check('\n 0O1\n ', 1); check({ valueOf() { return '0o77'; }, }, 63); check({ toString() { return '0o777'; }, }, 511); check({ valueOf() { return '0o12345'; }, }, 5349); check({ toString() { return '0o12345'; }, }, 5349); check(`${ whitespaces }0o11`, 9); check(`0o11${ whitespaces }`, 9); check(`${ whitespaces }0o11${ whitespaces }`, 9); check(`${ whitespaces }0O11`, 9); check(`0O11${ whitespaces }`, 9); check(`${ whitespaces }0O11${ whitespaces }`, 9); }); core-js-3.33.2/tests/unit-pure/es.number.epsilon.js000066400000000000000000000004071451776221300221530ustar00rootroot00000000000000import EPSILON from 'core-js-pure/es/number/epsilon'; QUnit.test('Number.EPSILON', assert => { assert.same(EPSILON, 2 ** -52, 'Is 2^-52'); assert.notSame(1, 1 + EPSILON, '1 is not 1 + EPSILON'); assert.same(1, 1 + EPSILON / 2, '1 is 1 + EPSILON / 2'); }); core-js-3.33.2/tests/unit-pure/es.number.is-finite.js000066400000000000000000000015661451776221300224000ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import isFinite from 'core-js-pure/es/number/is-finite'; QUnit.test('Number.isFinite', assert => { assert.isFunction(isFinite); const finite = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of finite) { assert.true(isFinite(value), `isFinite ${ typeof value } ${ value }`); } const notFinite = [ NaN, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notFinite) { assert.false(isFinite(value), `not isFinite ${ typeof value } ${ value }`); } assert.false(isFinite(create(null)), 'Number.isFinite(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-pure/es.number.is-integer.js000066400000000000000000000016101451776221300225450ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import isInteger from 'core-js-pure/es/number/is-integer'; QUnit.test('Number.isInteger', assert => { assert.isFunction(isInteger); const integers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of integers) { assert.true(isInteger(value), `isInteger ${ typeof value } ${ value }`); } const notIntegers = [ NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notIntegers) { assert.false(isInteger(value), `not isInteger ${ typeof value } ${ value }`); } assert.false(isInteger(create(null)), 'Number.isInteger(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-pure/es.number.is-nan.js000066400000000000000000000014001451776221300216610ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import isNaN from 'core-js-pure/es/number/is-nan'; QUnit.test('Number.isNaN', assert => { assert.isFunction(isNaN); assert.true(isNaN(NaN), 'Number.isNaN NaN'); const notNaNs = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notNaNs) { assert.false(isNaN(value), `not Number.isNaN ${ typeof value } ${ value }`); } assert.false(isNaN(create(null)), 'Number.isNaN(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-pure/es.number.is-safe-integer.js000066400000000000000000000020331451776221300234610ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import isSafeInteger from 'core-js-pure/es/number/is-safe-integer'; QUnit.test('Number.isSafeInteger', assert => { assert.isFunction(isSafeInteger); const safeIntegers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, 9007199254740991, -9007199254740991, ]; for (const value of safeIntegers) { assert.true(isSafeInteger(value), `isSafeInteger ${ typeof value } ${ value }`); } const notSafeIntegers = [ 9007199254740992, -9007199254740992, NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notSafeIntegers) { assert.false(isSafeInteger(value), `not isSafeInteger ${ typeof value } ${ value }`); } assert.false(isSafeInteger(create(null)), 'Number.isSafeInteger(Object.create(null)) -> false'); }); core-js-3.33.2/tests/unit-pure/es.number.max-safe-integer.js000066400000000000000000000002741451776221300236400ustar00rootroot00000000000000import MAX_SAFE_INTEGER from 'core-js-pure/es/number/max-safe-integer'; QUnit.test('Number.MAX_SAFE_INTEGER', assert => { assert.same(MAX_SAFE_INTEGER, 2 ** 53 - 1, 'Is 2^53 - 1'); }); core-js-3.33.2/tests/unit-pure/es.number.min-safe-integer.js000066400000000000000000000003001451776221300236240ustar00rootroot00000000000000import MIN_SAFE_INTEGER from 'core-js-pure/es/number/min-safe-integer'; QUnit.test('Number.MIN_SAFE_INTEGER', assert => { assert.same(MIN_SAFE_INTEGER, -(2 ** 53) + 1, 'Is -2^53 + 1'); }); core-js-3.33.2/tests/unit-pure/es.number.parse-float.js000066400000000000000000000016501451776221300227200ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants.js'; import parseFloat from 'core-js-pure/es/number/parse-float'; QUnit.test('Number.parseFloat', assert => { assert.isFunction(parseFloat); assert.arity(parseFloat, 1); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('Number.parseFloat test'); assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.number.parse-int.js000066400000000000000000000037421451776221300224110ustar00rootroot00000000000000/* eslint-disable prefer-numeric-literals -- required for testing */ import { WHITESPACES } from '../helpers/constants.js'; import parseInt from 'core-js-pure/es/number/parse-int'; QUnit.test('Number.parseInt', assert => { assert.isFunction(parseInt); assert.arity(parseInt, 2); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('Number.parseInt test'); assert.throws(() => parseInt(symbol), 'throws on symbol argument'); assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.number.to-exponential.js000066400000000000000000000177311451776221300234600ustar00rootroot00000000000000import toExponential from 'core-js-pure/es/number/virtual/to-exponential'; QUnit.test('Number#toExponential', assert => { assert.isFunction(toExponential); assert.same(toExponential.call(0.00008, 3), '8.000e-5'); assert.same(toExponential.call(0.9, 0), '9e-1'); assert.same(toExponential.call(1.255, 2), '1.25e+0'); assert.same(toExponential.call(1843654265.0774949, 5), '1.84365e+9'); assert.same(toExponential.call(1000000000000000128.0, 0), '1e+18'); assert.same(toExponential.call(1), '1e+0'); assert.same(toExponential.call(1, 0), '1e+0'); assert.same(toExponential.call(1, 1), '1.0e+0'); assert.same(toExponential.call(1, 1.1), '1.0e+0'); assert.same(toExponential.call(1, 0.9), '1e+0'); assert.same(toExponential.call(1, '0'), '1e+0'); assert.same(toExponential.call(1, '1'), '1.0e+0'); assert.same(toExponential.call(1, '1.1'), '1.0e+0'); assert.same(toExponential.call(1, '0.9'), '1e+0'); assert.same(toExponential.call(1, NaN), '1e+0'); assert.same(toExponential.call(1, 'some string'), '1e+0'); assert.notThrows(() => toExponential.call(1, -0.1) === '1e+0'); assert.same(toExponential.call(new Number(1)), '1e+0'); assert.same(toExponential.call(new Number(1), 0), '1e+0'); assert.same(toExponential.call(new Number(1), 1), '1.0e+0'); assert.same(toExponential.call(new Number(1), 1.1), '1.0e+0'); assert.same(toExponential.call(new Number(1), 0.9), '1e+0'); assert.same(toExponential.call(new Number(1), '0'), '1e+0'); assert.same(toExponential.call(new Number(1), '1'), '1.0e+0'); assert.same(toExponential.call(new Number(1), '1.1'), '1.0e+0'); assert.same(toExponential.call(new Number(1), '0.9'), '1e+0'); assert.same(toExponential.call(new Number(1), NaN), '1e+0'); assert.same(toExponential.call(new Number(1), 'some string'), '1e+0'); assert.notThrows(() => toExponential.call(new Number(1), -0.1) === '1e+0'); assert.same(toExponential.call(NaN), 'NaN'); assert.same(toExponential.call(NaN, 0), 'NaN'); assert.same(toExponential.call(NaN, 1), 'NaN'); assert.same(toExponential.call(NaN, 1.1), 'NaN'); assert.same(toExponential.call(NaN, 0.9), 'NaN'); assert.same(toExponential.call(NaN, '0'), 'NaN'); assert.same(toExponential.call(NaN, '1'), 'NaN'); assert.same(toExponential.call(NaN, '1.1'), 'NaN'); assert.same(toExponential.call(NaN, '0.9'), 'NaN'); assert.same(toExponential.call(NaN, NaN), 'NaN'); assert.same(toExponential.call(NaN, 'some string'), 'NaN'); assert.notThrows(() => toExponential.call(NaN, -0.1) === 'NaN'); assert.same(toExponential.call(new Number(1e21)), '1e+21'); assert.same(toExponential.call(new Number(1e21), 0), '1e+21'); assert.same(toExponential.call(new Number(1e21), 1), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), 1.1), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), 0.9), '1e+21'); assert.same(toExponential.call(new Number(1e21), '0'), '1e+21'); assert.same(toExponential.call(new Number(1e21), '1'), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), '1.1'), '1.0e+21'); assert.same(toExponential.call(new Number(1e21), '0.9'), '1e+21'); assert.same(toExponential.call(new Number(1e21), NaN), '1e+21'); assert.same(toExponential.call(new Number(1e21), 'some string'), '1e+21'); assert.same(toExponential.call(5, 19), '5.0000000000000000000e+0'); // ported from tests262, the license: https://github.com/tc39/test262/blob/main/LICENSE assert.same(toExponential.call(123.456, 0), '1e+2'); assert.same(toExponential.call(123.456, 1), '1.2e+2'); assert.same(toExponential.call(123.456, 2), '1.23e+2'); assert.same(toExponential.call(123.456, 3), '1.235e+2'); assert.same(toExponential.call(123.456, 4), '1.2346e+2'); assert.same(toExponential.call(123.456, 5), '1.23456e+2'); assert.same(toExponential.call(123.456, 6), '1.234560e+2'); assert.same(toExponential.call(123.456, 7), '1.2345600e+2'); // assert.same(toExponential.call(123.456, 17), '1.23456000000000003e+2'); // assert.same(toExponential.call(123.456, 20), '1.23456000000000003070e+2'); assert.same(toExponential.call(-123.456, 0), '-1e+2'); assert.same(toExponential.call(-123.456, 1), '-1.2e+2'); assert.same(toExponential.call(-123.456, 2), '-1.23e+2'); assert.same(toExponential.call(-123.456, 3), '-1.235e+2'); assert.same(toExponential.call(-123.456, 4), '-1.2346e+2'); assert.same(toExponential.call(-123.456, 5), '-1.23456e+2'); assert.same(toExponential.call(-123.456, 6), '-1.234560e+2'); assert.same(toExponential.call(-123.456, 7), '-1.2345600e+2'); // assert.same(toExponential.call(-123.456, 17), '-1.23456000000000003e+2'); // assert.same(toExponential.call(-123.456, 20), '-1.23456000000000003070e+2'); assert.same(toExponential.call(0.0001, 0), '1e-4'); assert.same(toExponential.call(0.0001, 1), '1.0e-4'); assert.same(toExponential.call(0.0001, 2), '1.00e-4'); assert.same(toExponential.call(0.0001, 3), '1.000e-4'); assert.same(toExponential.call(0.0001, 4), '1.0000e-4'); // assert.same(toExponential.call(0.0001, 16), '1.0000000000000000e-4'); // assert.same(toExponential.call(0.0001, 17), '1.00000000000000005e-4'); // assert.same(toExponential.call(0.0001, 18), '1.000000000000000048e-4'); // assert.same(toExponential.call(0.0001, 19), '1.0000000000000000479e-4'); // assert.same(toExponential.call(0.0001, 20), '1.00000000000000004792e-4'); assert.same(toExponential.call(0.9999, 0), '1e+0'); assert.same(toExponential.call(0.9999, 1), '1.0e+0'); assert.same(toExponential.call(0.9999, 2), '1.00e+0'); assert.same(toExponential.call(0.9999, 3), '9.999e-1'); assert.same(toExponential.call(0.9999, 4), '9.9990e-1'); // assert.same(toExponential.call(0.9999, 16), '9.9990000000000001e-1'); // assert.same(toExponential.call(0.9999, 17), '9.99900000000000011e-1'); // assert.same(toExponential.call(0.9999, 18), '9.999000000000000110e-1'); // assert.same(toExponential.call(0.9999, 19), '9.9990000000000001101e-1'); // assert.same(toExponential.call(0.9999, 20), '9.99900000000000011013e-1'); assert.same(toExponential.call(25, 0), '3e+1'); // FF86- and Chrome 49-50 bugs assert.same(toExponential.call(12345, 3), '1.235e+4'); // FF86- and Chrome 49-50 bugs assert.same(toExponential.call(Number.prototype, 0), '0e+0', 'Number.prototype, 0'); assert.same(toExponential.call(0, 0), '0e+0', '0, 0'); assert.same(toExponential.call(-0, 0), '0e+0', '-0, 0'); assert.same(toExponential.call(0, -0), '0e+0', '0, -0'); assert.same(toExponential.call(-0, -0), '0e+0', '-0, -0'); assert.same(toExponential.call(0, 1), '0.0e+0', '0 and 1'); assert.same(toExponential.call(0, 2), '0.00e+0', '0 and 2'); assert.same(toExponential.call(0, 7), '0.0000000e+0', '0 and 7'); assert.same(toExponential.call(0, 20), '0.00000000000000000000e+0', '0 and 20'); assert.same(toExponential.call(-0, 1), '0.0e+0', '-0 and 1'); assert.same(toExponential.call(-0, 2), '0.00e+0', '-0 and 2'); assert.same(toExponential.call(-0, 7), '0.0000000e+0', '-0 and 7'); assert.same(toExponential.call(-0, 20), '0.00000000000000000000e+0', '-0 and 20'); assert.same(toExponential.call(NaN, 1000), 'NaN', 'NaN check before fractionDigits check'); assert.same(toExponential.call(Infinity, 1000), 'Infinity', 'Infinity check before fractionDigits check'); assert.notThrows(() => toExponential.call(new Number(1e21), -0.1) === '1e+21'); assert.throws(() => toExponential.call(1.0, -101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toExponential.call(1.0, 101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toExponential.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toExponential.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-pure/es.number.to-fixed.js000066400000000000000000000063741451776221300222320ustar00rootroot00000000000000import toFixed from 'core-js-pure/es/number/to-fixed'; QUnit.test('Number#toFixed', assert => { assert.isFunction(toFixed); assert.same(toFixed(0.00008, 3), '0.000'); assert.same(toFixed(0.9, 0), '1'); assert.same(toFixed(1.255, 2), '1.25'); assert.same(toFixed(1843654265.0774949, 5), '1843654265.07749'); assert.same(toFixed(1000000000000000128, 0), '1000000000000000128'); assert.same(toFixed(1), '1'); assert.same(toFixed(1, 0), '1'); assert.same(toFixed(1, 1), '1.0'); assert.same(toFixed(1, 1.1), '1.0'); assert.same(toFixed(1, 0.9), '1'); assert.same(toFixed(1, '0'), '1'); assert.same(toFixed(1, '1'), '1.0'); assert.same(toFixed(1, '1.1'), '1.0'); assert.same(toFixed(1, '0.9'), '1'); assert.same(toFixed(1, NaN), '1'); assert.same(toFixed(1, 'some string'), '1'); assert.notThrows(() => toFixed(1, -0.1) === '1'); assert.same(toFixed(Object(1)), '1'); assert.same(toFixed(Object(1), 0), '1'); assert.same(toFixed(Object(1), 1), '1.0'); assert.same(toFixed(Object(1), 1.1), '1.0'); assert.same(toFixed(Object(1), 0.9), '1'); assert.same(toFixed(Object(1), '0'), '1'); assert.same(toFixed(Object(1), '1'), '1.0'); assert.same(toFixed(Object(1), '1.1'), '1.0'); assert.same(toFixed(Object(1), '0.9'), '1'); assert.same(toFixed(Object(1), NaN), '1'); assert.same(toFixed(Object(1), 'some string'), '1'); assert.notThrows(() => toFixed(Object(1), -0.1) === '1'); assert.same(toFixed(NaN), 'NaN'); assert.same(toFixed(NaN, 0), 'NaN'); assert.same(toFixed(NaN, 1), 'NaN'); assert.same(toFixed(NaN, 1.1), 'NaN'); assert.same(toFixed(NaN, 0.9), 'NaN'); assert.same(toFixed(NaN, '0'), 'NaN'); assert.same(toFixed(NaN, '1'), 'NaN'); assert.same(toFixed(NaN, '1.1'), 'NaN'); assert.same(toFixed(NaN, '0.9'), 'NaN'); assert.same(toFixed(NaN, NaN), 'NaN'); assert.same(toFixed(NaN, 'some string'), 'NaN'); assert.notThrows(() => toFixed(NaN, -0.1) === 'NaN'); assert.same(toFixed(1e21), String(1e21)); assert.same(toFixed(1e21, 0), String(1e21)); assert.same(toFixed(1e21, 1), String(1e21)); assert.same(toFixed(1e21, 1.1), String(1e21)); assert.same(toFixed(1e21, 0.9), String(1e21)); assert.same(toFixed(1e21, '0'), String(1e21)); assert.same(toFixed(1e21, '1'), String(1e21)); assert.same(toFixed(1e21, '1.1'), String(1e21)); assert.same(toFixed(1e21, '0.9'), String(1e21)); assert.same(toFixed(1e21, NaN), String(1e21)); assert.same(toFixed(1e21, 'some string'), String(1e21)); assert.notThrows(() => toFixed(1e21, -0.1) === String(1e21)); assert.throws(() => toFixed(1, -101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toFixed(1, 101), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toFixed(NaN, Infinity), RangeError, 'If f < 0 or f > 20 (100), throw a RangeError exception.'); assert.throws(() => toFixed({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-pure/es.number.to-precision.js000066400000000000000000000025301451776221300231140ustar00rootroot00000000000000import toPrecision from 'core-js-pure/es/number/to-precision'; QUnit.test('Number#toPrecision', assert => { assert.isFunction(toPrecision); assert.same(toPrecision(0.00008, 3), '0.0000800', '0.00008.toPrecision(3)'); assert.same(toPrecision(1.255, 2), '1.3', '1.255.toPrecision(2)'); assert.same(toPrecision(1843654265.0774949, 13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); assert.same(toPrecision(NaN, 1), 'NaN', 'If x is NaN, return the String "NaN".'); assert.same(toPrecision(123.456), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.same(toPrecision(123.456, undefined), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(() => toPrecision(0.9, 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision(0.9, 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.33.2/tests/unit-pure/es.object.assign.js000066400000000000000000000044101451776221300217420ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import defineProperty from 'core-js-pure/es/object/define-property'; import keys from 'core-js-pure/es/object/keys'; import assign from 'core-js-pure/es/object/assign'; QUnit.test('Object.assign', assert => { assert.isFunction(assign); let object = { q: 1 }; assert.same(object, assign(object, { bar: 2 }), 'assign return target'); assert.same(object.bar, 2, 'assign define properties'); assert.deepEqual(assign({}, { q: 1 }, { w: 2 }), { q: 1, w: 2 }); assert.deepEqual(assign({}, 'qwe'), { 0: 'q', 1: 'w', 2: 'e' }); assert.throws(() => assign(null, { q: 1 }), TypeError); assert.throws(() => assign(undefined, { q: 1 }), TypeError); let string = assign('qwe', { q: 1 }); assert.same(typeof string, 'object'); assert.same(String(string), 'qwe'); assert.same(string.q, 1); assert.same(assign({}, { valueOf: 42 }).valueOf, 42, 'IE enum keys bug'); if (DESCRIPTORS) { object = { baz: 1 }; assign(object, defineProperty({}, 'bar', { get() { return this.baz + 1; }, })); assert.same(object.bar, undefined, "assign don't copy descriptors"); object = { a: 'a' }; const c = Symbol('c'); const d = Symbol('d'); object[c] = 'c'; defineProperty(object, 'b', { value: 'b' }); defineProperty(object, d, { value: 'd' }); const object2 = assign({}, object); assert.same(object2.a, 'a', 'a'); assert.same(object2.b, undefined, 'b'); assert.same(object2[c], 'c', 'c'); assert.same(object2[d], undefined, 'd'); try { assert.same(Function('assign', ` return assign({ b: 1 }, { get a() { delete this.b; }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } try { assert.same(Function('assign', ` return assign({ b: 1 }, { get a() { Object.defineProperty(this, "b", { value: 4, enumerable: false }); }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } } string = 'abcdefghijklmnopqrst'; const result = {}; for (let i = 0, { length } = string; i < length; ++i) { const chr = string.charAt(i); result[chr] = chr; } assert.same(keys(assign({}, result)).join(''), string); }); core-js-3.33.2/tests/unit-pure/es.object.create.js000066400000000000000000000023561451776221300217300ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import create from 'core-js-pure/es/object/create'; QUnit.test('Object.create', assert => { function getPropertyNames(object) { let result = []; do { result = result.concat(getOwnPropertyNames(object)); } while (object = getPrototypeOf(object)); return result; } assert.isFunction(create); assert.arity(create, 2); let object = { q: 1 }; assert.true({}.isPrototypeOf.call(object, create(object))); assert.same(create(object).q, 1); function C() { return this.a = 1; } assert.true(create(new C()) instanceof C); assert.same(C.prototype, getPrototypeOf(getPrototypeOf(create(new C())))); assert.same(create(new C()).a, 1); assert.same(create({}, { a: { value: 42 } }).a, 42); object = create(null, { w: { value: 2 } }); assert.same(object, Object(object)); assert.false(('toString' in object)); assert.same(object.w, 2); assert.deepEqual(getPropertyNames(create(null)), []); }); QUnit.test('Object.create.sham flag', assert => { assert.same(create.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.define-getter.js000066400000000000000000000016631451776221300232070ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; import __defineGetter__ from 'core-js-pure/es/object/define-getter'; import __defineSetter__ from 'core-js-pure/es/object/define-setter'; if (DESCRIPTORS) { QUnit.test('Object#__defineGetter__', assert => { assert.isFunction(__defineGetter__); const object = {}; assert.same(__defineGetter__(object, 'key', () => 42), undefined, 'void'); assert.same(object.key, 42, 'works'); __defineSetter__(object, 'key', function () { this.foo = 43; }); object.key = 44; assert.same(object.key, 42, 'works with setter #1'); assert.same(object.foo, 43, 'works with setter #2'); if (STRICT) { assert.throws(() => __defineGetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineGetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-pure/es.object.define-properties.js000066400000000000000000000015651451776221300241120ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import defineProperties from 'core-js-pure/es/object/define-properties'; QUnit.test('Object.defineProperties', assert => { assert.isFunction(defineProperties); assert.arity(defineProperties, 2); const source = {}; const result = defineProperties(source, { q: { value: 42 }, w: { value: 33 } }); assert.same(result, source); assert.same(result.q, 42); assert.same(result.w, 33); if (DESCRIPTORS) { // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(defineProperties(function () { /* empty */ }, { prototype: { value: 42, writable: false, } }).prototype, 42, 'function prototype with non-writable descriptor'); } }); QUnit.test('Object.defineProperties.sham flag', assert => { assert.same(defineProperties.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.define-property.js000066400000000000000000000020141451776221300235700ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/object/define-property'; QUnit.test('Object.defineProperty', assert => { assert.isFunction(defineProperty); assert.arity(defineProperty, 3); const source = {}; const result = defineProperty(source, 'q', { value: 42, }); assert.same(result, source); assert.same(result.q, 42); if (DESCRIPTORS) { // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false, }).prototype, 42, 'function prototype with non-writable descriptor'); } assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Object.defineProperty.sham flag', assert => { assert.same(defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.define-setter.js000066400000000000000000000020461451776221300232170ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; import __defineGetter__ from 'core-js-pure/es/object/define-getter'; import __defineSetter__ from 'core-js-pure/es/object/define-setter'; if (DESCRIPTORS) { QUnit.test('Object#__defineSetter__', assert => { assert.isFunction(__defineSetter__); let object = {}; assert.same(__defineSetter__(object, 'key', function () { this.foo = 43; }), undefined, 'void'); object.key = 44; assert.same(object.foo, 43, 'works'); object = {}; __defineSetter__(object, 'key', function () { this.foo = 43; }); __defineGetter__(object, 'key', () => 42); object.key = 44; assert.same(object.key, 42, 'works with getter #1'); assert.same(object.foo, 43, 'works with getter #2'); if (STRICT) { assert.throws(() => __defineSetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineSetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-pure/es.object.entries.js000066400000000000000000000022351451776221300221320ustar00rootroot00000000000000import assign from 'core-js-pure/es/object/assign'; import create from 'core-js-pure/es/object/create'; import entries from 'core-js-pure/es/object/entries'; QUnit.test('Object.entries', assert => { assert.isFunction(entries); assert.arity(entries, 1); assert.name(entries, 'entries'); assert.deepEqual(entries({ q: 1, w: 2, e: 3 }), [['q', 1], ['w', 2], ['e', 3]]); assert.deepEqual(entries(new String('qwe')), [['0', 'q'], ['1', 'w'], ['2', 'e']]); assert.deepEqual(entries(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [['a', 4], ['s', 5], ['d', 6]]); assert.deepEqual(entries({ valueOf: 42 }), [['valueOf', 42]], 'IE enum keys bug'); try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2 }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } }); core-js-3.33.2/tests/unit-pure/es.object.freeze.js000066400000000000000000000020101451776221300217300ustar00rootroot00000000000000import ownKeys from 'core-js-pure/es/reflect/own-keys'; import keys from 'core-js-pure/es/object/keys'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import freeze from 'core-js-pure/es/object/freeze'; QUnit.test('Object.freeze', assert => { assert.isFunction(freeze); assert.arity(freeze, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => freeze(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(freeze(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in freeze({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(freeze({})), []); assert.arrayEqual(getOwnPropertyNames(freeze({})), []); assert.arrayEqual(getOwnPropertySymbols(freeze({})), []); assert.arrayEqual(ownKeys(freeze({})), []); }); core-js-3.33.2/tests/unit-pure/es.object.from-entries.js000066400000000000000000000015131451776221300230710ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import Set from 'core-js-pure/es/set'; import fromEntries from 'core-js-pure/es/object/from-entries'; QUnit.test('Object.fromEntries', assert => { assert.isFunction(fromEntries); assert.arity(fromEntries, 1); assert.name(fromEntries, 'fromEntries'); assert.true(fromEntries([]) instanceof Object); assert.same(fromEntries([['foo', 1]]).foo, 1); assert.same(fromEntries(createIterable([['bar', 2]])).bar, 2); class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102), new Unit(103)]); const object = fromEntries(units.entries()); assert.same(object.unit101.id, 101); assert.same(object.unit102.id, 102); assert.same(object.unit103.id, 103); }); core-js-3.33.2/tests/unit-pure/es.object.get-own-property-descriptor.js000066400000000000000000000020031451776221300260700ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; QUnit.test('Object.getOwnPropertyDescriptor', assert => { assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.deepEqual(getOwnPropertyDescriptor({ q: 42 }, 'q'), { writable: true, enumerable: true, configurable: true, value: 42, }); assert.same(getOwnPropertyDescriptor({}, 'toString'), undefined); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyDescriptor(value) || true, `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyDescriptor(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyDescriptor(undefined), TypeError, 'throws on undefined'); }); QUnit.test('Object.getOwnPropertyDescriptor.sham flag', assert => { assert.same(getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.get-own-property-descriptors.js000066400000000000000000000022671451776221300262670ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import create from 'core-js-pure/es/object/create'; import getOwnPropertyDescriptors from 'core-js-pure/es/object/get-own-property-descriptors'; QUnit.test('Object.getOwnPropertyDescriptors', assert => { assert.isFunction(getOwnPropertyDescriptors); const object = create({ q: 1 }, { e: { value: 3 } }); object.w = 2; const symbol = Symbol('4'); object[symbol] = 4; const descriptors = getOwnPropertyDescriptors(object); assert.same(descriptors.q, undefined); assert.deepEqual(descriptors.w, { enumerable: true, configurable: true, writable: true, value: 2, }); if (DESCRIPTORS) { assert.deepEqual(descriptors.e, { enumerable: false, configurable: false, writable: false, value: 3, }); } else { assert.deepEqual(descriptors.e, { enumerable: true, configurable: true, writable: true, value: 3, }); } assert.same(descriptors[symbol].value, 4); }); QUnit.test('Object.getOwnPropertyDescriptors.sham flag', assert => { assert.same(getOwnPropertyDescriptors.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.get-own-property-names.js000066400000000000000000000035301451776221300250230ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; import freeze from 'core-js-pure/es/object/freeze'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; QUnit.test('Object.getOwnPropertyNames', assert => { assert.isFunction(getOwnPropertyNames); assert.arity(getOwnPropertyNames, 1); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; const names = getOwnPropertyNames([1, 2, 3]); assert.same(names.length, 4); assert.true(includes(names, '0')); assert.true(includes(names, '1')); assert.true(includes(names, '2')); assert.true(includes(names, 'length')); assert.deepEqual(getOwnPropertyNames(new F1()), ['w']); assert.deepEqual(getOwnPropertyNames(new F2()), ['toString']); assert.true(includes(getOwnPropertyNames(Array.prototype), 'toString')); assert.true(includes(getOwnPropertyNames(Object.prototype), 'toString')); assert.true(includes(getOwnPropertyNames(Object.prototype), 'constructor')); assert.deepEqual(getOwnPropertyNames(freeze({})), [], 'frozen'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyNames(value), `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyNames(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyNames(undefined), TypeError, 'throws on undefined'); /* Chakra bug if (typeof document != 'undefined' && document.createElement) { assert.notThrows(() => { const iframe = document.createElement('iframe'); iframe.src = 'http://example.com'; document.documentElement.appendChild(iframe); const window = iframe.contentWindow; document.documentElement.removeChild(iframe); return getOwnPropertyNames(window); }, 'IE11 bug with iframe and window'); } */ }); core-js-3.33.2/tests/unit-pure/es.object.get-own-property-symbols.js000066400000000000000000000022111451776221300254030ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Object.getOwnPropertySymbols', assert => { assert.isFunction(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; prototype[Symbol('getOwnPropertySymbols test 1')] = 42; prototype[Symbol('getOwnPropertySymbols test 2')] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.same(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; object[Symbol('getOwnPropertySymbols test 3')] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.same(getOwnPropertySymbols(object).length, 1); assert.same(getOwnPropertySymbols(Object.prototype).length, 0); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertySymbols(value), `accept ${ typeof value }`); } }); core-js-3.33.2/tests/unit-pure/es.object.get-prototype-of.js000066400000000000000000000026411451776221300237060ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; QUnit.test('Object.getPrototypeOf', assert => { assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.same(getPrototypeOf({}), Object.prototype); assert.same(getPrototypeOf([]), Array.prototype); function F() { /* empty */ } assert.same(getPrototypeOf(new F()), F.prototype); const object = { q: 1 }; assert.same(getPrototypeOf(create(object)), object); assert.same(getPrototypeOf(create(null)), null); assert.same(getPrototypeOf(getPrototypeOf({})), null); function Foo() { /* empty */ } Foo.prototype.foo = 'foo'; function Bar() { /* empty */ } Bar.prototype = create(Foo.prototype); Bar.prototype.constructor = Bar; assert.same(getPrototypeOf(Bar.prototype).foo, 'foo'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getPrototypeOf(value), `accept ${ typeof value }`); } assert.throws(() => getPrototypeOf(null), TypeError, 'throws on null'); assert.throws(() => getPrototypeOf(undefined), TypeError, 'throws on undefined'); assert.same(getPrototypeOf('foo'), String.prototype); }); QUnit.test('Object.getPrototypeOf.sham flag', assert => { assert.same(getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.object.has-own.js000066400000000000000000000013361451776221300220360ustar00rootroot00000000000000import create from 'core-js-pure/es/object/create'; import hasOwn from 'core-js-pure/es/object/has-own'; QUnit.test('Object.hasOwn', assert => { assert.isFunction(hasOwn); assert.arity(hasOwn, 2); assert.name(hasOwn, 'hasOwn'); assert.true(hasOwn({ q: 42 }, 'q')); assert.false(hasOwn({ q: 42 }, 'w')); assert.false(hasOwn(create({ q: 42 }), 'q')); assert.true(hasOwn(Object.prototype, 'hasOwnProperty')); let called = false; try { hasOwn(null, { toString() { called = true; } }); } catch { /* empty */ } assert.false(called, 'modern behaviour'); assert.throws(() => hasOwn(null, 'foo'), TypeError, 'throws on null'); assert.throws(() => hasOwn(undefined, 'foo'), TypeError, 'throws on undefined'); }); core-js-3.33.2/tests/unit-pure/es.object.is-extensible.js000066400000000000000000000007221451776221300232330ustar00rootroot00000000000000import isExtensible from 'core-js-pure/es/object/is-extensible'; QUnit.test('Object.isExtensible', assert => { assert.isFunction(isExtensible); assert.arity(isExtensible, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isExtensible(value) || true, `accept ${ value }`); assert.false(isExtensible(value), `returns false on ${ value }`); } assert.true(isExtensible({})); }); core-js-3.33.2/tests/unit-pure/es.object.is-frozen.js000066400000000000000000000006611451776221300223760ustar00rootroot00000000000000import isFrozen from 'core-js-pure/es/object/is-frozen'; QUnit.test('Object.isFrozen', assert => { assert.isFunction(isFrozen); assert.arity(isFrozen, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isFrozen(value) || true, `accept ${ value }`); assert.true(isFrozen(value), `returns true on ${ value }`); } assert.false(isFrozen({})); }); core-js-3.33.2/tests/unit-pure/es.object.is-sealed.js000066400000000000000000000006611451776221300223300ustar00rootroot00000000000000import isSealed from 'core-js-pure/es/object/is-sealed'; QUnit.test('Object.isSealed', assert => { assert.isFunction(isSealed); assert.arity(isSealed, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isSealed(value) || true, `accept ${ value }`); assert.true(isSealed(value), `returns true on ${ value }`); } assert.false(isSealed({})); }); core-js-3.33.2/tests/unit-pure/es.object.is.js000066400000000000000000000004161451776221300210730ustar00rootroot00000000000000import is from 'core-js-pure/es/object/is'; QUnit.test('Object.is', assert => { assert.isFunction(is); assert.true(is(1, 1), '1 is 1'); assert.true(is(NaN, NaN), '1 is 1'); assert.false(is(0, -0), '0 is not -0'); assert.false(is({}, {}), '{} is not {}'); }); core-js-3.33.2/tests/unit-pure/es.object.keys.js000066400000000000000000000014501451776221300214320ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; import keys from 'core-js-pure/es/object/keys'; QUnit.test('Object.keys', assert => { assert.isFunction(keys); assert.arity(keys, 1); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; assert.deepEqual(keys([1, 2, 3]), ['0', '1', '2']); assert.deepEqual(keys(new F1()), ['w']); assert.deepEqual(keys(new F2()), ['toString']); assert.false(includes(keys(Array.prototype), 'push')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => keys(value), `accept ${ typeof value }`); } assert.throws(() => keys(null), TypeError, 'throws on null'); assert.throws(() => keys(undefined), TypeError, 'throws on undefined'); }); core-js-3.33.2/tests/unit-pure/es.object.lookup-getter.js000066400000000000000000000021671451776221300232660ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import __defineGetter__ from 'core-js-pure/es/object/define-getter'; import __lookupGetter__ from 'core-js-pure/es/object/lookup-getter'; if (DESCRIPTORS) { QUnit.test('Object#__lookupGetter__', assert => { assert.isFunction(__lookupGetter__); assert.same(__lookupGetter__({}, 'key'), undefined, 'empty object'); assert.same(__lookupGetter__({ key: 42 }, 'key'), undefined, 'data descriptor'); const object = {}; function getter() { /* empty */ } __defineGetter__(object, 'key', getter); assert.same(__lookupGetter__(object, 'key'), getter, 'own getter'); assert.same(__lookupGetter__(create(object), 'key'), getter, 'proto getter'); assert.same(__lookupGetter__(create(object), 'foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupGetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupGetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-pure/es.object.lookup-setter.js000066400000000000000000000021671451776221300233020ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import __defineSetter__ from 'core-js-pure/es/object/define-setter'; import __lookupSetter__ from 'core-js-pure/es/object/lookup-setter'; if (DESCRIPTORS) { QUnit.test('Object#__lookupSetter__', assert => { assert.isFunction(__lookupSetter__); assert.same(__lookupSetter__({}, 'key'), undefined, 'empty object'); assert.same(__lookupSetter__({ key: 42 }, 'key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } __defineSetter__(object, 'key', setter); assert.same(__lookupSetter__(object, 'key'), setter, 'own getter'); assert.same(__lookupSetter__(create(object), 'key'), setter, 'proto getter'); assert.same(__lookupSetter__(create(object), 'foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupSetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupSetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.33.2/tests/unit-pure/es.object.prevent-extensions.js000066400000000000000000000022151451776221300243370ustar00rootroot00000000000000import ownKeys from 'core-js-pure/es/reflect/own-keys'; import keys from 'core-js-pure/es/object/keys'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import preventExtensions from 'core-js-pure/es/object/prevent-extensions'; QUnit.test('Object.preventExtensions', assert => { assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => preventExtensions(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(preventExtensions(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in preventExtensions({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(preventExtensions({})), []); assert.arrayEqual(getOwnPropertyNames(preventExtensions({})), []); assert.arrayEqual(getOwnPropertySymbols(preventExtensions({})), []); assert.arrayEqual(ownKeys(preventExtensions({})), []); }); core-js-3.33.2/tests/unit-pure/es.object.seal.js000066400000000000000000000017601451776221300214070ustar00rootroot00000000000000import ownKeys from 'core-js-pure/es/reflect/own-keys'; import keys from 'core-js-pure/es/object/keys'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import seal from 'core-js-pure/es/object/seal'; QUnit.test('Object.seal', assert => { assert.isFunction(seal); assert.arity(seal, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => seal(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(seal(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in seal({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(seal({})), []); assert.arrayEqual(getOwnPropertyNames(seal({})), []); assert.arrayEqual(getOwnPropertySymbols(seal({})), []); assert.arrayEqual(ownKeys(seal({})), []); }); core-js-3.33.2/tests/unit-pure/es.object.set-prototype-of.js000066400000000000000000000012161451776221300237170ustar00rootroot00000000000000import { PROTO } from '../helpers/constants.js'; import setPrototypeOf from 'core-js-pure/es/object/set-prototype-of'; if (PROTO) QUnit.test('Object.setPrototypeOf', assert => { assert.isFunction(setPrototypeOf); assert.true('apply' in setPrototypeOf({}, Function.prototype), 'Parent properties in target'); assert.same(setPrototypeOf({ a: 2 }, { b() { return this.a ** 2; }, }).b(), 4, 'Child and parent properties in target'); const object = {}; assert.same(setPrototypeOf(object, { a: 1 }), object, 'setPrototypeOf return target'); assert.false(('toString' in setPrototypeOf({}, null)), 'Can set null as prototype'); }); core-js-3.33.2/tests/unit-pure/es.object.values.js000066400000000000000000000020441451776221300217560ustar00rootroot00000000000000import assign from 'core-js-pure/es/object/assign'; import create from 'core-js-pure/es/object/create'; import values from 'core-js-pure/es/object/values'; QUnit.test('Object.values', assert => { assert.isFunction(values); assert.arity(values, 1); assert.name(values, 'values'); assert.deepEqual(values({ q: 1, w: 2, e: 3 }), [1, 2, 3]); assert.deepEqual(values(new String('qwe')), ['q', 'w', 'e']); assert.deepEqual(values(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [4, 5, 6]); assert.deepEqual(values({ valueOf: 42 }), [42], 'IE enum keys bug'); try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } }); core-js-3.33.2/tests/unit-pure/es.parse-float.js000066400000000000000000000016221451776221300214300ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants.js'; import parseFloat from 'core-js-pure/es/parse-float'; QUnit.test('parseFloat', assert => { assert.isFunction(parseFloat); assert.arity(parseFloat, 1); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('parseFloat test'); assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.parse-int.js000066400000000000000000000037141451776221300211210ustar00rootroot00000000000000/* eslint-disable prefer-numeric-literals -- required for testing */ import { WHITESPACES } from '../helpers/constants.js'; import parseInt from 'core-js-pure/es/parse-int'; QUnit.test('parseInt', assert => { assert.isFunction(parseInt); assert.arity(parseInt, 2); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('parseInt test'); assert.throws(() => parseInt(symbol), 'throws on symbol argument'); assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.promise.all-settled.js000066400000000000000000000016051451776221300231030ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; QUnit.test('Promise.allSettled', assert => { assert.isFunction(Promise.allSettled); assert.arity(Promise.allSettled, 1); assert.true(Promise.allSettled([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.allSettled, resolved', assert => { return Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.deepEqual(it, [ { value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }, ], 'resolved with a correct value'); }); }); QUnit.test('Promise.allSettled, rejected', assert => { // eslint-disable-next-line promise/valid-params -- required for testing return Promise.allSettled().then(() => { assert.avoid(); }, () => { assert.required('rejected as expected'); }); }); core-js-3.33.2/tests/unit-pure/es.promise.all.js000066400000000000000000000045131451776221300214420ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; import bind from 'core-js-pure/es/function/bind'; QUnit.test('Promise.all', assert => { const { all, resolve } = Promise; assert.isFunction(all); assert.arity(all, 1); const iterable = createIterable([1, 2, 3]); Promise.all(iterable).catch(() => { /* empty */ }); assert.true(iterable.received, 'works with iterables: iterator received'); assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; Promise.all(array); assert.true(done); assert.throws(() => { all.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.all(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch { /* empty */ } Promise.resolve = resolve; assert.true(done, 'iteration closing'); let FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; let FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = bind(resolve, Promise); assert.true(all.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = bind(resolve, Promise); assert.throws(() => { all.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { all.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { all.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-pure/es.promise.any.js000066400000000000000000000026271451776221300214650ustar00rootroot00000000000000import AggregateError from 'core-js-pure/es/aggregate-error'; import Promise from 'core-js-pure/es/promise'; QUnit.test('Promise.any', assert => { assert.isFunction(Promise.any); assert.arity(Promise.any, 1); assert.true(Promise.any([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.any, resolved', assert => { return Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.same(it, 1, 'resolved with a correct value'); }); }); QUnit.test('Promise.any, rejected #1', assert => { return Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).then(() => { assert.avoid(); }, error => { assert.true(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [1, 2, 3], 'rejected with a correct value'); }); }); QUnit.test('Promise.any, rejected #2', assert => { // eslint-disable-next-line promise/valid-params -- required for testing return Promise.any().then(() => { assert.avoid(); }, () => { assert.required('rejected as expected'); }); }); QUnit.test('Promise.any, rejected #3', assert => { return Promise.any([]).then(() => { assert.avoid(); }, error => { assert.true(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [], 'rejected with a correct value'); }); }); core-js-3.33.2/tests/unit-pure/es.promise.catch.js000066400000000000000000000036551451776221300217620ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Promise#catch', assert => { assert.isFunction(Promise.prototype.catch); assert.nonEnumerable(Promise.prototype, 'catch'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.catch(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.catch(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); assert.same(Promise.prototype.catch.call({ // eslint-disable-next-line unicorn/no-thenable -- required for testing then(x, y) { return y; }, }, 42), 42, 'calling `.then`'); }); core-js-3.33.2/tests/unit-pure/es.promise.constructor.js000066400000000000000000000161441451776221300232620ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, PROTO, STRICT } from '../helpers/constants.js'; import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; import setPrototypeOf from 'core-js-pure/es/object/set-prototype-of'; import create from 'core-js-pure/es/object/create'; QUnit.test('Promise', assert => { assert.isFunction(Promise); assert.throws(() => { Promise(); }, 'throws w/o `new`'); new Promise(function (resolve, reject) { assert.isFunction(resolve, 'resolver is function'); assert.isFunction(reject, 'rejector is function'); if (STRICT) assert.same(this, undefined, 'correct executor context'); }); }); if (DESCRIPTORS) QUnit.test('Promise operations order', assert => { let $resolve, $resolve2; assert.expect(1); const EXPECTED_ORDER = 'DEHAFGBC'; const async = assert.async(); let result = ''; const promise1 = new Promise(resolve => { $resolve = resolve; }); $resolve({ // eslint-disable-next-line unicorn/no-thenable -- required for testing then() { result += 'A'; throw new Error(); }, }); promise1.catch(() => { result += 'B'; }); promise1.catch(() => { result += 'C'; assert.same(result, EXPECTED_ORDER); async(); }); const promise2 = new Promise(resolve => { $resolve2 = resolve; }); // eslint-disable-next-line es/no-object-defineproperty, unicorn/no-thenable -- required for testing $resolve2(Object.defineProperty({}, 'then', { get() { result += 'D'; throw new Error(); }, })); result += 'E'; promise2.catch(() => { result += 'F'; }); promise2.catch(() => { result += 'G'; }); result += 'H'; setTimeout(() => { if (!~result.indexOf('C')) { assert.same(result, EXPECTED_ORDER); async(); } }, 1e3); }); QUnit.test('Promise#then', assert => { assert.isFunction(Promise.prototype.then); assert.nonEnumerable(Promise.prototype, 'then'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.then(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(promise.then(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise#@@toStringTag', assert => { assert.same(Promise.prototype[Symbol.toStringTag], 'Promise', 'Promise::@@toStringTag is `Promise`'); assert.same(String(new Promise(() => { /* empty */ })), '[object Promise]', 'correct stringification'); }); if (PROTO) QUnit.test('Promise subclassing', assert => { function SubPromise(executor) { const self = new Promise(executor); setPrototypeOf(self, SubPromise.prototype); self.mine = 'subclass'; return self; } setPrototypeOf(SubPromise, Promise); SubPromise.prototype = create(Promise.prototype); SubPromise.prototype.constructor = SubPromise; let promise1 = SubPromise.resolve(5); assert.same(promise1.mine, 'subclass'); promise1 = promise1.then(it => { assert.same(it, 5); }); assert.same(promise1.mine, 'subclass'); let promise2 = new SubPromise(resolve => { resolve(6); }); assert.same(promise2.mine, 'subclass'); promise2 = promise2.then(it => { assert.same(it, 6); }); assert.same(promise2.mine, 'subclass'); const promise3 = SubPromise.all([promise1, promise2]); assert.same(promise3.mine, 'subclass'); assert.true(promise3 instanceof Promise); assert.true(promise3 instanceof SubPromise); promise3.then(assert.async(), error => { assert.avoid(error); }); }); // qunit@2.5 strange bug QUnit.skip('Unhandled rejection tracking', assert => { let done = false; const resume = assert.async(); if (GLOBAL.process) { assert.expect(3); function onunhandledrejection(reason, promise) { process.removeListener('unhandledRejection', onunhandledrejection); assert.same(promise, $promise, 'unhandledRejection, promise'); assert.same(reason, 42, 'unhandledRejection, reason'); $promise.catch(() => { // empty }); } function onrejectionhandled(promise) { process.removeListener('rejectionHandled', onrejectionhandled); assert.same(promise, $promise, 'rejectionHandled, promise'); done || resume(); done = true; } process.on('unhandledRejection', onunhandledrejection); process.on('rejectionHandled', onrejectionhandled); } else { if (GLOBAL.addEventListener) { assert.expect(8); function onunhandledrejection(it) { assert.same(it.promise, $promise, 'addEventListener(unhandledrejection), promise'); assert.same(it.reason, 42, 'addEventListener(unhandledrejection), reason'); GLOBAL.removeEventListener('unhandledrejection', onunhandledrejection); } GLOBAL.addEventListener('rejectionhandled', onunhandledrejection); function onrejectionhandled(it) { assert.same(it.promise, $promise, 'addEventListener(rejectionhandled), promise'); assert.same(it.reason, 42, 'addEventListener(rejectionhandled), reason'); GLOBAL.removeEventListener('rejectionhandled', onrejectionhandled); } GLOBAL.addEventListener('rejectionhandled', onrejectionhandled); } else assert.expect(4); GLOBAL.onunhandledrejection = function (it) { assert.same(it.promise, $promise, 'onunhandledrejection, promise'); assert.same(it.reason, 42, 'onunhandledrejection, reason'); setTimeout(() => { $promise.catch(() => { // empty }); }, 1); GLOBAL.onunhandledrejection = null; }; GLOBAL.onrejectionhandled = function (it) { assert.same(it.promise, $promise, 'onrejectionhandled, promise'); assert.same(it.reason, 42, 'onrejectionhandled, reason'); GLOBAL.onrejectionhandled = null; done || resume(); done = true; }; } Promise.reject(43).catch(() => { // empty }); const $promise = Promise.reject(42); setTimeout(() => { done || resume(); done = true; }, 3e3); }); core-js-3.33.2/tests/unit-pure/es.promise.finally.js000066400000000000000000000022011451776221300223200ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; QUnit.test('Promise#finally', assert => { assert.isFunction(Promise.prototype.finally); assert.arity(Promise.prototype.finally, 1); assert.nonEnumerable(Promise.prototype, 'finally'); assert.true(Promise.resolve(42).finally(() => { /* empty */ }) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise#finally, resolved', assert => { let called = 0; let argument = null; return Promise.resolve(42).finally(it => { called++; argument = it; }).then(it => { assert.same(it, 42, 'resolved with a correct value'); assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); }); }); QUnit.test('Promise#finally, rejected', assert => { let called = 0; let argument = null; return Promise.reject(42).finally(it => { called++; argument = it; }).then(() => { assert.avoid(); }, () => { assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); }); }); core-js-3.33.2/tests/unit-pure/es.promise.race.js000066400000000000000000000045271451776221300216110ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; import bind from 'core-js-pure/es/function/bind'; QUnit.test('Promise.race', assert => { const { race, resolve } = Promise; assert.isFunction(race); assert.arity(race, 1); const iterable = createIterable([1, 2, 3]); Promise.race(iterable).catch(() => { /* empty */ }); assert.true(iterable.received, 'works with iterables: iterator received'); assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; Promise.race(array); assert.true(done); assert.throws(() => { race.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.race(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch { /* empty */ } Promise.resolve = resolve; assert.true(done, 'iteration closing'); let FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; let FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = bind(resolve, Promise); assert.true(race.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = bind(resolve, Promise); assert.throws(() => { race.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { race.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { race.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-pure/es.promise.reject.js000066400000000000000000000020541451776221300221440ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Promise.reject', assert => { const { reject } = Promise; assert.isFunction(reject); assert.throws(() => { reject.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(reject.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { reject.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { reject.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { reject.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-pure/es.promise.resolve.js000066400000000000000000000020641451776221300223500ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Promise.resolve', assert => { const { resolve } = Promise; assert.isFunction(resolve); assert.throws(() => { resolve.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.true(resolve.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { resolve.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { resolve.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { resolve.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); core-js-3.33.2/tests/unit-pure/es.reflect.apply.js000066400000000000000000000013441451776221300217640ustar00rootroot00000000000000import apply from 'core-js-pure/es/reflect/apply'; QUnit.test('Reflect.apply', assert => { assert.isFunction(apply); assert.arity(apply, 3); if ('name' in apply) { assert.name(apply, 'apply'); } assert.same(apply(Array.prototype.push, [1, 2], [3, 4, 5]), 5); function F(a, b, c) { return a + b + c; } F.apply = 42; assert.same(apply(F, null, ['foo', 'bar', 'baz']), 'foobarbaz', 'works with redefined apply'); assert.throws(() => apply(42, null, []), TypeError, 'throws on primitive'); assert.throws(() => apply(() => { /* empty */ }, null), TypeError, 'throws without third argument'); assert.throws(() => apply(() => { /* empty */ }, null, '123'), TypeError, 'throws on primitive as third argument'); }); core-js-3.33.2/tests/unit-pure/es.reflect.construct.js000066400000000000000000000022751451776221300226670ustar00rootroot00000000000000import construct from 'core-js-pure/es/reflect/construct'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; QUnit.test('Reflect.construct', assert => { assert.isFunction(construct); assert.arity(construct, 2); if ('name' in construct) { assert.name(construct, 'construct'); } function A(a, b, c) { this.qux = a + b + c; } assert.same(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'basic'); A.apply = 42; assert.same(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'works with redefined apply'); const instance = construct(function () { this.x = 42; }, [], Array); assert.same(instance.x, 42, 'constructor with newTarget'); assert.true(instance instanceof Array, 'prototype with newTarget'); assert.throws(() => construct(42, []), TypeError, 'throws on primitive'); function B() { /* empty */ } B.prototype = 42; assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype); assert.notThrows(() => typeof construct(Date, []).getTime() == 'number', 'works with native constructors with 2 arguments'); assert.throws(() => construct(() => { /* empty */ }), 'throws when the second argument is not an object'); }); core-js-3.33.2/tests/unit-pure/es.reflect.define-property.js000066400000000000000000000025221451776221300237520ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/reflect/define-property'; QUnit.test('Reflect.defineProperty', assert => { assert.isFunction(defineProperty); assert.arity(defineProperty, 3); if ('name' in defineProperty) { assert.name(defineProperty, 'defineProperty'); } let object = {}; assert.true(defineProperty(object, 'foo', { value: 123 })); assert.same(object.foo, 123); if (DESCRIPTORS) { object = {}; defineProperty(object, 'foo', { value: 123, enumerable: true, }); assert.deepEqual(getOwnPropertyDescriptor(object, 'foo'), { value: 123, enumerable: true, configurable: false, writable: false, }); assert.false(defineProperty(object, 'foo', { value: 42, })); } assert.throws(() => defineProperty(42, 'foo', { value: 42, }), TypeError, 'throws on primitive'); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Reflect.defineProperty.sham flag', assert => { assert.same(defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.reflect.delete-property.js000066400000000000000000000014111451776221300237560ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import keys from 'core-js-pure/es/object/keys'; import defineProperty from 'core-js-pure/es/object/define-property'; import deleteProperty from 'core-js-pure/es/reflect/delete-property'; QUnit.test('Reflect.deleteProperty', assert => { assert.isFunction(deleteProperty); assert.arity(deleteProperty, 2); if ('name' in deleteProperty) { assert.name(deleteProperty, 'deleteProperty'); } const object = { bar: 456 }; assert.true(deleteProperty(object, 'bar')); assert.same(keys(object).length, 0); if (DESCRIPTORS) { assert.false(deleteProperty(defineProperty({}, 'foo', { value: 42, }), 'foo')); } assert.throws(() => deleteProperty(42, 'foo'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.reflect.get-own-property-descriptor.js000066400000000000000000000014501451776221300262530ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import getOwnPropertyDescriptor from 'core-js-pure/es/reflect/get-own-property-descriptor'; QUnit.test('Reflect.getOwnPropertyDescriptor', assert => { assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); if ('name' in getOwnPropertyDescriptor) { assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); } const object = { baz: 789 }; const descriptor = getOwnPropertyDescriptor(object, 'baz'); assert.same(descriptor.value, 789); assert.throws(() => getOwnPropertyDescriptor(42, 'constructor'), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getOwnPropertyDescriptor.sham flag', assert => { assert.same(getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.reflect.get-prototype-of.js000066400000000000000000000011651451776221300240640ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants.js'; import getPrototypeOf from 'core-js-pure/es/reflect/get-prototype-of'; QUnit.test('Reflect.getPrototypeOf', assert => { assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); if ('name' in getPrototypeOf) { assert.name(getPrototypeOf, 'getPrototypeOf'); } assert.same(getPrototypeOf([]), Array.prototype); assert.throws(() => getPrototypeOf(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getPrototypeOf.sham flag', assert => { assert.same(getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.reflect.get.js000066400000000000000000000020451451776221300214150ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/object/define-property'; import get from 'core-js-pure/es/reflect/get'; QUnit.test('Reflect.get', assert => { assert.isFunction(get); if ('name' in get) { assert.name(get, 'get'); } assert.same(get({ qux: 987 }, 'qux'), 987); if (DESCRIPTORS) { const target = create(defineProperty({ z: 3 }, 'w', { get() { return this; }, }), { x: { value: 1, }, y: { get() { return this; }, }, }); const receiver = {}; assert.same(get(target, 'x', receiver), 1, 'get x'); assert.same(get(target, 'y', receiver), receiver, 'get y'); assert.same(get(target, 'z', receiver), 3, 'get z'); assert.same(get(target, 'w', receiver), receiver, 'get w'); assert.same(get(target, 'u', receiver), undefined, 'get u'); } assert.throws(() => get(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.reflect.has.js000066400000000000000000000006431451776221300214130ustar00rootroot00000000000000import has from 'core-js-pure/es/reflect/has'; QUnit.test('Reflect.has', assert => { assert.isFunction(has); assert.arity(has, 2); if ('name' in has) { assert.name(has, 'has'); } const object = { qux: 987 }; assert.true(has(object, 'qux')); assert.false(has(object, 'qwe')); assert.true(has(object, 'toString')); assert.throws(() => has(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.reflect.is-extensible.js000066400000000000000000000011141451776221300234050ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import preventExtensions from 'core-js-pure/es/object/prevent-extensions'; import isExtensible from 'core-js-pure/es/reflect/is-extensible'; QUnit.test('Reflect.isExtensible', assert => { assert.isFunction(isExtensible); assert.arity(isExtensible, 1); if ('name' in isExtensible) { assert.name(isExtensible, 'isExtensible'); } assert.true(isExtensible({})); if (DESCRIPTORS) { assert.false(isExtensible(preventExtensions({}))); } assert.throws(() => isExtensible(42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.reflect.own-keys.js000066400000000000000000000020131451776221300224050ustar00rootroot00000000000000import { includes } from '../helpers/helpers.js'; import Symbol from 'core-js-pure/es/symbol'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/object/define-property'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; QUnit.test('Reflect.ownKeys', assert => { assert.isFunction(ownKeys); assert.arity(ownKeys, 1); if ('name' in ownKeys) { assert.name(ownKeys, 'ownKeys'); } const object = { a: 1 }; defineProperty(object, 'b', { value: 2, }); object[Symbol('c')] = 3; let keys = ownKeys(object); assert.same(keys.length, 3, 'ownKeys return all own keys'); assert.true(includes(keys, 'a'), 'ownKeys return all own keys: simple'); assert.true(includes(keys, 'b'), 'ownKeys return all own keys: hidden'); assert.same(object[keys[2]], 3, 'ownKeys return all own keys: symbol'); keys = ownKeys(create(object)); assert.same(keys.length, 0, 'ownKeys return only own keys'); assert.throws(() => ownKeys(42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.reflect.prevent-extensions.js000066400000000000000000000014171451776221300245200ustar00rootroot00000000000000import { DESCRIPTORS, FREEZING } from '../helpers/constants.js'; import preventExtensions from 'core-js-pure/es/reflect/prevent-extensions'; import isExtensible from 'core-js-pure/es/object/is-extensible'; QUnit.test('Reflect.preventExtensions', assert => { assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); if ('name' in preventExtensions) { assert.name(preventExtensions, 'preventExtensions'); } const object = {}; assert.true(preventExtensions(object)); if (DESCRIPTORS) { assert.false(isExtensible(object)); } assert.throws(() => preventExtensions(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.preventExtensions.sham flag', assert => { assert.same(preventExtensions.sham, FREEZING ? undefined : true); }); core-js-3.33.2/tests/unit-pure/es.reflect.set-prototype-of.js000066400000000000000000000012251451776221300240750ustar00rootroot00000000000000import { PROTO } from '../helpers/constants.js'; import setPrototypeOf from 'core-js-pure/es/reflect/set-prototype-of'; if (PROTO) QUnit.test('Reflect.setPrototypeOf', assert => { assert.isFunction(setPrototypeOf); if ('name' in setPrototypeOf) { assert.name(setPrototypeOf, 'setPrototypeOf'); } let object = {}; assert.true(setPrototypeOf(object, Array.prototype)); assert.true(object instanceof Array); assert.throws(() => setPrototypeOf({}, 42), TypeError); assert.throws(() => setPrototypeOf(42, {}), TypeError, 'throws on primitive'); object = {}; assert.false(setPrototypeOf(object, object), 'false on recursive __proto__'); }); core-js-3.33.2/tests/unit-pure/es.reflect.set.js000066400000000000000000000054121451776221300214320ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/object/define-property'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import set from 'core-js-pure/es/reflect/set'; QUnit.test('Reflect.set', assert => { assert.isFunction(set); if ('name' in set) { assert.name(set, 'set'); } const object = {}; assert.true(set(object, 'quux', 654)); assert.same(object.quux, 654); let target = {}; const receiver = {}; set(target, 'foo', 1, receiver); assert.same(target.foo, undefined, 'target.foo === undefined'); assert.same(receiver.foo, 1, 'receiver.foo === 1'); if (DESCRIPTORS) { defineProperty(receiver, 'bar', { value: 0, writable: true, enumerable: false, configurable: true, }); set(target, 'bar', 1, receiver); assert.same(receiver.bar, 1, 'receiver.bar === 1'); assert.false(getOwnPropertyDescriptor(receiver, 'bar').enumerable, 'enumerability not overridden'); let out = null; target = create(defineProperty({ z: 3 }, 'w', { set() { out = this; }, }), { x: { value: 1, writable: true, configurable: true, }, y: { set() { out = this; }, }, c: { value: 1, writable: false, configurable: false, }, }); assert.true(set(target, 'x', 2, target), 'set x'); assert.same(target.x, 2, 'set x'); out = null; assert.true(set(target, 'y', 2, target), 'set y'); assert.same(out, target, 'set y'); assert.true(set(target, 'z', 4, target)); assert.same(target.z, 4, 'set z'); out = null; assert.true(set(target, 'w', 1, target), 'set w'); assert.same(out, target, 'set w'); assert.true(set(target, 'u', 0, target), 'set u'); assert.same(target.u, 0, 'set u'); assert.false(set(target, 'c', 2, target), 'set c'); assert.same(target.c, 1, 'set c'); // https://github.com/zloirock/core-js/issues/392 let o = defineProperty({}, 'test', { writable: false, configurable: true, }); assert.false(set(getPrototypeOf(o), 'test', 1, o)); // https://github.com/zloirock/core-js/issues/393 o = defineProperty({}, 'test', { get() { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); o = defineProperty({}, 'test', { // eslint-disable-next-line no-unused-vars -- required for testing set(v) { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); } assert.throws(() => set(42, 'q', 42), TypeError, 'throws on primitive'); }); core-js-3.33.2/tests/unit-pure/es.set.js000066400000000000000000000252111451776221300200060ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite -- required for testing */ import { createIterable, is, nativeSubclass } from '../helpers/helpers.js'; import { DESCRIPTORS } from '../helpers/constants.js'; import getIterator from 'core-js-pure/es/get-iterator'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import from from 'core-js-pure/es/array/from'; import freeze from 'core-js-pure/es/object/freeze'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import keys from 'core-js-pure/es/object/keys'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; import Symbol from 'core-js-pure/es/symbol'; import Map from 'core-js-pure/es/map'; import Set from 'core-js-pure/es/set'; QUnit.test('Set', assert => { assert.isFunction(Set); assert.true('add' in Set.prototype, 'add in Set.prototype'); assert.true('clear' in Set.prototype, 'clear in Set.prototype'); assert.true('delete' in Set.prototype, 'delete in Set.prototype'); assert.true('forEach' in Set.prototype, 'forEach in Set.prototype'); assert.true('has' in Set.prototype, 'has in Set.prototype'); assert.true(new Set() instanceof Set, 'new Set instanceof Set'); let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); assert.same(set.size, 3); const result = []; set.forEach(val => { result.push(val); }); assert.deepEqual(result, [1, 2, 3]); assert.same(new Set(createIterable([1, 2, 3])).size, 3, 'Init from iterable'); assert.same(new Set([freeze({}), 1]).size, 2, 'Support frozen objects'); assert.same(new Set([NaN, NaN, NaN]).size, 1); assert.deepEqual(from(new Set([3, 4]).add(2).add(1)), [3, 4, 2, 1]); let done = false; const { add } = Set.prototype; Set.prototype.add = function () { throw new Error(); }; try { new Set(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } Set.prototype.add = add; assert.true(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new Set(array); assert.true(done); const object = {}; new Set().add(object); if (DESCRIPTORS) { const results = []; for (const key in results) keys.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Set); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof Set, 'correct subclassing with native classes #2'); assert.true(new Subclass().add(2).has(2), 'correct subclassing with native classes #3'); } if (typeof ArrayBuffer == 'function') { const buffer = new ArrayBuffer(8); set = new Set([buffer]); assert.true(set.has(buffer), 'works with ArrayBuffer keys'); } }); QUnit.test('Set#add', assert => { assert.isFunction(Set.prototype.add); const array = []; let set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.same(set.size, 5); const chain = set.add(NaN); assert.same(chain, set); assert.same(set.size, 5); set.add(2); assert.same(set.size, 5); set.add(array); assert.same(set.size, 5); set.add([]); assert.same(set.size, 6); set.add(4); assert.same(set.size, 7); const frozen = freeze({}); set = new Set(); set.add(frozen); assert.true(set.has(frozen)); }); QUnit.test('Set#clear', assert => { assert.isFunction(Set.prototype.clear); let set = new Set(); set.clear(); assert.same(set.size, 0); set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.clear(); assert.same(set.size, 0); assert.false(set.has(1)); assert.false(set.has(2)); assert.false(set.has(3)); const frozen = freeze({}); set = new Set(); set.add(1); set.add(frozen); set.clear(); assert.same(set.size, 0, 'Support frozen objects'); assert.false(set.has(1)); assert.false(set.has(frozen)); }); QUnit.test('Set#delete', assert => { assert.isFunction(Set.prototype.delete); const array = []; const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.same(set.size, 5); assert.true(set.delete(NaN)); assert.same(set.size, 4); assert.false(set.delete(4)); assert.same(set.size, 4); set.delete([]); assert.same(set.size, 4); set.delete(array); assert.same(set.size, 3); const frozen = freeze({}); set.add(frozen); assert.same(set.size, 4); set.delete(frozen); assert.same(set.size, 3); }); QUnit.test('Set#forEach', assert => { assert.isFunction(Set.prototype.forEach); let result = []; let count = 0; let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.forEach(value => { count++; result.push(value); }); assert.same(count, 3); assert.deepEqual(result, [1, 2, 3]); set = new Set(); set.add('0'); set.add('1'); set.add('2'); set.add('3'); result = ''; set.forEach(it => { result += it; if (it === '2') { set.delete('2'); set.delete('3'); set.delete('1'); set.add('4'); } }); assert.same(result, '0124'); set = new Set(); set.add('0'); result = ''; set.forEach(it => { set.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.same(result, '0'); assert.throws(() => { Set.prototype.forEach.call(new Map(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Set#has', assert => { assert.isFunction(Set.prototype.has); const array = []; const frozen = freeze({}); const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(frozen); set.add(array); assert.true(set.has(NaN)); assert.true(set.has(array)); assert.true(set.has(frozen)); assert.true(set.has(2)); assert.false(set.has(4)); assert.false(set.has([])); }); QUnit.test('Set#size', assert => { const set = new Set(); set.add(1); const { size } = set; assert.same(typeof size, 'number', 'size is number'); assert.same(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Set.prototype, 'size'); const getter = sizeDescriptor && sizeDescriptor.get; const setter = sizeDescriptor && sizeDescriptor.set; assert.same(typeof getter, 'function', 'size is getter'); assert.same(typeof setter, 'undefined', 'size is not setter'); assert.throws(() => { Set.prototype.size; }, TypeError); } }); QUnit.test('Set & -0', assert => { let set = new Set(); set.add(-0); assert.same(set.size, 1); assert.true(set.has(0)); assert.true(set.has(-0)); set.forEach(it => { assert.false(is(it, -0)); }); set.delete(-0); assert.same(set.size, 0); set = new Set([-0]); set.forEach(key => { assert.false(is(key, -0)); }); set = new Set(); set.add(4); set.add(3); set.add(2); set.add(1); set.add(0); assert.true(set.has(-0)); }); QUnit.test('Set#@@toStringTag', assert => { assert.same(Set.prototype[Symbol.toStringTag], 'Set', 'Set::@@toStringTag is `Set`'); assert.same(String(new Set()), '[object Set]', 'correct stringification'); }); QUnit.test('Set Iterator', assert => { const set = new Set(); set.add('a'); set.add('b'); set.add('c'); set.add('d'); const results = []; const iterator = set.keys(); results.push(iterator.next().value); assert.true(set.delete('a')); assert.true(set.delete('b')); assert.true(set.delete('c')); set.add('e'); results.push(iterator.next().value, iterator.next().value); assert.true(iterator.next().done); set.add('f'); assert.true(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Set#keys', assert => { assert.isFunction(Set.prototype.keys); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#values', assert => { assert.isFunction(Set.prototype.values); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#entries', assert => { assert.isFunction(Set.prototype.entries); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['w', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['e', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#@@iterator', assert => { const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = getIterator(set); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Set Iterator'); assert.same(String(iterator), '[object Set Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/es.string.anchor.js000066400000000000000000000010431451776221300217670ustar00rootroot00000000000000import anchor from 'core-js-pure/es/string/anchor'; QUnit.test('String#anchor', assert => { assert.isFunction(anchor); assert.same(anchor('a', 'b'), 'a', 'lower case'); assert.same(anchor('a', '"'), 'a', 'escape quotes'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('anchor test'); assert.throws(() => anchor(symbol, 'b'), 'throws on symbol context'); assert.throws(() => anchor('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.string.at-alternative.js000066400000000000000000000021001451776221300234300ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import at from 'core-js-pure/es/string/at'; QUnit.test('String#at', assert => { assert.isFunction(at); assert.same('1', at('123', 0)); assert.same('2', at('123', 1)); assert.same('3', at('123', 2)); assert.same(undefined, at('123', 3)); assert.same('3', at('123', -1)); assert.same('2', at('123', -2)); assert.same('1', at('123', -3)); assert.same(undefined, at('123', -4)); assert.same('1', at('123', 0.4)); assert.same('1', at('123', 0.5)); assert.same('1', at('123', 0.6)); assert.same('1', at('1', NaN)); assert.same('1', at('1')); assert.same('1', at('123', -0)); // TODO: disabled by default because of the conflict with old proposal // assert.same('\uD842', at('𠮷')); assert.same('1', at({ toString() { return '123'; } }, 0)); assert.throws(() => at(Symbol('at-alternative test'), 0), 'throws on symbol context'); if (STRICT) { assert.throws(() => at(null, 0), TypeError); assert.throws(() => at(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.big.js000066400000000000000000000005161451776221300212620ustar00rootroot00000000000000import big from 'core-js-pure/es/string/big'; QUnit.test('String#big', assert => { assert.isFunction(big); assert.same(big('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => big(Symbol('big test')), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.string.blink.js000066400000000000000000000005371451776221300216230ustar00rootroot00000000000000import blink from 'core-js-pure/es/string/blink'; QUnit.test('String#blink', assert => { assert.isFunction(blink); assert.same(blink('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => blink(Symbol('blink test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.bold.js000066400000000000000000000005201451776221300214340ustar00rootroot00000000000000import bold from 'core-js-pure/es/string/bold'; QUnit.test('String#bold', assert => { assert.isFunction(bold); assert.same(bold('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => bold(Symbol('bold test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.code-point-at.js000066400000000000000000000065251451776221300231720ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import codePointAt from 'core-js-pure/es/string/code-point-at'; QUnit.test('String#codePointAt', assert => { assert.isFunction(codePointAt); assert.same(codePointAt('abc\uD834\uDF06def', ''), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', '_'), 0x61); assert.same(codePointAt('abc\uD834\uDF06def'), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', -Infinity), undefined); assert.same(codePointAt('abc\uD834\uDF06def', -1), undefined); assert.same(codePointAt('abc\uD834\uDF06def', -0), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', 0), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', 3), 0x1D306); assert.same(codePointAt('abc\uD834\uDF06def', 4), 0xDF06); assert.same(codePointAt('abc\uD834\uDF06def', 5), 0x64); assert.same(codePointAt('abc\uD834\uDF06def', 42), undefined); assert.same(codePointAt('abc\uD834\uDF06def', Infinity), undefined); assert.same(codePointAt('abc\uD834\uDF06def', Infinity), undefined); assert.same(codePointAt('abc\uD834\uDF06def', NaN), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', false), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', null), 0x61); assert.same(codePointAt('abc\uD834\uDF06def', undefined), 0x61); assert.same(codePointAt('\uD834\uDF06def', ''), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', '1'), 0xDF06); assert.same(codePointAt('\uD834\uDF06def', '_'), 0x1D306); assert.same(codePointAt('\uD834\uDF06def'), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', -1), undefined); assert.same(codePointAt('\uD834\uDF06def', -0), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', 0), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', 1), 0xDF06); assert.same(codePointAt('\uD834\uDF06def', 42), undefined); assert.same(codePointAt('\uD834\uDF06def', false), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', null), 0x1D306); assert.same(codePointAt('\uD834\uDF06def', undefined), 0x1D306); assert.same(codePointAt('\uD834abc', ''), 0xD834); assert.same(codePointAt('\uD834abc', '_'), 0xD834); assert.same(codePointAt('\uD834abc'), 0xD834); assert.same(codePointAt('\uD834abc', -1), undefined); assert.same(codePointAt('\uD834abc', -0), 0xD834); assert.same(codePointAt('\uD834abc', 0), 0xD834); assert.same(codePointAt('\uD834abc', false), 0xD834); assert.same(codePointAt('\uD834abc', NaN), 0xD834); assert.same(codePointAt('\uD834abc', null), 0xD834); assert.same(codePointAt('\uD834abc', undefined), 0xD834); assert.same(codePointAt('\uDF06abc', ''), 0xDF06); assert.same(codePointAt('\uDF06abc', '_'), 0xDF06); assert.same(codePointAt('\uDF06abc'), 0xDF06); assert.same(codePointAt('\uDF06abc', -1), undefined); assert.same(codePointAt('\uDF06abc', -0), 0xDF06); assert.same(codePointAt('\uDF06abc', 0), 0xDF06); assert.same(codePointAt('\uDF06abc', false), 0xDF06); assert.same(codePointAt('\uDF06abc', NaN), 0xDF06); assert.same(codePointAt('\uDF06abc', null), 0xDF06); assert.same(codePointAt('\uDF06abc', undefined), 0xDF06); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => codePointAt(Symbol('codePointAt test'), 1), 'throws on symbol context'); } if (STRICT) { assert.throws(() => codePointAt(null, 0), TypeError); assert.throws(() => codePointAt(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.ends-with.js000066400000000000000000000027051451776221300224250ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import endsWith from 'core-js-pure/es/string/ends-with'; QUnit.test('String#endsWith', assert => { assert.isFunction(endsWith); assert.true(endsWith('undefined')); assert.false(endsWith('undefined', null)); assert.true(endsWith('abc', '')); assert.true(endsWith('abc', 'c')); assert.true(endsWith('abc', 'bc')); assert.false(endsWith('abc', 'ab')); assert.true(endsWith('abc', '', NaN)); assert.false(endsWith('abc', 'c', -1)); assert.true(endsWith('abc', 'a', 1)); assert.true(endsWith('abc', 'c', Infinity)); assert.true(endsWith('abc', 'a', true)); assert.false(endsWith('abc', 'c', 'x')); assert.false(endsWith('abc', 'a', 'x')); if (!Symbol.sham) { const symbol = Symbol('endsWith test'); assert.throws(() => endsWith(symbol, 'b'), 'throws on symbol context'); assert.throws(() => endsWith('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => endsWith(null, '.'), TypeError); assert.throws(() => endsWith(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => endsWith('/./', regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => endsWith('/./', regexp)); const object = {}; assert.notThrows(() => endsWith('[object Object]', object)); object[Symbol.match] = true; assert.throws(() => endsWith('[object Object]', object), TypeError); }); core-js-3.33.2/tests/unit-pure/es.string.fixed.js000066400000000000000000000005311451776221300216150ustar00rootroot00000000000000import fixed from 'core-js-pure/es/string/fixed'; QUnit.test('String#fixed', assert => { assert.isFunction(fixed); assert.same(fixed('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => fixed(Symbol('fixed test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.fontcolor.js000066400000000000000000000011141451776221300225210ustar00rootroot00000000000000import fontcolor from 'core-js-pure/es/string/fontcolor'; QUnit.test('String#fontcolor', assert => { assert.isFunction(fontcolor); assert.same(fontcolor('a', 'b'), 'a', 'lower case'); assert.same(fontcolor('a', '"'), 'a', 'escape quotes'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('fontcolor test'); assert.throws(() => fontcolor(symbol, 'b'), 'throws on symbol context'); assert.throws(() => fontcolor('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.string.fontsize.js000066400000000000000000000011011451776221300223510ustar00rootroot00000000000000import fontsize from 'core-js-pure/es/string/fontsize'; QUnit.test('String#fontsize', assert => { assert.isFunction(fontsize); assert.same(fontsize('a', 'b'), 'a', 'lower case'); assert.same(fontsize('a', '"'), 'a', 'escape quotes'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('fontsize test'); assert.throws(() => fontsize(symbol, 'b'), 'throws on symbol context'); assert.throws(() => fontsize('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.string.from-code-point.js000066400000000000000000000037341451776221300235300ustar00rootroot00000000000000/* eslint-disable prefer-spread -- required for testing */ import fromCodePoint from 'core-js-pure/es/string/from-code-point'; QUnit.test('String.fromCodePoint', assert => { assert.isFunction(fromCodePoint); assert.arity(fromCodePoint, 1); if ('name' in fromCodePoint) { assert.name(fromCodePoint, 'fromCodePoint'); } assert.same(fromCodePoint(''), '\0'); assert.same(fromCodePoint(), ''); assert.same(fromCodePoint(-0), '\0'); assert.same(fromCodePoint(0), '\0'); assert.same(fromCodePoint(0x1D306), '\uD834\uDF06'); assert.same(fromCodePoint(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07'); assert.same(fromCodePoint(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07'); assert.same(fromCodePoint(false), '\0'); assert.same(fromCodePoint(null), '\0'); assert.throws(() => fromCodePoint('_'), RangeError); assert.throws(() => fromCodePoint('+Infinity'), RangeError); assert.throws(() => fromCodePoint('-Infinity'), RangeError); assert.throws(() => fromCodePoint(-1), RangeError); assert.throws(() => fromCodePoint(0x10FFFF + 1), RangeError); assert.throws(() => fromCodePoint(3.14), RangeError); assert.throws(() => fromCodePoint(3e-2), RangeError); assert.throws(() => fromCodePoint(-Infinity), RangeError); assert.throws(() => fromCodePoint(Infinity), RangeError); assert.throws(() => fromCodePoint(NaN), RangeError); assert.throws(() => fromCodePoint(undefined), RangeError); assert.throws(() => fromCodePoint({}), RangeError); assert.throws(() => fromCodePoint(/./), RangeError); let number = 0x60; assert.same(fromCodePoint({ valueOf() { return ++number; }, }), 'a'); assert.same(number, 0x61); // one code unit per symbol let counter = 2 ** 15 * 3 / 2; let result = []; while (--counter >= 0) result.push(0); // should not throw fromCodePoint.apply(null, result); counter = 2 ** 15 * 3 / 2; result = []; while (--counter >= 0) result.push(0xFFFF + 1); // should not throw fromCodePoint.apply(null, result); }); core-js-3.33.2/tests/unit-pure/es.string.includes.js000066400000000000000000000020511451776221300223230ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import includes from 'core-js-pure/es/string/includes'; QUnit.test('String#includes', assert => { assert.isFunction(includes); assert.false(includes('abc')); assert.true(includes('aundefinedb')); assert.true(includes('abcd', 'b', 1)); assert.false(includes('abcd', 'b', 2)); if (!Symbol.sham) { const symbol = Symbol('includes test'); assert.throws(() => includes(symbol, 'b'), 'throws on symbol context'); assert.throws(() => includes('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => includes(null, '.'), TypeError); assert.throws(() => includes(undefined, '.'), TypeError); } const re = /./; assert.throws(() => includes('/./', re), TypeError); re[Symbol.match] = false; assert.notThrows(() => includes('/./', re)); const O = {}; assert.notThrows(() => includes('[object Object]', O)); O[Symbol.match] = true; assert.throws(() => includes('[object Object]', O), TypeError); }); core-js-3.33.2/tests/unit-pure/es.string.is-well-formed.js000066400000000000000000000027521451776221300233530ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import isWellFormed from 'core-js-pure/es/string/virtual/is-well-formed'; QUnit.test('String#isWellFormed', assert => { assert.isFunction(isWellFormed); assert.true(isWellFormed.call('a'), 'a'); assert.true(isWellFormed.call('abc'), 'abc'); assert.true(isWellFormed.call('💩'), '💩'); assert.true(isWellFormed.call('💩b'), '💩b'); assert.true(isWellFormed.call('a💩'), '💩'); assert.true(isWellFormed.call('a💩b'), 'a💩b'); assert.true(isWellFormed.call('💩a💩'), '💩a💩'); assert.true(!isWellFormed.call('\uD83D'), '\uD83D'); assert.true(!isWellFormed.call('\uDCA9'), '\uDCA9'); assert.true(!isWellFormed.call('\uDCA9\uD83D'), '\uDCA9\uD83D'); assert.true(!isWellFormed.call('a\uD83D'), 'a\uD83D'); assert.true(!isWellFormed.call('\uDCA9a'), '\uDCA9a'); assert.true(!isWellFormed.call('a\uD83Da'), 'a\uD83Da'); assert.true(!isWellFormed.call('a\uDCA9a'), 'a\uDCA9a'); assert.true(isWellFormed.call({ toString() { return 'abc'; }, }), 'conversion #1'); assert.true(!isWellFormed.call({ toString() { return '\uD83D'; }, }), 'conversion #2'); if (STRICT) { assert.throws(() => isWellFormed.call(null), TypeError, 'coercible #1'); assert.throws(() => isWellFormed.call(undefined), TypeError, 'coercible #2'); } assert.throws(() => isWellFormed.call(Symbol('isWellFormed test')), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-pure/es.string.italics.js000066400000000000000000000005451451776221300221530ustar00rootroot00000000000000import italics from 'core-js-pure/es/string/italics'; QUnit.test('String#italics', assert => { assert.isFunction(italics); assert.same(italics('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => italics(Symbol('italics test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.iterator.js000066400000000000000000000024761451776221300223610ustar00rootroot00000000000000import getIterator from 'core-js-pure/es/get-iterator'; // import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import Symbol from 'core-js-pure/es/symbol'; import from from 'core-js-pure/es/array/from'; QUnit.test('String#@@iterator', assert => { let iterator = getIterator('qwe'); assert.isIterator(iterator); assert.same(iterator[Symbol.toStringTag], 'String Iterator'); assert.same(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.same(from('𠮷𠮷𠮷').length, 3); iterator = getIterator('𠮷𠮷𠮷'); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); // early FF case with native method, but polyfilled `Symbol` // assert.throws(() => getIteratorMethod('').call(Symbol()), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-pure/es.string.link.js000066400000000000000000000010211451776221300214460ustar00rootroot00000000000000import link from 'core-js-pure/es/string/link'; QUnit.test('String#link', assert => { assert.isFunction(link); assert.same(link('a', 'b'), 'a', 'lower case'); assert.same(link('a', '"'), 'a', 'escape quotes'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('link test'); assert.throws(() => link(symbol, 'b'), 'throws on symbol context'); assert.throws(() => link('a', symbol), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.string.match-all.js000066400000000000000000000066371451776221300223750ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import assign from 'core-js-pure/es/object/assign'; import matchAll from 'core-js-pure/es/string/match-all'; QUnit.test('String#matchAll', assert => { assert.isFunction(matchAll); let data = ['aabc', { toString() { return 'aabc'; } }]; for (const target of data) { const iterator = matchAll(target, /[ac]/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 0, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['c'], { input: 'aabc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); } let iterator = matchAll('1111a2b3cccc', /(\d)(\D)/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'RegExp String Iterator'); assert.same(String(iterator), '[object RegExp String Iterator]'); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.throws(() => matchAll('1111a2b3cccc', /(\d)(\D)/), TypeError); iterator = matchAll('1111a2b3cccc', '(\\d)(\\D)'); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* IE8- issue iterator = matchAll('abc', /\B/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 2, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); */ data = [null, undefined, NaN, 42, {}, []]; for (const target of data) { assert.notThrows(() => matchAll('', target), `Not throws on ${ target } as the first argument`); } assert.throws(() => matchAll(Symbol('matchAll test'), /./), 'throws on symbol context'); if (STRICT) { assert.throws(() => matchAll(null, /./g), TypeError, 'Throws on null as `this`'); assert.throws(() => matchAll(undefined, /./g), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.33.2/tests/unit-pure/es.string.pad-end.js000066400000000000000000000015101451776221300220240ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import padEnd from 'core-js-pure/es/string/pad-end'; QUnit.test('String#padEnd', assert => { assert.isFunction(padEnd); assert.same(padEnd('abc', 5), 'abc '); assert.same(padEnd('abc', 4, 'de'), 'abcd'); assert.same(padEnd('abc'), 'abc'); assert.same(padEnd('abc', 5, '_'), 'abc__'); assert.same(padEnd('', 0), ''); assert.same(padEnd('foo', 1), 'foo'); assert.same(padEnd('foo', 5, ''), 'foo'); const symbol = Symbol('padEnd test'); assert.throws(() => padEnd(symbol, 10, 'a'), 'throws on symbol context'); assert.throws(() => padEnd('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padEnd(null, 0), TypeError); assert.throws(() => padEnd(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.pad-start.js000066400000000000000000000015461451776221300224240ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import padStart from 'core-js-pure/es/string/pad-start'; QUnit.test('String#padStart', assert => { assert.isFunction(padStart); assert.same(padStart('abc', 5), ' abc'); assert.same(padStart('abc', 4, 'de'), 'dabc'); assert.same(padStart('abc'), 'abc'); assert.same(padStart('abc', 5, '_'), '__abc'); assert.same(padStart('', 0), ''); assert.same(padStart('foo', 1), 'foo'); assert.same(padStart('foo', 5, ''), 'foo'); const symbol = Symbol('padEnd test'); assert.throws(() => padStart(symbol, 10, 'a'), 'throws on symbol context'); assert.throws(() => padStart('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padStart(null, 0), TypeError); assert.throws(() => padStart(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.raw.js000066400000000000000000000015511451776221300213120ustar00rootroot00000000000000import raw from 'core-js-pure/es/string/raw'; QUnit.test('String.raw', assert => { assert.isFunction(raw); assert.arity(raw, 1); if ('name' in raw) { assert.name(raw, 'raw'); } assert.same(raw({ raw: ['Hi\\n', '!'] }, 'Bob'), 'Hi\\nBob!', 'raw is array'); assert.same(raw({ raw: 'test' }, 0, 1, 2), 't0e1s2t', 'raw is string'); assert.same(raw({ raw: 'test' }, 0), 't0est', 'lacks substituting'); assert.same(raw({ raw: [] }), '', 'empty template'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { const symbol = Symbol('raw test'); assert.throws(() => raw({ raw: [symbol] }, 0), TypeError, 'throws on symbol #1'); assert.throws(() => raw({ raw: 'test' }, symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => raw({}), TypeError); assert.throws(() => raw({ raw: null }), TypeError); }); core-js-3.33.2/tests/unit-pure/es.string.repeat.js000066400000000000000000000012541451776221300220010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import repeat from 'core-js-pure/es/string/repeat'; QUnit.test('String#repeat', assert => { assert.isFunction(repeat); assert.same(repeat('qwe', 3), 'qweqweqwe'); assert.same(repeat('qwe', 2.5), 'qweqwe'); assert.throws(() => repeat('qwe', -1), RangeError); assert.throws(() => repeat('qwe', Infinity), RangeError); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => repeat(Symbol('repeat test')), 'throws on symbol context'); } if (STRICT) { assert.throws(() => repeat(null, 1), TypeError); assert.throws(() => repeat(undefined, 1), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.replace-all.js000066400000000000000000000041561451776221300227060ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import replaceAll from 'core-js-pure/es/string/replace-all'; QUnit.test('String#replaceAll', assert => { assert.isFunction(replaceAll); assert.same(replaceAll('q=query+string+parameters', '+', ' '), 'q=query string parameters'); assert.same(replaceAll('foo', 'o', {}), 'f[object Object][object Object]'); assert.same(replaceAll('[object Object]x[object Object]', {}, 'y'), 'yxy'); assert.same(replaceAll({}, 'bject', 'lolo'), '[ololo Ololo]'); assert.same(replaceAll('aba', 'b', (search, i, string) => { assert.same(search, 'b', '`search` is `b`'); assert.same(i, 1, '`i` is 1'); assert.same(string, 'aba', '`string` is `aba`'); return 'c'; }), 'aca'); const searcher = { [Symbol.replace](O, replaceValue) { assert.same(this, searcher, '`this` is `searcher`'); assert.same(String(O), 'aba', '`O` is `aba`'); assert.same(String(replaceValue), 'c', '`replaceValue` is `c`'); return 'foo'; }, }; assert.same(replaceAll('aba', searcher, 'c'), 'foo'); assert.same(replaceAll('aba', 'b'), 'aundefineda'); assert.same(replaceAll('xxx', '', '_'), '_x_x_x_'); assert.same(replaceAll('121314', '1', '$$'), '$2$3$4', '$$'); assert.same(replaceAll('121314', '1', '$&'), '121314', '$&'); assert.same(replaceAll('121314', '1', '$`'), '212312134', '$`'); assert.same(replaceAll('121314', '1', "$'"), '213142314344', "$'"); const symbol = Symbol('replaceAll test'); assert.throws(() => replaceAll(symbol, 'a', 'b'), 'throws on symbol context'); assert.throws(() => replaceAll('a', symbol, 'b'), 'throws on symbol argument 1'); assert.throws(() => replaceAll('a', 'b', symbol), 'throws on symbol argument 2'); if (STRICT) { assert.throws(() => replaceAll(null, 'a', 'b'), TypeError); assert.throws(() => replaceAll(undefined, 'a', 'b'), TypeError); } assert.throws(() => replaceAll('b.b.b.b.b', /\./, 'a'), TypeError); assert.same(replaceAll('b.b.b.b.b', /\./g, 'a'), 'babababab'); const object = {}; assert.same(replaceAll('[object Object]', object, 'a'), 'a'); }); core-js-3.33.2/tests/unit-pure/es.string.small.js000066400000000000000000000005371451776221300216340ustar00rootroot00000000000000import small from 'core-js-pure/es/string/small'; QUnit.test('String#small', assert => { assert.isFunction(small); assert.same(small('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => small(Symbol('small test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.starts-with.js000066400000000000000000000027151451776221300230150ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import startsWith from 'core-js-pure/es/string/starts-with'; QUnit.test('String#startsWith', assert => { assert.isFunction(startsWith); assert.true(startsWith('undefined')); assert.false(startsWith('undefined', null)); assert.true(startsWith('abc', '')); assert.true(startsWith('abc', 'a')); assert.true(startsWith('abc', 'ab')); assert.false(startsWith('abc', 'bc')); assert.true(startsWith('abc', '', NaN)); assert.true(startsWith('abc', 'a', -1)); assert.false(startsWith('abc', 'a', 1)); assert.false(startsWith('abc', 'a', Infinity)); assert.true(startsWith('abc', 'b', true)); assert.true(startsWith('abc', 'a', 'x')); if (!Symbol.sham) { const symbol = Symbol('startsWith test'); assert.throws(() => startsWith(symbol, 'b'), 'throws on symbol context'); assert.throws(() => startsWith('a', symbol), 'throws on symbol argument'); } if (STRICT) { assert.throws(() => startsWith(null, '.'), TypeError); assert.throws(() => startsWith(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => startsWith('/./', regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => startsWith('/./', regexp)); const object = {}; assert.notThrows(() => startsWith('[object Object]', object)); object[Symbol.match] = true; assert.throws(() => startsWith('[object Object]', object), TypeError); }); core-js-3.33.2/tests/unit-pure/es.string.strike.js000066400000000000000000000005501451776221300220200ustar00rootroot00000000000000import strike from 'core-js-pure/es/string/strike'; QUnit.test('String#strike', assert => { assert.isFunction(strike); assert.same(strike('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => strike(Symbol('strike test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.sub.js000066400000000000000000000005151451776221300213110ustar00rootroot00000000000000import sub from 'core-js-pure/es/string/sub'; QUnit.test('String#sub', assert => { assert.isFunction(sub); assert.same(sub('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => sub(Symbol('sub test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.substr.js000066400000000000000000000011741451776221300220440ustar00rootroot00000000000000import substr from 'core-js-pure/es/string/substr'; import { STRICT } from '../helpers/constants.js'; QUnit.test('String#substr', assert => { assert.isFunction(substr); assert.same(substr('12345', 1, 3), '234'); assert.same(substr('ab', -1), 'b'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => substr(Symbol('substr test'), 1, 3), 'throws on symbol context'); } if (STRICT) { assert.throws(() => substr(null, 1, 3), TypeError, 'Throws on null as `this`'); assert.throws(() => substr(undefined, 1, 3), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.33.2/tests/unit-pure/es.string.sup.js000066400000000000000000000005151451776221300213270ustar00rootroot00000000000000import sup from 'core-js-pure/es/string/sup'; QUnit.test('String#sup', assert => { assert.isFunction(sup); assert.same(sup('a'), 'a', 'lower case'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => sup(Symbol('sup test')), 'throws on symbol context'); } }); core-js-3.33.2/tests/unit-pure/es.string.to-well-formed.js000066400000000000000000000030751451776221300233610ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import toWellFormed from 'core-js-pure/es/string/virtual/to-well-formed'; QUnit.test('String#toWellFormed', assert => { assert.isFunction(toWellFormed); assert.same(toWellFormed.call('a'), 'a', 'a'); assert.same(toWellFormed.call('abc'), 'abc', 'abc'); assert.same(toWellFormed.call('💩'), '💩', '💩'); assert.same(toWellFormed.call('💩b'), '💩b', '💩b'); assert.same(toWellFormed.call('a💩'), 'a💩', '💩'); assert.same(toWellFormed.call('a💩b'), 'a💩b', 'a💩b'); assert.same(toWellFormed.call('💩a💩'), '💩a💩'); assert.same(toWellFormed.call('\uD83D'), '\uFFFD', '\uD83D'); assert.same(toWellFormed.call('\uDCA9'), '\uFFFD', '\uDCA9'); assert.same(toWellFormed.call('\uDCA9\uD83D'), '\uFFFD\uFFFD', '\uDCA9\uD83D'); assert.same(toWellFormed.call('a\uD83D'), 'a\uFFFD', 'a\uFFFD'); assert.same(toWellFormed.call('\uDCA9a'), '\uFFFDa', '\uDCA9a'); assert.same(toWellFormed.call('a\uD83Da'), 'a\uFFFDa', 'a\uD83Da'); assert.same(toWellFormed.call('a\uDCA9a'), 'a\uFFFDa', 'a\uDCA9a'); assert.same(toWellFormed.call({ toString() { return 'abc'; }, }), 'abc', 'conversion #1'); assert.same(toWellFormed.call(1), '1', 'conversion #2'); if (STRICT) { assert.throws(() => toWellFormed.call(null), TypeError, 'coercible #1'); assert.throws(() => toWellFormed.call(undefined), TypeError, 'coercible #2'); } assert.throws(() => toWellFormed.call(Symbol('toWellFormed test')), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-pure/es.string.trim-end.js000066400000000000000000000013201451776221300222320ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import trimEnd from 'core-js-pure/es/string/trim-end'; QUnit.test('String#trimEnd', assert => { assert.isFunction(trimEnd); assert.same(trimEnd(' \n q w e \n '), ' \n q w e', 'removes whitespaces at right side of string'); assert.same(trimEnd(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimEnd('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimEnd(Symbol('trimEnd test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimEnd(null, 0), TypeError); assert.throws(() => trimEnd(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.trim-left.js000066400000000000000000000013321451776221300224210ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import trimLeft from 'core-js-pure/es/string/trim-left'; QUnit.test('String#trimLeft', assert => { assert.isFunction(trimLeft); assert.same(trimLeft(' \n q w e \n '), 'q w e \n ', 'removes whitespaces at left side of string'); assert.same(trimLeft(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimLeft('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimLeft(Symbol('trimLeft test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimLeft(null, 0), TypeError); assert.throws(() => trimLeft(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.trim-right.js000066400000000000000000000013461451776221300226110ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import trimRight from 'core-js-pure/es/string/trim-right'; QUnit.test('String#trimRight', assert => { assert.isFunction(trimRight); assert.same(trimRight(' \n q w e \n '), ' \n q w e', 'removes whitespaces at right side of string'); assert.same(trimRight(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimRight('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimRight(Symbol('trimRight test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimRight(null, 0), TypeError); assert.throws(() => trimRight(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.trim-start.js000066400000000000000000000013451451776221300226300ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import trimStart from 'core-js-pure/es/string/trim-start'; QUnit.test('String#trimStart', assert => { assert.isFunction(trimStart); assert.same(trimStart(' \n q w e \n '), 'q w e \n ', 'removes whitespaces at left side of string'); assert.same(trimStart(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimStart('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); assert.throws(() => trimStart(Symbol('trimStart test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimStart(null, 0), TypeError); assert.throws(() => trimStart(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.string.trim.js000066400000000000000000000013321451776221300214710ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants.js'; import trim from 'core-js-pure/es/string/trim'; QUnit.test('String#trim', assert => { assert.isFunction(trim); assert.same(trim(' \n q w e \n '), 'q w e', 'removes whitespaces at left & right side of string'); assert.same(trim(WHITESPACES), '', 'removes all whitespaces'); assert.same(trim('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => trim(Symbol('trim test')), 'throws on symbol context'); } if (STRICT) { assert.throws(() => trim(null, 0), TypeError); assert.throws(() => trim(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/es.symbol.async-iterator.js000066400000000000000000000004161451776221300234630ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Symbol.asyncIterator', assert => { assert.true('asyncIterator' in Symbol, 'Symbol.asyncIterator available'); assert.true(Object(Symbol.asyncIterator) instanceof Symbol, 'Symbol.asyncIterator is symbol'); }); core-js-3.33.2/tests/unit-pure/es.symbol.constructor.js000066400000000000000000000173441451776221300231140ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL } from '../helpers/constants.js'; import create from 'core-js-pure/es/object/create'; import defineProperty from 'core-js-pure/es/object/define-property'; import defineProperties from 'core-js-pure/es/object/define-properties'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import keys from 'core-js-pure/es/object/keys'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; import Map from 'core-js-pure/es/map'; import Set from 'core-js-pure/es/set'; import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Symbol', assert => { assert.isFunction(Symbol); const symbol1 = Symbol('symbol'); const symbol2 = Symbol('symbol'); assert.notSame(symbol1, symbol2, 'Symbol("symbol") !== Symbol("symbol")'); const object = {}; object[symbol1] = 42; assert.same(object[symbol1], 42, 'Symbol() work as key'); assert.notSame(object[symbol2], 42, 'Various symbols from one description are various keys'); // assert.throws(() => Symbol(Symbol('foo')), 'throws on symbol argument'); if (DESCRIPTORS) { let count = 0; // eslint-disable-next-line no-unused-vars -- required for testing for (const key in object) count++; assert.same(count, 0, 'object[Symbol()] is not enumerable'); } }); QUnit.test('Symbol as global key', assert => { const TEXT = 'test global symbol key'; const symbol = Symbol(TEXT); GLOBAL[symbol] = TEXT; assert.same(GLOBAL[symbol], TEXT, TEXT); }); QUnit.test('Well-known Symbols', assert => { const wks = [ 'hasInstance', 'isConcatSpreadable', 'iterator', 'match', 'matchAll', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables', ]; for (const name of wks) { assert.true(name in Symbol, `Symbol.${ name } available`); assert.true(Object(Symbol[name]) instanceof Symbol, `Symbol.${ name } is symbol`); } }); QUnit.test('Symbol#@@toPrimitive', assert => { const symbol = Symbol('Symbol#@@toPrimitive test'); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); QUnit.test('Symbol#@@toStringTag', assert => { assert.same(Symbol.prototype[Symbol.toStringTag], 'Symbol', 'Symbol::@@toStringTag is `Symbol`'); }); if (DESCRIPTORS) { QUnit.test('Symbols & descriptors', assert => { const d = Symbol('d'); const e = Symbol('e'); const f = Symbol('f'); const i = Symbol('i'); const j = Symbol('j'); const prototype = { g: 'g' }; prototype[i] = 'i'; defineProperty(prototype, 'h', { value: 'h', }); defineProperty(prototype, 'j', { value: 'j', }); const object = create(prototype); object.a = 'a'; object[d] = 'd'; defineProperty(object, 'b', { value: 'b', }); defineProperty(object, 'c', { value: 'c', enumerable: true, }); defineProperty(object, e, { configurable: true, writable: true, value: 'e', }); const descriptor = { value: 'f', enumerable: true, }; defineProperty(object, f, descriptor); assert.true(descriptor.enumerable, 'defineProperty not changes descriptor object'); assert.deepEqual(getOwnPropertyDescriptor(object, 'a'), { configurable: true, writable: true, enumerable: true, value: 'a', }, 'getOwnPropertyDescriptor a'); assert.deepEqual(getOwnPropertyDescriptor(object, 'b'), { configurable: false, writable: false, enumerable: false, value: 'b', }, 'getOwnPropertyDescriptor b'); assert.deepEqual(getOwnPropertyDescriptor(object, 'c'), { configurable: false, writable: false, enumerable: true, value: 'c', }, 'getOwnPropertyDescriptor c'); assert.deepEqual(getOwnPropertyDescriptor(object, d), { configurable: true, writable: true, enumerable: true, value: 'd', }, 'getOwnPropertyDescriptor d'); assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: false, value: 'e', }, 'getOwnPropertyDescriptor e'); assert.deepEqual(getOwnPropertyDescriptor(object, f), { configurable: false, writable: false, enumerable: true, value: 'f', }, 'getOwnPropertyDescriptor f'); assert.same(getOwnPropertyDescriptor(object, 'g'), undefined, 'getOwnPropertyDescriptor g'); assert.same(getOwnPropertyDescriptor(object, 'h'), undefined, 'getOwnPropertyDescriptor h'); assert.same(getOwnPropertyDescriptor(object, i), undefined, 'getOwnPropertyDescriptor i'); assert.same(getOwnPropertyDescriptor(object, j), undefined, 'getOwnPropertyDescriptor j'); assert.same(getOwnPropertyDescriptor(object, 'k'), undefined, 'getOwnPropertyDescriptor k'); assert.false(getOwnPropertyDescriptor(Object.prototype, 'toString').enumerable, 'getOwnPropertyDescriptor on Object.prototype'); assert.same(getOwnPropertyDescriptor(Object.prototype, d), undefined, 'getOwnPropertyDescriptor on Object.prototype missed symbol'); assert.same(keys(object).length, 2, 'Object.keys'); assert.same(getOwnPropertyNames(object).length, 3, 'Object.getOwnPropertyNames'); assert.same(getOwnPropertySymbols(object).length, 3, 'Object.getOwnPropertySymbols'); assert.same(ownKeys(object).length, 6, 'Reflect.ownKeys'); delete object[e]; object[e] = 'e'; assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: true, value: 'e', }, 'redefined non-enum key'); }); QUnit.test('Symbols & Object.defineProperties', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = defineProperties({}, descriptors); assert.same(object.a, 'a', 'a'); assert.same(object.b, undefined, 'b'); assert.same(object[c], 'c', 'c'); assert.same(object[d], undefined, 'd'); }); QUnit.test('Symbols & Object.create', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = create(null, descriptors); assert.same(object.a, 'a', 'a'); assert.same(object.b, undefined, 'b'); assert.same(object[c], 'c', 'c'); assert.same(object[d], undefined, 'd'); }); const constructors = { Map, Set, Promise }; for (const name in constructors) { QUnit.test(`${ name }@@species`, assert => { assert.same(constructors[name][Symbol.species], constructors[name], `${ name }@@species === ${ name }`); const Subclass = create(constructors[name]); assert.same(Subclass[Symbol.species], Subclass, `${ name } subclass`); }); } QUnit.test('Array@@species', assert => { assert.same(Array[Symbol.species], Array, 'Array@@species === Array'); const Subclass = create(Array); assert.same(Subclass[Symbol.species], Subclass, 'Array subclass'); }); QUnit.test('Symbol.sham flag', assert => { assert.same(Symbol.sham, typeof Symbol('Symbol.sham flag test') == 'symbol' ? undefined : true); }); } core-js-3.33.2/tests/unit-pure/es.symbol.for.js000066400000000000000000000006051451776221300213050ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Symbol.for', assert => { assert.isFunction(Symbol.for, 'Symbol.for is function'); const symbol = Symbol.for('foo'); assert.strictEqual(Symbol.for('foo'), symbol, 'registry'); assert.true(Object(symbol) instanceof Symbol, 'returns symbol'); assert.throws(() => Symbol.for(Symbol('foo')), 'throws on symbol argument'); }); core-js-3.33.2/tests/unit-pure/es.symbol.key-for.js000066400000000000000000000005361451776221300220760ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Symbol.keyFor', assert => { assert.isFunction(Symbol.keyFor, 'Symbol.keyFor is function'); assert.strictEqual(Symbol.keyFor(Symbol.for('foo')), 'foo'); assert.strictEqual(Symbol.keyFor(Symbol('foo')), undefined); assert.throws(() => Symbol.keyFor('foo'), 'throws on non-symbol'); }); core-js-3.33.2/tests/unit-pure/es.unescape.js000066400000000000000000000010001451776221300210040ustar00rootroot00000000000000import unescape from 'core-js-pure/es/unescape'; QUnit.test('unescape', assert => { assert.isFunction(unescape); assert.arity(unescape, 1); assert.same(unescape('%21q2%u0444'), '!q2ф'); assert.same(unescape('%u044q2%21'), '%u044q2!'); assert.same(unescape(null), 'null'); assert.same(unescape(undefined), 'undefined'); /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { assert.throws(() => unescape(Symbol('unescape test')), 'throws on symbol argument'); } }); core-js-3.33.2/tests/unit-pure/es.weak-map.js000066400000000000000000000153661451776221300207270ustar00rootroot00000000000000import { createIterable, nativeSubclass } from '../helpers/helpers.js'; import { DESCRIPTORS, FREEZING } from '../helpers/constants.js'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import freeze from 'core-js-pure/es/object/freeze'; import isFrozen from 'core-js-pure/es/object/is-frozen'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import keys from 'core-js-pure/es/object/keys'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; import Symbol from 'core-js-pure/es/symbol'; import WeakMap from 'core-js-pure/es/weak-map'; QUnit.test('WeakMap', assert => { assert.isFunction(WeakMap); assert.true('delete' in WeakMap.prototype, 'delete in WeakMap.prototype'); assert.true('get' in WeakMap.prototype, 'get in WeakMap.prototype'); assert.true('has' in WeakMap.prototype, 'has in WeakMap.prototype'); assert.true('set' in WeakMap.prototype, 'set in WeakMap.prototype'); assert.true(new WeakMap() instanceof WeakMap, 'new WeakMap instanceof WeakMap'); let object = {}; assert.same(new WeakMap(createIterable([[object, 42]])).get(object), 42, 'Init from iterable'); let weakmap = new WeakMap(); const frozen = freeze({}); weakmap.set(frozen, 42); assert.same(weakmap.get(frozen), 42, 'Support frozen objects'); weakmap = new WeakMap(); weakmap.set(frozen, 42); assert.true(weakmap.has(frozen), 'works with frozen objects, #1'); assert.same(weakmap.get(frozen), 42, 'works with frozen objects, #2'); weakmap.delete(frozen); assert.false(weakmap.has(frozen), 'works with frozen objects, #3'); assert.same(weakmap.get(frozen), undefined, 'works with frozen objects, #4'); let done = false; try { new WeakMap(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); assert.false(('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new WeakMap(array); assert.true(done); object = {}; new WeakMap().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakMap); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof WeakMap, 'correct subclassing with native classes #2'); object = {}; assert.same(new Subclass().set(object, 2).get(object), 2, 'correct subclassing with native classes #3'); } if (typeof ArrayBuffer == 'function') { const buffer = new ArrayBuffer(8); const map = new WeakMap([[buffer, 8]]); assert.true(map.has(buffer), 'works with ArrayBuffer keys'); } }); QUnit.test('WeakMap#delete', assert => { assert.isFunction(WeakMap.prototype.delete); const a = {}; const b = {}; const weakmap = new WeakMap(); weakmap.set(a, 42); weakmap.set(b, 21); assert.true(weakmap.has(a), 'WeakMap has values before .delete() #1'); assert.true(weakmap.has(b), 'WeakMap has values before .delete() #2'); weakmap.delete(a); assert.false(weakmap.has(a), 'WeakMap has not value after .delete() #1'); assert.true(weakmap.has(b), 'WeakMap has not value after .delete() #2'); assert.notThrows(() => !weakmap.delete(1), 'return false on primitive'); const object = {}; weakmap.set(object, 42); freeze(object); assert.true(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.false(weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#get', assert => { assert.isFunction(WeakMap.prototype.get); const weakmap = new WeakMap(); assert.same(weakmap.get({}), undefined, 'WeakMap .get() before .set() return undefined'); let object = {}; weakmap.set(object, 42); assert.same(weakmap.get(object), 42, 'WeakMap .get() return value'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'WeakMap .get() after .delete() return undefined'); assert.notThrows(() => weakmap.get(1) === undefined, 'return undefined on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.same(weakmap.get(object), 42, 'works with frozen objects #1'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'works with frozen objects #2'); }); QUnit.test('WeakMap#has', assert => { assert.isFunction(WeakMap.prototype.has); const weakmap = new WeakMap(); assert.false(weakmap.has({}), 'WeakMap .has() before .set() return false'); let object = {}; weakmap.set(object, 42); assert.true(weakmap.has(object), 'WeakMap .has() return true'); weakmap.delete(object); assert.false(weakmap.has(object), 'WeakMap .has() after .delete() return false'); assert.notThrows(() => !weakmap.has(1), 'return false on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.true(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.false(weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#set', assert => { assert.isFunction(WeakMap.prototype.set); const weakmap = new WeakMap(); const object = {}; weakmap.set(object, 33); assert.same(weakmap.get(object), 33, 'works with object as keys'); assert.same(weakmap.set({}, 42), weakmap, 'chaining'); assert.throws(() => new WeakMap().set(42, 42), 'throws with primitive keys'); const object1 = freeze({}); const object2 = {}; weakmap.set(object1, 42); weakmap.set(object2, 42); freeze(object); assert.same(weakmap.get(object1), 42, 'works with frozen objects #1'); assert.same(weakmap.get(object2), 42, 'works with frozen objects #2'); weakmap.delete(object1); weakmap.delete(object2); assert.same(weakmap.get(object1), undefined, 'works with frozen objects #3'); assert.same(weakmap.get(object2), undefined, 'works with frozen objects #4'); const array = freeze([]); weakmap.set(array, 42); assert.same(weakmap.get(array), 42, 'works with frozen arrays #1'); if (FREEZING) assert.true(isFrozen(array), 'works with frozen arrays #2'); }); QUnit.test('WeakMap#@@toStringTag', assert => { assert.same(WeakMap.prototype[Symbol.toStringTag], 'WeakMap', 'WeakMap::@@toStringTag is `WeakMap`'); assert.same(String(new WeakMap()), '[object WeakMap]', 'correct stringification'); }); core-js-3.33.2/tests/unit-pure/es.weak-set.js000066400000000000000000000104201451776221300207270ustar00rootroot00000000000000import { createIterable, nativeSubclass } from '../helpers/helpers.js'; import { DESCRIPTORS } from '../helpers/constants.js'; import getIteratorMethod from 'core-js-pure/es/get-iterator-method'; import freeze from 'core-js-pure/es/object/freeze'; import getOwnPropertyNames from 'core-js-pure/es/object/get-own-property-names'; import getOwnPropertySymbols from 'core-js-pure/es/object/get-own-property-symbols'; import keys from 'core-js-pure/es/object/keys'; import ownKeys from 'core-js-pure/es/reflect/own-keys'; import Symbol from 'core-js-pure/es/symbol'; import WeakSet from 'core-js-pure/es/weak-set'; QUnit.test('WeakSet', assert => { assert.isFunction(WeakSet); assert.true('add' in WeakSet.prototype, 'add in WeakSet.prototype'); assert.true('delete' in WeakSet.prototype, 'delete in WeakSet.prototype'); assert.true('has' in WeakSet.prototype, 'has in WeakSet.prototype'); assert.true(new WeakSet() instanceof WeakSet, 'new WeakSet instanceof WeakSet'); let object = {}; assert.true(new WeakSet(createIterable([object])).has(object), 'Init from iterable'); const weakset = new WeakSet(); const frozen = freeze({}); weakset.add(frozen); assert.true(weakset.has(frozen), 'works with frozen objects, #1'); weakset.delete(frozen); assert.false(weakset.has(frozen), 'works with frozen objects, #2'); let done = false; try { new WeakSet(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.true(done, '.return #throw'); assert.false(('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new WeakSet(array); assert.true(done); object = {}; new WeakSet().add(object); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakSet); assert.true(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.true(new Subclass() instanceof WeakSet, 'correct subclassing with native classes #2'); object = {}; assert.true(new Subclass().add(object).has(object), 'correct subclassing with native classes #3'); } if (typeof ArrayBuffer == 'function') { const buffer = new ArrayBuffer(8); const set = new WeakSet([buffer]); assert.true(set.has(buffer), 'works with ArrayBuffer keys'); } }); QUnit.test('WeakSet#add', assert => { assert.isFunction(WeakSet.prototype.add); const weakset = new WeakSet(); assert.same(weakset.add({}), weakset, 'chaining'); assert.throws(() => new WeakSet().add(42), 'throws with primitive keys'); }); QUnit.test('WeakSet#delete', assert => { assert.isFunction(WeakSet.prototype.delete); const a = {}; const b = {}; const weakset = new WeakSet().add(a).add(b); assert.true(weakset.has(a), 'WeakSet has values before .delete() #1'); assert.true(weakset.has(b), 'WeakSet has values before .delete() #2'); weakset.delete(a); assert.false(weakset.has(a), 'WeakSet has not value after .delete() #1'); assert.true(weakset.has(b), 'WeakSet has not value after .delete() #2'); assert.notThrows(() => !weakset.delete(1), 'return false on primitive'); }); QUnit.test('WeakSet#has', assert => { assert.isFunction(WeakSet.prototype.has); const weakset = new WeakSet(); assert.false(weakset.has({}), 'WeakSet has`nt value'); const object = {}; weakset.add(object); assert.true(weakset.has(object), 'WeakSet has value after .add()'); weakset.delete(object); assert.false(weakset.has(object), 'WeakSet has not value after .delete()'); assert.notThrows(() => !weakset.has(1), 'return false on primitive'); }); QUnit.test('WeakSet::@@toStringTag', assert => { assert.same(WeakSet.prototype[Symbol.toStringTag], 'WeakSet', 'WeakSet::@@toStringTag is `WeakSet`'); assert.same(String(new WeakSet()), '[object WeakSet]', 'correct stringification'); }); core-js-3.33.2/tests/unit-pure/esnext.array.filter-out.js000066400000000000000000000022561451776221300233250ustar00rootroot00000000000000// TODO: Remove from `core-js@4` import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import filterOut from 'core-js-pure/full/array/filter-out'; QUnit.test('Array#filterOut', assert => { assert.isFunction(filterOut); let array = [1]; const context = {}; filterOut(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], filterOut([1, 2, 3, 'q', {}, 4, true, 5], it => typeof it != 'number')); if (STRICT) { assert.throws(() => filterOut(null, () => { /* empty */ }), TypeError); assert.throws(() => filterOut(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(filterOut(array, Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.filter-reject.js000066400000000000000000000022501451776221300237640ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import filterReject from 'core-js-pure/full/array/filter-reject'; QUnit.test('Array#filterReject', assert => { assert.isFunction(filterReject); let array = [1]; const context = {}; filterReject(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], filterReject([1, 2, 3, 'q', {}, 4, true, 5], it => typeof it != 'number')); if (STRICT) { assert.throws(() => filterReject(null, () => { /* empty */ }), TypeError); assert.throws(() => filterReject(undefined, () => { /* empty */ }), TypeError); } array = []; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(filterReject(array, Boolean).foo, 1, '@@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.from-async.js000066400000000000000000000055131451776221300233100ustar00rootroot00000000000000import { createAsyncIterable, createIterable } from '../helpers/helpers.js'; import { STRICT_THIS } from '../helpers/constants.js'; import Promise from 'core-js-pure/es/promise'; import fromAsync from 'core-js-pure/actual/array/from-async'; QUnit.test('Array.fromAsync', assert => { assert.isFunction(fromAsync); assert.arity(fromAsync, 1); assert.name(fromAsync, 'fromAsync'); function C() { /* empty */ } return fromAsync(createAsyncIterable([1, 2, 3]), it => it ** 2).then(it => { assert.arrayEqual(it, [1, 4, 9], 'async iterable and mapfn'); return fromAsync(createAsyncIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return fromAsync(createAsyncIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'async iterable without mapfn'); return fromAsync(createIterable([1, 2, 3]), arg => arg ** 2); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and mapfn'); return fromAsync(createIterable([1, 2, 3]), arg => Promise.resolve(arg ** 2)); }).then(it => { assert.arrayEqual(it, [1, 4, 9], 'iterable and async mapfn'); return fromAsync(createIterable([1]), function (arg, index) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(index, 0, 'index'); }); }).then(() => { return fromAsync(createIterable([1, 2, 3])); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'iterable and without mapfn'); return fromAsync([1, Promise.resolve(2), 3]); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'array'); return fromAsync('123'); }).then(it => { assert.arrayEqual(it, ['1', '2', '3'], 'string'); return fromAsync.call(C, [1]); }).then(it => { assert.true(it instanceof C, 'subclassable'); return fromAsync({ length: 1, 0: 1 }); }).then(it => { assert.arrayEqual(it, [1], 'non-iterable'); return fromAsync(createIterable([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); return fromAsync(undefined, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync(null, () => { /* empty */ }); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync([1], null); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); return fromAsync([1], {}); }).then(() => { assert.avoid(); }, error => { assert.true(error instanceof TypeError); }); }); core-js-3.33.2/tests/unit-pure/esnext.array.group-by-to-map.js000066400000000000000000000033271451776221300241720ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Map from 'core-js-pure/es/map'; import Symbol from 'core-js-pure/es/symbol'; import from from 'core-js-pure/es/array/from'; import groupByToMap from 'core-js-pure/actual/array/group-by-to-map'; QUnit.test('Array#groupByToMap', assert => { assert.isFunction(groupByToMap); let array = [1]; const context = {}; groupByToMap(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(groupByToMap([], it => it) instanceof Map, 'returns Map'); assert.deepEqual(from(groupByToMap([1, 2, 3], it => it % 2)), [[1, [1, 3]], [0, [2]]], '#1'); assert.deepEqual( from(groupByToMap([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], it => `i${ it % 5 }`)), [['i1', [1, 6, 11]], ['i2', [2, 7, 12]], ['i3', [3, 8]], ['i4', [4, 9]], ['i0', [5, 10]]], '#2', ); assert.deepEqual(from(groupByToMap(Array(3), it => it)), [[undefined, [undefined, undefined, undefined]]], '#3'); if (STRICT) { assert.throws(() => groupByToMap(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupByToMap(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(groupByToMap(array, Boolean).get(true).foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.group-by.js000066400000000000000000000031441451776221300227740ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import groupBy from 'core-js-pure/actual/array/group-by'; QUnit.test('Array#groupBy', assert => { assert.isFunction(groupBy); let array = [1]; const context = {}; groupBy(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(getPrototypeOf(groupBy([], it => it)), null, 'null proto'); assert.deepEqual(groupBy([1, 2, 3], it => it % 2), { 1: [1, 3], 0: [2] }, '#1'); assert.deepEqual( groupBy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], it => `i${ it % 5 }`), { i1: [1, 6, 11], i2: [2, 7, 12], i3: [3, 8], i4: [4, 9], i0: [5, 10] }, '#2', ); assert.deepEqual(groupBy(Array(3), it => it), { undefined: [undefined, undefined, undefined] }, '#3'); if (STRICT) { assert.throws(() => groupBy(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupBy(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(groupBy(array, Boolean).true.foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.group-to-map.js000066400000000000000000000032761451776221300235650ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Map from 'core-js-pure/es/map'; import Symbol from 'core-js-pure/es/symbol'; import from from 'core-js-pure/es/array/from'; import groupToMap from 'core-js-pure/actual/array/group-to-map'; QUnit.test('Array#groupToMap', assert => { assert.isFunction(groupToMap); let array = [1]; const context = {}; groupToMap(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(groupToMap([], it => it) instanceof Map, 'returns Map'); assert.deepEqual(from(groupToMap([1, 2, 3], it => it % 2)), [[1, [1, 3]], [0, [2]]], '#1'); assert.deepEqual( from(groupToMap([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], it => `i${ it % 5 }`)), [['i1', [1, 6, 11]], ['i2', [2, 7, 12]], ['i3', [3, 8]], ['i4', [4, 9]], ['i0', [5, 10]]], '#2', ); assert.deepEqual(from(groupToMap(Array(3), it => it)), [[undefined, [undefined, undefined, undefined]]], '#3'); if (STRICT) { assert.throws(() => groupToMap(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => groupToMap(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(groupToMap(array, Boolean).get(true).foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.group.js000066400000000000000000000031131451776221300223600ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import group from 'core-js-pure/actual/array/group'; QUnit.test('Array#group', assert => { assert.isFunction(group); let array = [1]; const context = {}; group(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(getPrototypeOf(group([], it => it)), null, 'null proto'); assert.deepEqual(group([1, 2, 3], it => it % 2), { 1: [1, 3], 0: [2] }, '#1'); assert.deepEqual( group([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], it => `i${ it % 5 }`), { i1: [1, 6, 11], i2: [2, 7, 12], i3: [3, 8], i4: [4, 9], i0: [5, 10] }, '#2', ); assert.deepEqual(group(Array(3), it => it), { undefined: [undefined, undefined, undefined] }, '#3'); if (STRICT) { assert.throws(() => group(null, () => { /* empty */ }), TypeError, 'null this -> TypeError'); assert.throws(() => group(undefined, () => { /* empty */ }), TypeError, 'undefined this -> TypeError'); } array = [1]; // eslint-disable-next-line object-shorthand -- constructor array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; assert.same(group(array, Boolean).true.foo, undefined, 'no @@species'); }); core-js-3.33.2/tests/unit-pure/esnext.array.is-template-object.js000066400000000000000000000016511451776221300247210ustar00rootroot00000000000000import freeze from 'core-js-pure/es/object/freeze'; import isTemplateObject from 'core-js-pure/full/array/is-template-object'; QUnit.test('Array.isTemplateObject', assert => { assert.isFunction(isTemplateObject); assert.arity(isTemplateObject, 1); assert.name(isTemplateObject, 'isTemplateObject'); assert.false(isTemplateObject(undefined)); assert.false(isTemplateObject(null)); assert.false(isTemplateObject({})); assert.false(isTemplateObject(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.false(isTemplateObject([])); assert.false(isTemplateObject(freeze([]))); const template = (() => { try { // eslint-disable-next-line no-template-curly-in-string -- ignore return Function('return (it => it)`qwe${ 123 }asd`')(); } catch { /* empty */ } })(); if (template) assert.true(isTemplateObject(template)); }); core-js-3.33.2/tests/unit-pure/esnext.array.unique-by.js000066400000000000000000000020471451776221300231470ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import uniqueBy from 'core-js-pure/full/array/unique-by'; QUnit.test('Array#uniqueBy', assert => { assert.isFunction(uniqueBy); let array = [1, 2, 3, 2, 1]; assert.notSame(uniqueBy(array), array); assert.deepEqual(uniqueBy(array), [1, 2, 3]); array = [ { id: 1, uid: 10000, }, { id: 2, uid: 10000, }, { id: 3, uid: 10001, }, ]; assert.deepEqual(uniqueBy(array, it => it.uid), [ { id: 1, uid: 10000, }, { id: 3, uid: 10001, }, ]); assert.deepEqual(uniqueBy(array, ({ id, uid }) => `${ id }-${ uid }`), array); assert.deepEqual(uniqueBy([1, undefined, 2, undefined, null, 1]), [1, undefined, 2, null]); assert.deepEqual(uniqueBy([0, -0]), [0]); assert.deepEqual(uniqueBy([NaN, NaN]), [NaN]); assert.deepEqual(uniqueBy({ length: 1, 0: 1 }), [1]); if (STRICT) { assert.throws(() => uniqueBy(null), TypeError); assert.throws(() => uniqueBy(undefined), TypeError); } }); core-js-3.33.2/tests/unit-pure/esnext.async-disposable-stack.constructor.js000066400000000000000000000137061451776221300270470ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Promise from 'core-js-pure/es/promise'; import Symbol from 'core-js-pure/full/symbol'; import AsyncDisposableStack from 'core-js-pure/full/async-disposable-stack'; import SuppressedError from 'core-js-pure/full/suppressed-error'; QUnit.test('AsyncDisposableStack constructor', assert => { assert.isFunction(AsyncDisposableStack); assert.arity(AsyncDisposableStack, 0); assert.name(AsyncDisposableStack, 'AsyncDisposableStack'); assert.throws(() => AsyncDisposableStack(), 'throws w/o `new`'); assert.true(new AsyncDisposableStack() instanceof AsyncDisposableStack); assert.same(AsyncDisposableStack.prototype.constructor, AsyncDisposableStack); }); QUnit.test('AsyncDisposableStack#disposeAsync', assert => { assert.isFunction(AsyncDisposableStack.prototype.disposeAsync); assert.arity(AsyncDisposableStack.prototype.disposeAsync, 0); assert.name(AsyncDisposableStack.prototype.disposeAsync, 'disposeAsync'); assert.nonEnumerable(AsyncDisposableStack.prototype, 'disposeAsync'); }); QUnit.test('AsyncDisposableStack#use', assert => { assert.isFunction(AsyncDisposableStack.prototype.use); assert.arity(AsyncDisposableStack.prototype.use, 1); assert.name(AsyncDisposableStack.prototype.use, 'use'); assert.nonEnumerable(AsyncDisposableStack.prototype, 'use'); let result = ''; const stack = new AsyncDisposableStack(); const resource = { [Symbol.asyncDispose]() { result += '1'; assert.same(this, resource); assert.same(arguments.length, 0); }, }; assert.same(stack.use(resource), resource); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#adopt', assert => { assert.isFunction(AsyncDisposableStack.prototype.adopt); assert.arity(AsyncDisposableStack.prototype.adopt, 2); assert.name(AsyncDisposableStack.prototype.adopt, 'adopt'); assert.nonEnumerable(AsyncDisposableStack.prototype, 'adopt'); let result = ''; const stack = new AsyncDisposableStack(); const resource = {}; assert.same(stack.adopt(resource, function (arg) { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 1); assert.same(arg, resource); }), resource); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#defer', assert => { assert.isFunction(AsyncDisposableStack.prototype.defer); assert.arity(AsyncDisposableStack.prototype.defer, 1); assert.name(AsyncDisposableStack.prototype.defer, 'defer'); assert.nonEnumerable(AsyncDisposableStack.prototype, 'defer'); let result = ''; const stack = new AsyncDisposableStack(); assert.same(stack.defer(function () { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 0); }), undefined); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '1'); }); }); QUnit.test('AsyncDisposableStack#move', assert => { assert.isFunction(AsyncDisposableStack.prototype.move); assert.arity(AsyncDisposableStack.prototype.move, 0); assert.name(AsyncDisposableStack.prototype.move, 'move'); assert.nonEnumerable(AsyncDisposableStack.prototype, 'move'); let result = ''; const stack1 = new AsyncDisposableStack(); stack1.defer(() => result += '2'); stack1.defer(() => result += '1'); const stack2 = stack1.move(); assert.true(stack1.disposed); return stack2.disposeAsync().then(() => { assert.same(result, '12'); }); }); QUnit.test('AsyncDisposableStack#@@asyncDispose', assert => { assert.same(AsyncDisposableStack.prototype[Symbol.asyncDispose], AsyncDisposableStack.prototype.disposeAsync); }); QUnit.test('AsyncDisposableStack#@@toStringTag', assert => { assert.same(AsyncDisposableStack.prototype[Symbol.toStringTag], 'AsyncDisposableStack', '@@toStringTag'); }); QUnit.test('AsyncDisposableStack#1', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => result += '5'); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.resolve(result += '3') }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); assert.false(stack.disposed); return stack.disposeAsync().then(it => { assert.same(it, undefined); assert.same(result, '123456'); assert.true(stack.disposed); return stack.disposeAsync(); }).then(it => { assert.same(it, undefined); }); }); QUnit.test('AsyncDisposableStack#2', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => { throw new Error(5); }); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.resolve(result += '3') }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); return stack.disposeAsync().then(() => { assert.avoid(); }, error => { assert.same(result, '12346'); assert.true(error instanceof Error); assert.same(error.message, '5'); }); }); QUnit.test('AsyncDisposableStack#3', assert => { let result = ''; const stack = new AsyncDisposableStack(); stack.use({ [Symbol.asyncDispose]: () => result += '6' }); stack.adopt({}, () => { throw new Error(5); }); stack.defer(() => result += '4'); stack.use({ [Symbol.asyncDispose]: () => Promise.reject(Error(3)) }); stack.adopt({}, () => Promise.resolve(result += '2')); stack.defer(() => Promise.resolve(result += '1')); return stack.disposeAsync().then(() => { assert.avoid(); }, error => { assert.same(result, '1246'); assert.true(error instanceof SuppressedError); assert.same(error.error.message, '5'); assert.same(error.suppressed.message, '3'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.as-indexed-pairs.js000066400000000000000000000014171451776221300262140ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import AsyncIterator from 'core-js-pure/full/async-iterator'; QUnit.test('AsyncIterator#asIndexedPairs', assert => { const { asIndexedPairs } = AsyncIterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.nonEnumerable(AsyncIterator.prototype, 'asIndexedPairs'); if (STRICT) { assert.throws(() => asIndexedPairs.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call(null, () => { /* empty */ }), TypeError); } return asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.async-dispose.js000066400000000000000000000014771451776221300256460ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/full/async-iterator'; import Symbol from 'core-js-pure/full/symbol'; import create from 'core-js-pure/es/object/create'; QUnit.test('AsyncIterator#@@asyncDispose', assert => { const asyncDispose = AsyncIterator.prototype[Symbol.asyncDispose]; assert.isFunction(asyncDispose); assert.arity(asyncDispose, 0); return create(AsyncIterator.prototype)[Symbol.asyncDispose]().then(result => { assert.same(result, undefined); }).then(() => { let called = false; const iterator2 = create(AsyncIterator.prototype); iterator2.return = function () { called = true; assert.same(this, iterator2); return 7; }; return iterator2[Symbol.asyncDispose]().then(result => { assert.same(result, undefined); assert.true(called); }); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.constructor.js000066400000000000000000000021351451776221300254420ustar00rootroot00000000000000import { nativeSubclass } from '../helpers/helpers.js'; import Symbol from 'core-js-pure/es/symbol'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator', assert => { assert.isFunction(AsyncIterator); assert.arity(AsyncIterator, 0); assert.true(AsyncIterator.from([1, 2, 3]) instanceof AsyncIterator, 'Async From Proxy'); assert.true(AsyncIterator.from([1, 2, 3]).drop(1) instanceof AsyncIterator, 'Async Drop Proxy'); if (nativeSubclass) { const Sub = nativeSubclass(AsyncIterator); assert.true(new Sub() instanceof AsyncIterator, 'abstract constructor'); } assert.throws(() => new AsyncIterator(), 'direct constructor throws'); assert.throws(() => AsyncIterator(), 'throws w/o `new`'); }); QUnit.test('AsyncIterator#constructor', assert => { assert.same(AsyncIterator.prototype.constructor, AsyncIterator, 'AsyncIterator#constructor is AsyncIterator'); }); QUnit.test('AsyncIterator#@@toStringTag', assert => { assert.same(AsyncIterator.prototype[Symbol.toStringTag], 'AsyncIterator', 'AsyncIterator::@@toStringTag is `AsyncIterator`'); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.drop.js000066400000000000000000000022531451776221300240220ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#drop', assert => { const { drop } = AsyncIterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.nonEnumerable(AsyncIterator.prototype, 'drop'); if (STRICT) { assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); } assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => drop.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); return drop.call(createIterator([1, 2, 3]), 1).toArray().then(it => { assert.arrayEqual(it, [2, 3], 'basic functionality'); return drop.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [2, 3], 'float'); return drop.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [], 'big'); return drop.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'zero'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.every.js000066400000000000000000000030151451776221300242050ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#every', assert => { const { every } = AsyncIterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.nonEnumerable(AsyncIterator.prototype, 'every'); if (STRICT) { assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); return every.call(createIterator([1, 2, 3]), it => typeof it == 'number').then(result => { assert.true(result, 'basic functionality, +'); return every.call(createIterator([1, 2, 3]), it => it === 2); }).then(result => { assert.false(result, 'basic functionality, -'); return every.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return every.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.filter.js000066400000000000000000000026401451776221300243430ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#filter', assert => { const { filter } = AsyncIterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.nonEnumerable(AsyncIterator.prototype, 'filter'); if (STRICT) { assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); return filter.call(createIterator([1, 2, 3]), it => it % 2).toArray().then(it => { assert.arrayEqual(it, [1, 3], 'basic functionality'); return filter.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); }).then(() => { return filter.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.find.js000066400000000000000000000027751451776221300240070ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#find', assert => { const { find } = AsyncIterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(AsyncIterator.prototype, 'find'); if (STRICT) { assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); return find.call(createIterator([2, 3, 4]), it => it % 2).then(result => { assert.same(result, 3, 'basic functionality, +'); return find.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.same(result, undefined, 'basic functionality, -'); return find.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return find.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.flat-map.js000066400000000000000000000030341451776221300245550ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#flatMap', assert => { const { flatMap } = AsyncIterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.nonEnumerable(AsyncIterator.prototype, 'flatMap'); if (STRICT) { assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); return flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6]]), it => typeof it == 'number' ? [-it] : it).toArray().then(it => { assert.arrayEqual(it, [-1, -2, 3, 4, 5, 6], 'basic functionality'); return flatMap.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); return [arg]; }).toArray(); }).then(() => { return flatMap.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.for-each.js000066400000000000000000000026621451776221300245460ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#forEach', assert => { const { forEach } = AsyncIterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.nonEnumerable(AsyncIterator.prototype, 'forEach'); if (STRICT) { assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); const array = []; return forEach.call(createIterator([1, 2, 3]), it => array.push(it)).then(() => { assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); return forEach.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return forEach.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.from.js000066400000000000000000000020211451776221300240120ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import assign from 'core-js-pure/es/object/assign'; import create from 'core-js-pure/es/object/create'; import values from 'core-js-pure/es/array/values'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator.from', assert => { const { from } = AsyncIterator; assert.isFunction(from); assert.arity(from, 1); assert.true(AsyncIterator.from(values([])) instanceof AsyncIterator, 'proxy, iterator'); assert.true(AsyncIterator.from([]) instanceof AsyncIterator, 'proxy, iterable'); const asyncIterator = assign(create(AsyncIterator.prototype), { next: () => { /* empty */ }, }); assert.same(AsyncIterator.from(asyncIterator), asyncIterator, 'does not wrap AsyncIterator instances'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); return AsyncIterator.from([1, Promise.resolve(2), 3]).toArray().then(result => { assert.arrayEqual(result, [1, 2, 3], 'unwrap promises'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.indexed.js000066400000000000000000000013271451776221300244770ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import AsyncIterator from 'core-js-pure/full/async-iterator'; QUnit.test('AsyncIterator#indexed', assert => { const { indexed } = AsyncIterator.prototype; assert.isFunction(indexed); assert.arity(indexed, 0); assert.nonEnumerable(AsyncIterator.prototype, 'indexed'); if (STRICT) { assert.throws(() => indexed.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => indexed.call(null, () => { /* empty */ }), TypeError); } return indexed.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.map.js000066400000000000000000000025751451776221300236420ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#map', assert => { const { map } = AsyncIterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.nonEnumerable(AsyncIterator.prototype, 'map'); if (STRICT) { assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); return map.call(createIterator([1, 2, 3]), it => it ** 2).toArray().then(it => { assert.arrayEqual(it, [1, 4, 9], 'basic functionality'); return map.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); }).then(() => { return map.call(createIterator([1]), () => { throw 42; }).toArray(); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.reduce.js000066400000000000000000000033471451776221300243320ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#reduce', assert => { const { reduce } = AsyncIterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.nonEnumerable(AsyncIterator.prototype, 'reduce'); if (STRICT) { assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); } assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1).then(it => { assert.same(it, 7, 'basic functionality, initial'); return reduce.call(createIterator([2]), function (a, b, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 3, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); assert.same(counter, 0, 'counter'); }, 1); }).then(() => { return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b); }).then(it => { assert.same(it, 6, 'basic functionality, no initial'); return reduce.call(createIterator([]), (a, b) => a + b); }).catch(() => { assert.true(true, 'reduce an empty iterable with no initial'); return reduce.call(createIterator([1]), () => { throw 42; }, 1); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.some.js000066400000000000000000000027621451776221300240260ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#some', assert => { const { some } = AsyncIterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.nonEnumerable(AsyncIterator.prototype, 'some'); if (STRICT) { assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); return some.call(createIterator([1, 2, 3]), it => it === 2).then(result => { assert.true(result, 'basic functionality, +'); return some.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.false(result, 'basic functionality, -'); return some.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); }).then(() => { return some.call(createIterator([1]), () => { throw 42; }); }).then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejection on a callback error'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.take.js000066400000000000000000000022501451776221300237770ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#take', assert => { const { take } = AsyncIterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.nonEnumerable(AsyncIterator.prototype, 'take'); if (STRICT) { assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); } assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => take.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); return take.call(createIterator([1, 2, 3]), 2).toArray().then(it => { assert.arrayEqual(it, [1, 2], 'basic functionality'); return take.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [1], 'float'); return take.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'big'); return take.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [], 'zero'); }); }); core-js-3.33.2/tests/unit-pure/esnext.async-iterator.to-array.js000066400000000000000000000011731451776221300246140ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import AsyncIterator from 'core-js-pure/actual/async-iterator'; QUnit.test('AsyncIterator#toArray', assert => { const { toArray } = AsyncIterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.nonEnumerable(AsyncIterator.prototype, 'toArray'); if (STRICT) { assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); } return toArray.call(createIterator([1, 2, 3])).then(it => { assert.arrayEqual(it, [1, 2, 3]); }); }); core-js-3.33.2/tests/unit-pure/esnext.bigint.range.js000066400000000000000000000046741451776221300224730ustar00rootroot00000000000000/* eslint-disable es/no-bigint -- safe */ import from from 'core-js-pure/es/array/from'; import range from 'core-js-pure/full/bigint/range'; if (typeof BigInt == 'function') QUnit.test('BigInt.range', assert => { assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); let iterator = range(BigInt(1), BigInt(2)); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: BigInt(1), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(BigInt(-1), BigInt(5))), [BigInt(-1), BigInt(0), BigInt(1), BigInt(2), BigInt(3), BigInt(4)]); assert.deepEqual(from(range(BigInt(-5), BigInt(1))), [BigInt(-5), BigInt(-4), BigInt(-3), BigInt(-2), BigInt(-1), BigInt(0)]); assert.deepEqual( from(range(BigInt('9007199254740991'), BigInt('9007199254740992'), { inclusive: true })), [BigInt('9007199254740991'), BigInt('9007199254740992')], ); assert.deepEqual(from(range(BigInt(0), BigInt(0))), []); assert.deepEqual(from(range(BigInt(0), BigInt(-5), BigInt(1))), []); iterator = range(BigInt(1), BigInt(3)); assert.deepEqual(iterator.start, BigInt(1)); assert.deepEqual(iterator.end, BigInt(3)); assert.deepEqual(iterator.step, BigInt(1)); assert.false(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { inclusive: true }); assert.deepEqual(iterator.start, BigInt(-1)); assert.deepEqual(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(-1)); assert.true(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { step: BigInt(4), inclusive() { /* empty */ } }); assert.same(iterator.start, BigInt(-1)); assert.same(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(4)); assert.true(iterator.inclusive); iterator = range(BigInt(0), BigInt(5)); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(-Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), Infinity), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), { step: Infinity }), TypeError); assert.throws(() => range({}, BigInt(1)), TypeError); assert.throws(() => range(BigInt(1), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.composite-key.js000066400000000000000000000037701451776221300227100ustar00rootroot00000000000000 import { FREEZING } from '../helpers/constants.js'; import { getPrototypeOf, isFrozen } from 'core-js-pure/es/object'; import compositeKey from 'core-js-pure/full/composite-key'; QUnit.test('compositeKey', assert => { assert.isFunction(compositeKey); if (compositeKey.name) assert.name(compositeKey, 'compositeKey'); const key = compositeKey({}); assert.same(typeof key, 'object'); assert.same({}.toString.call(key), '[object Object]'); assert.same(getPrototypeOf(key), null); if (FREEZING) assert.true(isFrozen(key)); const a = ['a']; const b = ['b']; const c = ['c']; assert.same(compositeKey(a), compositeKey(a)); assert.notSame(compositeKey(a), compositeKey(['a'])); assert.notSame(compositeKey(a), compositeKey(a, 1)); assert.notSame(compositeKey(a), compositeKey(a, b)); assert.same(compositeKey(a, 1), compositeKey(a, 1)); assert.same(compositeKey(a, b), compositeKey(a, b)); assert.notSame(compositeKey(a, b), compositeKey(b, a)); assert.same(compositeKey(a, b, c), compositeKey(a, b, c)); assert.notSame(compositeKey(a, b, c), compositeKey(c, b, a)); assert.notSame(compositeKey(a, b, c), compositeKey(a, c, b)); assert.notSame(compositeKey(a, b, c, 1), compositeKey(a, b, c)); assert.same(compositeKey(a, b, c, 1), compositeKey(a, b, c, 1)); assert.same(compositeKey(1, a), compositeKey(1, a)); assert.notSame(compositeKey(1, a), compositeKey(a, 1)); assert.same(compositeKey(1, a, 2, b), compositeKey(1, a, 2, b)); assert.notSame(compositeKey(1, a, 2, b), compositeKey(1, a, b, 2)); assert.same(compositeKey(1, 2, a, b), compositeKey(1, 2, a, b)); assert.notSame(compositeKey(1, 2, a, b), compositeKey(1, a, b, 2)); assert.same(compositeKey(a, a), compositeKey(a, a)); assert.notSame(compositeKey(a, a), compositeKey(a, ['a'])); assert.notSame(compositeKey(a, a), compositeKey(a, b)); assert.throws(() => compositeKey(), TypeError); assert.throws(() => compositeKey(1, 2), TypeError); assert.throws(() => compositeKey('foo', null, true), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.composite-symbol.js000066400000000000000000000041061451776221300234170ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import compositeSymbol from 'core-js-pure/full/composite-symbol'; QUnit.test('compositeSymbol', assert => { assert.isFunction(compositeSymbol); if (compositeSymbol.name) assert.name(compositeSymbol, 'compositeSymbol'); assert.true(Object(compositeSymbol({})) instanceof Symbol); const a = ['a']; const b = ['b']; const c = ['c']; assert.same(compositeSymbol(a), compositeSymbol(a)); assert.notSame(compositeSymbol(a), compositeSymbol(['a'])); assert.notSame(compositeSymbol(a), compositeSymbol(a, 1)); assert.notSame(compositeSymbol(a), compositeSymbol(a, b)); assert.same(compositeSymbol(a, 1), compositeSymbol(a, 1)); assert.same(compositeSymbol(a, b), compositeSymbol(a, b)); assert.notSame(compositeSymbol(a, b), compositeSymbol(b, a)); assert.same(compositeSymbol(a, b, c), compositeSymbol(a, b, c)); assert.notSame(compositeSymbol(a, b, c), compositeSymbol(c, b, a)); assert.notSame(compositeSymbol(a, b, c), compositeSymbol(a, c, b)); assert.notSame(compositeSymbol(a, b, c, 1), compositeSymbol(a, b, c)); assert.same(compositeSymbol(a, b, c, 1), compositeSymbol(a, b, c, 1)); assert.same(compositeSymbol(1, a), compositeSymbol(1, a)); assert.notSame(compositeSymbol(1, a), compositeSymbol(a, 1)); assert.same(compositeSymbol(1, a, 2, b), compositeSymbol(1, a, 2, b)); assert.notSame(compositeSymbol(1, a, 2, b), compositeSymbol(1, a, b, 2)); assert.same(compositeSymbol(1, 2, a, b), compositeSymbol(1, 2, a, b)); assert.notSame(compositeSymbol(1, 2, a, b), compositeSymbol(1, a, b, 2)); assert.same(compositeSymbol(a, a), compositeSymbol(a, a)); assert.notSame(compositeSymbol(a, a), compositeSymbol(a, ['a'])); assert.notSame(compositeSymbol(a, a), compositeSymbol(a, b)); assert.same(compositeSymbol(), compositeSymbol()); assert.same(compositeSymbol(1, 2), compositeSymbol(1, 2)); assert.notSame(compositeSymbol(1, 2), compositeSymbol(2, 1)); assert.same(compositeSymbol('foo', null, true), compositeSymbol('foo', null, true)); assert.same(compositeSymbol('string'), Symbol.for('string')); }); core-js-3.33.2/tests/unit-pure/esnext.disposable-stack.constructor.js000066400000000000000000000122421451776221300257260ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/actual/symbol'; import DisposableStack from 'core-js-pure/actual/disposable-stack'; import SuppressedError from 'core-js-pure/actual/suppressed-error'; QUnit.test('DisposableStack constructor', assert => { assert.isFunction(DisposableStack); assert.arity(DisposableStack, 0); assert.name(DisposableStack, 'DisposableStack'); assert.throws(() => DisposableStack(), 'throws w/o `new`'); assert.true(new DisposableStack() instanceof DisposableStack); assert.same(DisposableStack.prototype.constructor, DisposableStack); }); QUnit.test('DisposableStack#dispose', assert => { assert.isFunction(DisposableStack.prototype.dispose); assert.arity(DisposableStack.prototype.dispose, 0); assert.name(DisposableStack.prototype.dispose, 'dispose'); assert.nonEnumerable(DisposableStack.prototype, 'dispose'); }); QUnit.test('DisposableStack#use', assert => { assert.isFunction(DisposableStack.prototype.use); assert.arity(DisposableStack.prototype.use, 1); assert.name(DisposableStack.prototype.use, 'use'); assert.nonEnumerable(DisposableStack.prototype, 'use'); let result = ''; const stack = new DisposableStack(); const resource = { [Symbol.dispose]() { result += '1'; assert.same(this, resource); assert.same(arguments.length, 0); }, }; assert.same(stack.use(resource), resource); assert.same(stack.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#adopt', assert => { assert.isFunction(DisposableStack.prototype.adopt); assert.arity(DisposableStack.prototype.adopt, 2); assert.name(DisposableStack.prototype.adopt, 'adopt'); assert.nonEnumerable(DisposableStack.prototype, 'adopt'); let result = ''; const stack = new DisposableStack(); const resource = {}; assert.same(stack.adopt(resource, function (arg) { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 1); assert.same(arg, resource); }), resource); assert.same(stack.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#defer', assert => { assert.isFunction(DisposableStack.prototype.defer); assert.arity(DisposableStack.prototype.defer, 1); assert.name(DisposableStack.prototype.defer, 'defer'); assert.nonEnumerable(DisposableStack.prototype, 'defer'); let result = ''; const stack = new DisposableStack(); assert.same(stack.defer(function () { result += '1'; if (STRICT) assert.same(this, undefined); assert.same(arguments.length, 0); }), undefined); assert.same(stack.dispose(), undefined); assert.same(result, '1'); }); QUnit.test('DisposableStack#move', assert => { assert.isFunction(DisposableStack.prototype.move); assert.arity(DisposableStack.prototype.move, 0); assert.name(DisposableStack.prototype.move, 'move'); assert.nonEnumerable(DisposableStack.prototype, 'move'); let result = ''; const stack1 = new DisposableStack(); stack1.defer(() => result += '2'); stack1.defer(() => result += '1'); const stack2 = stack1.move(); assert.true(stack1.disposed); stack2.dispose(); assert.same(result, '12'); }); QUnit.test('DisposableStack#@@dispose', assert => { assert.same(DisposableStack.prototype[Symbol.dispose], DisposableStack.prototype.dispose); }); QUnit.test('DisposableStack#@@toStringTag', assert => { assert.same(DisposableStack.prototype[Symbol.toStringTag], 'DisposableStack', '@@toStringTag'); }); QUnit.test('DisposableStack', assert => { let result1 = ''; const stack1 = new DisposableStack(); stack1.use({ [Symbol.dispose]: () => result1 += '6' }); stack1.adopt({}, () => result1 += '5'); stack1.defer(() => result1 += '4'); stack1.use({ [Symbol.dispose]: () => result1 += '3' }); stack1.adopt({}, () => result1 += '2'); stack1.defer(() => result1 += '1'); assert.false(stack1.disposed); assert.same(stack1.dispose(), undefined); assert.same(result1, '123456'); assert.true(stack1.disposed); assert.same(stack1.dispose(), undefined); let result2 = ''; const stack2 = new DisposableStack(); let error2; stack2.use({ [Symbol.dispose]: () => result2 += '6' }); stack2.adopt({}, () => { throw new Error(5); }); stack2.defer(() => result2 += '4'); stack2.use({ [Symbol.dispose]: () => result2 += '3' }); stack2.adopt({}, () => result2 += '2'); stack2.defer(() => result2 += '1'); try { stack2.dispose(); } catch (error2$) { error2 = error2$; } assert.same(result2, '12346'); assert.true(error2 instanceof Error); assert.same(error2.message, '5'); let result3 = ''; const stack3 = new DisposableStack(); let error3; stack3.use({ [Symbol.dispose]: () => result3 += '6' }); stack3.adopt({}, () => { throw new Error(5); }); stack3.defer(() => result3 += '4'); stack3.use({ [Symbol.dispose]: () => { throw new Error(3); } }); stack3.adopt({}, () => result3 += '2'); stack3.defer(() => result3 += '1'); try { stack3.dispose(); } catch (error3$) { error3 = error3$; } assert.same(result3, '1246'); assert.true(error3 instanceof SuppressedError); assert.same(error3.error.message, '5'); assert.same(error3.suppressed.message, '3'); }); core-js-3.33.2/tests/unit-pure/esnext.function.demethodize.js000066400000000000000000000005601451776221300242370ustar00rootroot00000000000000import demethodize from 'core-js-pure/full/function/demethodize'; QUnit.test('Function#demethodize', assert => { assert.isFunction(demethodize); // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(demethodize(function () { return 42; })(), 42); assert.deepEqual(demethodize(Array.prototype.slice)([1, 2, 3], 1), [2, 3]); }); core-js-3.33.2/tests/unit-pure/esnext.function.is-callable.js000066400000000000000000000032541451776221300241110ustar00rootroot00000000000000import isCallable from 'core-js-pure/full/function/is-callable'; import { fromSource } from '../helpers/helpers.js'; QUnit.test('Function.isCallable', assert => { assert.isFunction(isCallable); assert.arity(isCallable, 1); assert.name(isCallable, 'isCallable'); assert.false(isCallable({}), 'object'); assert.false(isCallable(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }()), 'arguments'); assert.false(isCallable([]), 'array'); assert.false(isCallable(/./), 'regex'); assert.false(isCallable(1), 'number'); assert.false(isCallable(true), 'boolean'); assert.false(isCallable('1'), 'string'); assert.false(isCallable(null), 'null'); assert.false(isCallable(), 'undefined'); assert.true(isCallable(Function.call), 'native function'); // eslint-disable-next-line prefer-arrow-callback -- required assert.true(isCallable(function () { /* empty */ }), 'function'); const arrow = fromSource('it => it'); if (arrow) assert.true(isCallable(arrow), 'arrow'); const klass = fromSource('class {}'); // Safari 9 and Edge 13- bugs if (klass && !/constructor|function/.test(klass)) assert.false(isCallable(klass), 'class'); const gen = fromSource('function * () {}'); if (gen) assert.true(isCallable(gen), 'gen'); const asyncFunc = fromSource('async function () {}'); if (asyncFunc) assert.true(isCallable(asyncFunc), 'asyncFunc'); const asyncGen = fromSource('async * function () {}'); if (asyncGen) assert.true(isCallable(asyncGen), 'asyncGen'); const method = fromSource('({f(){}}).f'); // Safari 9 bug if (method && !/function/.test(method)) assert.true(isCallable(method), 'method'); }); core-js-3.33.2/tests/unit-pure/esnext.function.is-constructor.js000066400000000000000000000035331451776221300247370ustar00rootroot00000000000000import isConstructor from 'core-js-pure/full/function/is-constructor'; import { fromSource } from '../helpers/helpers.js'; QUnit.test('Function.isConstructor', assert => { assert.isFunction(isConstructor); assert.arity(isConstructor, 1); assert.name(isConstructor, 'isConstructor'); assert.false(isConstructor({}), 'object'); assert.false(isConstructor(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }()), 'arguments'); assert.false(isConstructor([]), 'array'); assert.false(isConstructor(/./), 'regex'); assert.false(isConstructor(1), 'number'); assert.false(isConstructor(true), 'boolean'); assert.false(isConstructor('1'), 'string'); assert.false(isConstructor(null), 'null'); assert.false(isConstructor(), 'undefined'); // assert.false(isConstructor(Function.call), 'native function'); // fails in some old engines // eslint-disable-next-line prefer-arrow-callback -- required assert.true(isConstructor(function () { /* empty */ }), 'function'); const arrow = fromSource('it => it'); if (arrow) assert.false(isConstructor(arrow), 'arrow'); const klass = fromSource('class {}'); // Safari 9 and Edge 13- bugs if (klass && !/constructor|function/.test(klass)) assert.true(isConstructor(klass), 'class'); const Gen = fromSource('function * () {}'); // V8 ~ Chrome 49- bug if (Gen) try { new Gen(); } catch { assert.false(isConstructor(Gen), 'gen'); } const asyncFunc = fromSource('async function () {}'); if (asyncFunc) assert.false(isConstructor(asyncFunc), 'asyncFunc'); const asyncGen = fromSource('async * function () {}'); if (asyncGen) assert.false(isConstructor(asyncGen), 'asyncGen'); const method = fromSource('({f(){}}).f'); // Safari 9 bug if (method && !/function/.test(method)) assert.false(isConstructor(method), 'method'); }); core-js-3.33.2/tests/unit-pure/esnext.function.metadata.js000066400000000000000000000003371451776221300235200ustar00rootroot00000000000000import Symbol from 'core-js-pure/actual/symbol'; QUnit.test('Function#@@metadata', assert => { assert.true(Symbol.metadata in Function.prototype); assert.same(Function.prototype[Symbol.metadata], null, 'is null'); }); core-js-3.33.2/tests/unit-pure/esnext.function.un-this.js000066400000000000000000000005231451776221300233240ustar00rootroot00000000000000import unThis from 'core-js-pure/full/function/un-this'; QUnit.test('Function#unThis', assert => { assert.isFunction(unThis); // eslint-disable-next-line prefer-arrow-callback -- required for testing assert.same(unThis(function () { return 42; })(), 42); assert.deepEqual(unThis(Array.prototype.slice)([1, 2, 3], 1), [2, 3]); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.as-indexed-pairs.js000066400000000000000000000014611451776221300251000ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/full/iterator'; QUnit.test('Iterator#asIndexedPairs', assert => { const { asIndexedPairs } = Iterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.nonEnumerable(Iterator.prototype, 'asIndexedPairs'); assert.arrayEqual(asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); if (STRICT) { assert.throws(() => asIndexedPairs.call(undefined), TypeError); assert.throws(() => asIndexedPairs.call(null), TypeError); } assert.throws(() => asIndexedPairs.call({}).next(), TypeError); assert.throws(() => asIndexedPairs.call([]).next(), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.constructor.js000066400000000000000000000016511451776221300243310ustar00rootroot00000000000000import { createIterator, nativeSubclass } from '../helpers/helpers.js'; import Symbol from 'core-js-pure/es/symbol'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator', assert => { assert.isFunction(Iterator); assert.arity(Iterator, 0); assert.true(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'From Proxy'); if (nativeSubclass) { const Sub = nativeSubclass(Iterator); assert.true(new Sub() instanceof Iterator, 'abstract constructor'); } assert.throws(() => new Iterator(), 'direct constructor throws'); assert.throws(() => Iterator(), 'throws w/o `new`'); }); QUnit.test('Iterator#constructor', assert => { assert.same(Iterator.prototype.constructor, Iterator, 'Iterator#constructor is Iterator'); }); QUnit.test('Iterator#@@toStringTag', assert => { assert.same(Iterator.prototype[Symbol.toStringTag], 'Iterator', 'Iterator::@@toStringTag is `Iterator`'); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.dispose.js000066400000000000000000000012031451776221300234030ustar00rootroot00000000000000import Iterator from 'core-js-pure/full/iterator'; import Symbol from 'core-js-pure/actual/symbol'; import create from 'core-js-pure/es/object/create'; QUnit.test('Iterator#@@dispose', assert => { const dispose = Iterator.prototype[Symbol.dispose]; assert.isFunction(dispose); assert.arity(dispose, 0); assert.same(create(Iterator.prototype)[Symbol.dispose](), undefined); let called = false; const iterator2 = create(Iterator.prototype); iterator2.return = function () { called = true; assert.same(this, iterator2); return 7; }; assert.same(iterator2[Symbol.dispose](), undefined); assert.true(called); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.drop.js000066400000000000000000000021751451776221300227120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#drop', assert => { const { drop } = Iterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.nonEnumerable(Iterator.prototype, 'drop'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1).toArray(), [2, 3], 'basic functionality'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1.5).toArray(), [2, 3], 'float'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 4).toArray(), [], 'big'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 0).toArray(), [1, 2, 3], 'zero'); if (STRICT) { assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); } assert.throws(() => drop.call({}, 1).next(), TypeError); assert.throws(() => drop.call([], 1).next(), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => drop.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.every.js000066400000000000000000000025261451776221300231000ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#every', assert => { const { every } = Iterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.nonEnumerable(Iterator.prototype, 'every'); assert.true(every.call(createIterator([1, 2, 3]), it => typeof it == 'number'), 'basic functionality #1'); assert.false(every.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #2'); every.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.filter.js000066400000000000000000000024431451776221300232310ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#filter', assert => { const { filter } = Iterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.nonEnumerable(Iterator.prototype, 'filter'); assert.arrayEqual(filter.call(createIterator([1, 2, 3]), it => it % 2).toArray(), [1, 3], 'basic functionality'); filter.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); if (STRICT) { assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => filter.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.find.js000066400000000000000000000023351451776221300226640ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#find', assert => { const { find } = Iterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(Iterator.prototype, 'find'); assert.same(find.call(createIterator([1, 2, 3]), it => !(it % 2)), 2, 'basic functionality'); find.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.flat-map.js000066400000000000000000000030051451776221300234400ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#flatMap', assert => { const { flatMap } = Iterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.nonEnumerable(Iterator.prototype, 'flatMap'); assert.arrayEqual( flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6]]), it => typeof it == 'number' ? [-it] : it).toArray(), [-1, -2, 3, 4, 5, 6], 'basic functionality', ); flatMap.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); return [arg]; }).toArray(); if (STRICT) { assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => flatMap.call(createIterator([1]), it => it).next(), TypeError); assert.throws(() => flatMap.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => flatMap.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.for-each.js000066400000000000000000000024721451776221300234320ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#forEach', assert => { const { forEach } = Iterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.nonEnumerable(Iterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)); assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); forEach.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.from.js000066400000000000000000000015021451776221300227020ustar00rootroot00000000000000import { createIterable, createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/actual/iterator'; import assign from 'core-js-pure/es/object/assign'; QUnit.test('Iterator.from', assert => { const { from } = Iterator; assert.isFunction(from); assert.arity(from, 1); assert.true(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'proxy, iterator'); assert.true(Iterator.from(createIterable([1, 2, 3])) instanceof Iterator, 'proxy, iterable'); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3], 'just a proxy'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}).next(), TypeError); assert.throws(() => from(assign(new Iterator(), { next: 42 })).next(), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.indexed.js000066400000000000000000000013531451776221300233630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/full/iterator'; QUnit.test('Iterator#indexed', assert => { const { indexed } = Iterator.prototype; assert.isFunction(indexed); assert.arity(indexed, 0); assert.nonEnumerable(Iterator.prototype, 'indexed'); assert.arrayEqual(indexed.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); if (STRICT) { assert.throws(() => indexed.call(undefined), TypeError); assert.throws(() => indexed.call(null), TypeError); } assert.throws(() => indexed.call({}).next(), TypeError); assert.throws(() => indexed.call([]).next(), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.map.js000066400000000000000000000023751451776221300225250ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#map', assert => { const { map } = Iterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.nonEnumerable(Iterator.prototype, 'map'); assert.arrayEqual(map.call(createIterator([1, 2, 3]), it => it ** 2).toArray(), [1, 4, 9], 'basic functionality'); map.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }).toArray(); if (STRICT) { assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => map.call({}, () => { /* empty */ }).next(), TypeError); assert.throws(() => map.call([], () => { /* empty */ }).next(), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.range.js000066400000000000000000000113341451776221300230370ustar00rootroot00000000000000/* eslint-disable es/no-bigint -- safe */ import from from 'core-js-pure/es/array/from'; import range from 'core-js-pure/full/iterator/range'; QUnit.test('Iterator.range', assert => { assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); let iterator = range(1, 2); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(-1, 5)), [-1, 0, 1, 2, 3, 4]); assert.deepEqual(from(range(-5, 1)), [-5, -4, -3, -2, -1, 0]); assert.deepEqual( from(range(0, 1, 0.1)), [0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8, 0.9], ); assert.deepEqual( from(range(2 ** 53 - 1, 2 ** 53, { inclusive: true })), [9007199254740991, 9007199254740992], ); assert.deepEqual(from(range(0, 0)), []); assert.deepEqual(from(range(0, -5, 1)), []); assert.deepEqual(from(range(NaN, 0)), []); assert.deepEqual(from(range(0, NaN)), []); assert.deepEqual(from(range(NaN, NaN)), []); assert.deepEqual(from(range(0, 0, { step: NaN })), []); assert.deepEqual(from(range(0, 5, NaN)), []); iterator = range(1, 3); assert.deepEqual(iterator.start, 1); assert.deepEqual(iterator.end, 3); assert.deepEqual(iterator.step, 1); assert.false(iterator.inclusive); iterator = range(-1, -3, { inclusive: true }); assert.deepEqual(iterator.start, -1); assert.deepEqual(iterator.end, -3); assert.same(iterator.step, -1); assert.true(iterator.inclusive); iterator = range(-1, -3, { step: 4, inclusive() { /* empty */ } }); assert.same(iterator.start, -1); assert.same(iterator.end, -3); assert.same(iterator.step, 4); assert.true(iterator.inclusive); iterator = range(0, 5); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, 10, 0), RangeError); assert.throws(() => range(-Infinity, 10, 0), RangeError); assert.throws(() => range(0, 10, Infinity), RangeError); assert.throws(() => range(0, 10, { step: Infinity }), RangeError); assert.throws(() => range({}, 1), TypeError); assert.throws(() => range(1, {}), TypeError); assert.throws(() => range('1', 2), TypeError); assert.throws(() => range({ valueOf() { return 1; } }, 2), TypeError); if (typeof BigInt == 'function') { iterator = range(BigInt(1), BigInt(2)); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: BigInt(1), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(BigInt(-1), BigInt(5))), [BigInt(-1), BigInt(0), BigInt(1), BigInt(2), BigInt(3), BigInt(4)]); assert.deepEqual(from(range(BigInt(-5), BigInt(1))), [BigInt(-5), BigInt(-4), BigInt(-3), BigInt(-2), BigInt(-1), BigInt(0)]); assert.deepEqual( from(range(BigInt('9007199254740991'), BigInt('9007199254740992'), { inclusive: true })), [BigInt('9007199254740991'), BigInt('9007199254740992')], ); assert.deepEqual(from(range(BigInt(0), BigInt(0))), []); assert.deepEqual(from(range(BigInt(0), BigInt(-5), BigInt(1))), []); iterator = range(BigInt(1), BigInt(3)); assert.deepEqual(iterator.start, BigInt(1)); assert.deepEqual(iterator.end, BigInt(3)); assert.deepEqual(iterator.step, BigInt(1)); assert.false(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { inclusive: true }); assert.deepEqual(iterator.start, BigInt(-1)); assert.deepEqual(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(-1)); assert.true(iterator.inclusive); iterator = range(BigInt(-1), BigInt(-3), { step: BigInt(4), inclusive() { /* empty */ } }); assert.same(iterator.start, BigInt(-1)); assert.same(iterator.end, BigInt(-3)); assert.same(iterator.step, BigInt(4)); assert.true(iterator.inclusive); iterator = range(BigInt(0), BigInt(5)); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(-Infinity, BigInt(10), BigInt(0)), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), Infinity), TypeError); assert.throws(() => range(BigInt(0), BigInt(10), { step: Infinity }), TypeError); assert.throws(() => range({}, BigInt(1)), TypeError); assert.throws(() => range(BigInt(1), {}), TypeError); } }); core-js-3.33.2/tests/unit-pure/esnext.iterator.reduce.js000066400000000000000000000026151451776221300232140ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#reduce', assert => { const { reduce } = Iterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.nonEnumerable(Iterator.prototype, 'reduce'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1), 7, 'basic functionality'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b), 6, 'basic functionality, no init'); reduce.call(createIterator([2]), function (a, b, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 3, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); assert.same(counter, 0, 'counter'); }, 1); if (STRICT) { assert.throws(() => reduce.call(undefined, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(null, (a, b) => a + b, 0), TypeError); } assert.throws(() => reduce.call({}, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call([], (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.some.js000066400000000000000000000025071451776221300227100ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers.js'; import { STRICT, STRICT_THIS } from '../helpers/constants.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#some', assert => { const { some } = Iterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.nonEnumerable(Iterator.prototype, 'some'); assert.true(some.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #1'); assert.false(some.call(createIterator([1, 2, 3]), it => typeof it == 'string'), 'basic functionality #2'); some.call(createIterator([1]), function (arg, counter) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(arg, 1, 'argument'); assert.same(counter, 0, 'counter'); }); if (STRICT) { assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); } assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.take.js000066400000000000000000000021721451776221300226670ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#take', assert => { const { take } = Iterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.nonEnumerable(Iterator.prototype, 'take'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 2).toArray(), [1, 2], 'basic functionality'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 1.5).toArray(), [1], 'float'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 4).toArray(), [1, 2, 3], 'big'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 0).toArray(), [], 'zero'); if (STRICT) { assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); } assert.throws(() => take.call({}, 1).next(), TypeError); assert.throws(() => take.call([], 1).next(), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); assert.throws(() => take.call(createIterator([1, 2, 3]), NaN), RangeError, 'NaN'); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.to-array.js000066400000000000000000000015241451776221300235010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import { createIterable, createIterator } from '../helpers/helpers.js'; import Iterator from 'core-js-pure/actual/iterator'; QUnit.test('Iterator#toArray', assert => { const { toArray } = Iterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.nonEnumerable(Iterator.prototype, 'toArray'); assert.arrayEqual(Iterator.from('123').toArray(), ['1', '2', '3']); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3]); assert.arrayEqual(toArray.call(createIterator([1, 2, 3])), [1, 2, 3]); if (STRICT) { assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); } assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.iterator.to-async.js000066400000000000000000000014621451776221300235010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Promise from 'core-js-pure/es/promise'; import Set from 'core-js-pure/es/set'; import Iterator from 'core-js-pure/actual/iterator'; import 'core-js-pure/actual/async-iterator'; QUnit.test('Iterator#toAsync', assert => { const { toAsync } = Iterator.prototype; assert.isFunction(toAsync); assert.arity(toAsync, 0); if (STRICT) { assert.throws(() => toAsync.call(undefined), TypeError); assert.throws(() => toAsync.call(null), TypeError); } return Iterator.from([1, 2, 3]).toAsync().map(it => Promise.resolve(it)).toArray().then(it => { assert.arrayEqual(it, [1, 2, 3]); return Iterator.from(new Set([1, 2, 3])).toAsync().map(el => Promise.resolve(el)).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3]); }); }); core-js-3.33.2/tests/unit-pure/esnext.json.is-raw-json.js000066400000000000000000000015631451776221300232370ustar00rootroot00000000000000import isRawJSON from 'core-js-pure/actual/json/is-raw-json'; import rawJSON from 'core-js-pure/actual/json/raw-json'; import freeze from 'core-js-pure/es/object/freeze'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('JSON.rawJSON', assert => { assert.isFunction(isRawJSON); assert.arity(isRawJSON, 1); assert.name(isRawJSON, 'isRawJSON'); assert.true(isRawJSON(rawJSON(1)), 'raw1'); assert.true(isRawJSON(rawJSON(null)), 'raw2'); assert.false(isRawJSON(freeze({ rawJSON: '123' })), 'fake'); assert.false(isRawJSON(undefined), 'undefined'); assert.false(isRawJSON(null), 'null'); assert.false(isRawJSON(1), 'number'); assert.false(isRawJSON('qwe'), 'string'); assert.false(isRawJSON(true), 'bool'); assert.false(isRawJSON(Symbol('JSON.isRawJSON test')), 'sym'); assert.false(isRawJSON({}), 'object'); assert.false(isRawJSON([]), 'array'); }); core-js-3.33.2/tests/unit-pure/esnext.json.parse.js000066400000000000000000000336401451776221300222010ustar00rootroot00000000000000// Some tests adopted from Test262 project and governed by the BSD license. // Copyright (c) 2012 Ecma International. All rights reserved. /* eslint-disable unicorn/escape-case -- testing */ import { DESCRIPTORS, REDEFINABLE_PROTO } from '../helpers/constants.js'; import parse from 'core-js-pure/actual/json/parse'; import defineProperty from 'core-js-pure/es/object/define-property'; import hasOwn from 'core-js-pure/es/object/has-own'; import keys from 'core-js-pure/es/object/keys'; import Symbol from 'core-js-pure/es/symbol'; QUnit.test('JSON.parse', assert => { assert.isFunction(parse); assert.arity(parse, 2); assert.name(parse, 'parse'); for (const [reviver, note] of [[undefined, 'without reviver'], [(key, value) => value, 'with reviver']]) { assert.throws(() => parse('12\t\r\n 34', reviver), SyntaxError, `15.12.1.1-0-1 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.throws(() => parse('\u000b1234', reviver), SyntaxError, `15.12.1.1-0-2 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u000c1234', reviver), SyntaxError, `15.12.1.1-0-3 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u00a01234', reviver), SyntaxError, `15.12.1.1-0-4 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u200b1234', reviver), SyntaxError, `15.12.1.1-0-5 ${ note }`); // should produce a syntax error assert.throws(() => parse('\ufeff1234', reviver), SyntaxError, `15.12.1.1-0-6 ${ note }`); // should produce a syntax error assert.throws(() => parse('\u2028\u20291234', reviver), SyntaxError, `15.12.1.1-0-8 ${ note }`); // should produce a syntax error assert.notThrows(() => parse('\t\r \n{\t\r \n"property"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n"prop2"\t\r \n:\t\r \n' + '[\t\r \ntrue\t\r \n,\t\r \nnull\t\r \n,123.456\t\r \n]\t\r \n}\t\r \n', reviver), SyntaxError, `15.12.1.1-0-9 ${ note }`); // should JSON parse without error assert.same(parse('\t1234', reviver), 1234, `15.12.1.1-g1-1-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\t34', reviver), SyntaxError, `15.12.1.1-g1-1-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('\r1234', reviver), 1234, `15.12.1.1-g1-2-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\r34', reviver), SyntaxError, `15.12.1.1-g1-2-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('\n1234', reviver), 1234, `15.12.1.1-g1-3-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12\n34', reviver), SyntaxError, `15.12.1.1-g1-3-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse(' 1234', reviver), 1234, `15.12.1.1-g1-4-1 ${ note }`); // ' should be ignored' assert.throws(() => parse('12 34', reviver), SyntaxError, `15.12.1.1-g1-4-2 ${ note }`); // should produce a syntax error as whitespace results in two tokens assert.same(parse('"abc"', reviver), 'abc', `15.12.1.1-g2-1 ${ note }`); assert.throws(() => parse("'abc'", reviver), SyntaxError, `15.12.1.1-g2-2 ${ note }`); assert.throws(() => parse('\\u0022abc\\u0022', reviver), SyntaxError, `15.12.1.1-g2-3 ${ note }`); assert.throws(() => parse('"abc\'', reviver), SyntaxError, `15.12.1.1-g2-4 ${ note }`); assert.same(parse('""', reviver), '', `15.12.1.1-g2-5 ${ note }`); // invalid string characters should produce a syntax error assert.throws(() => parse('"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007"', reviver), SyntaxError, `15.12.1.1-g4-1 ${ note }`); assert.throws(() => parse('"\u0008\u0009\u000a\u000b\u000c\u000d\u000e\u000f"', reviver), SyntaxError, `15.12.1.1-g4-2 ${ note }`); assert.throws(() => parse('"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"', reviver), SyntaxError, `15.12.1.1-g4-3 ${ note }`); assert.throws(() => parse('"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"', reviver), SyntaxError, `15.12.1.1-g4-4 ${ note }`); assert.same(parse('"\\u0058"', reviver), 'X', `15.12.1.1-g5-1 ${ note }`); assert.throws(() => parse('"\\u005"', reviver), SyntaxError, `15.12.1.1-g5-2 ${ note }`); assert.throws(() => parse('"\\u0X50"', reviver), SyntaxError, `15.12.1.1-g5-3 ${ note }`); assert.same(parse('"\\/"', reviver), '/', `15.12.1.1-g6-1 ${ note }`); assert.same(parse('"\\\\"', reviver), '\\', `15.12.1.1-g6-2 ${ note }`); assert.same(parse('"\\b"', reviver), '\b', `15.12.1.1-g6-3 ${ note }`); assert.same(parse('"\\f"', reviver), '\f', `15.12.1.1-g6-4 ${ note }`); assert.same(parse('"\\n"', reviver), '\n', `15.12.1.1-g6-5 ${ note }`); assert.same(parse('"\\r"', reviver), '\r', `15.12.1.1-g6-6 ${ note }`); assert.same(parse('"\\t"', reviver), '\t', `15.12.1.1-g6-7 ${ note }`); const nullChars = [ '"\u0000"', '"\u0001"', '"\u0002"', '"\u0003"', '"\u0004"', '"\u0005"', '"\u0006"', '"\u0007"', '"\u0008"', '"\u0009"', '"\u000A"', '"\u000B"', '"\u000C"', '"\u000D"', '"\u000E"', '"\u000F"', '"\u0010"', '"\u0011"', '"\u0012"', '"\u0013"', '"\u0014"', '"\u0015"', '"\u0016"', '"\u0017"', '"\u0018"', '"\u0019"', '"\u001A"', '"\u001B"', '"\u001C"', '"\u001D"', '"\u001E"', '"\u001F"', ]; for (let i = 0; i < nullChars.length; i++) { assert.throws(() => parse(`{${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-1-${ i } ${ note }`); assert.throws(() => parse(`{${ nullChars[i] }name : "John" }`, reviver), SyntaxError, `15.12.2-2-2-${ i } ${ note }`); assert.throws(() => parse(`{name${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-3-${ i } ${ note }`); assert.throws(() => parse(`{${ nullChars[i] }name${ nullChars[i] } : "John" }`, reviver), SyntaxError, `15.12.2-2-4-${ i } ${ note }`); assert.throws(() => parse(`{na${ nullChars[i] }me : "John" }`, reviver), SyntaxError, `15.12.2-2-5-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-6-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] }John }`, reviver), SyntaxError, `15.12.2-2-7-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : John${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-8-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : ${ nullChars[i] }John${ nullChars[i] } }`, reviver), SyntaxError, `15.12.2-2-9-${ i } ${ note }`); assert.throws(() => parse(`{ "name" : Jo${ nullChars[i] }hn }`, reviver), SyntaxError, `15.12.2-2-10-${ i } ${ note }`); } if (REDEFINABLE_PROTO) { // eslint-disable-next-line no-proto -- testing assert.same(parse('{ "__proto__": 1, "__proto__": 2 }', reviver).__proto__, 2, `duplicate proto ${ note }`); } assert.throws(() => parse('\u16801', reviver), SyntaxError, `15.12.1.1-0-7-1 ${ note }`); // invalid whitespace assert.throws(() => parse('\u180e1', reviver), SyntaxError, `15.12.1.1-0-7-2 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20001', reviver), SyntaxError, `15.12.1.1-0-7-3 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20011', reviver), SyntaxError, `15.12.1.1-0-7-4 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20021', reviver), SyntaxError, `15.12.1.1-0-7-5 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20031', reviver), SyntaxError, `15.12.1.1-0-7-6 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20041', reviver), SyntaxError, `15.12.1.1-0-7-7 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20051', reviver), SyntaxError, `15.12.1.1-0-7-8 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20061', reviver), SyntaxError, `15.12.1.1-0-7-9 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20071', reviver), SyntaxError, `15.12.1.1-0-7-10 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20081', reviver), SyntaxError, `15.12.1.1-0-7-11 ${ note }`); // invalid whitespace assert.throws(() => parse('\u20091', reviver), SyntaxError, `15.12.1.1-0-7-12 ${ note }`); // invalid whitespace assert.throws(() => parse('\u200a1', reviver), SyntaxError, `15.12.1.1-0-7-13 ${ note }`); // invalid whitespace assert.throws(() => parse('\u202f1', reviver), SyntaxError, `15.12.1.1-0-7-14 ${ note }`); // invalid whitespace assert.throws(() => parse('\u205f1', reviver), SyntaxError, `15.12.1.1-0-7-15 ${ note }`); // invalid whitespace assert.throws(() => parse('\u30001', reviver), SyntaxError, `15.12.1.1-0-7-16 ${ note }`); // invalid whitespace assert.same(parse('-0', reviver), -0, `negative-zero-1 ${ note }`); assert.same(parse(' \n-0', reviver), -0, `negative-zero-2 ${ note }`); assert.same(parse('-0 \t', reviver), -0, `negative-zero-3 ${ note }`); assert.same(parse('\n\t -0\n ', reviver), -0, `negative-zero-4 ${ note }`); assert.same(parse(-0, reviver), 0, `negative-zero-5 ${ note }`); assert.throws(() => parse(undefined, reviver), SyntaxError, `undefined ${ note }`); assert.throws(() => parse(Symbol('JSON.parse test'), reviver), TypeError, `symbol ${ note }`); assert.same(parse(null, reviver), null, `null ${ note }`); assert.same(parse(false, reviver), false, `false ${ note }`); assert.same(parse(true, reviver), true, `true ${ note }`); assert.same(parse(0, reviver), 0, `0 ${ note }`); assert.same(parse(3.14, reviver), 3.14, `3.14 ${ note }`); assert.same(parse({ toString() { return '"string"'; }, valueOf() { return '"default_or_number"'; }, }, reviver), 'string', `text-object ${ note }`); assert.throws(() => parse({ toString: null, valueOf() { throw new EvalError('t262'); }, }, reviver), EvalError, `text-object-abrupt-1 ${ note }`); assert.throws(() => parse({ toString() { throw new EvalError('t262'); }, }, reviver), EvalError, `text-object-abrupt-2 ${ note }`); } // eslint-disable-next-line no-extend-native -- testing Array.prototype[1] = 3; const arr1 = parse('[1, 2]', function (key, value) { if (key === '0') delete this[1]; return value; }); delete Array.prototype[1]; assert.same(arr1[0], 1, 'reviver-array-get-prop-from-prototype-1'); assert.true(hasOwn(arr1, '1'), 'reviver-array-get-prop-from-prototype-2'); assert.same(arr1[1], 3, 'reviver-array-get-prop-from-prototype-3'); // eslint-disable-next-line no-extend-native -- testing Object.prototype.b = 3; const obj1 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') delete this.b; return value; }); delete Object.prototype.b; assert.same(obj1.a, 1, 'reviver-object-get-prop-from-prototype-1'); assert.true(hasOwn(obj1, 'b'), 'reviver-object-get-prop-from-prototype-2'); assert.same(obj1.b, 3, 'reviver-object-get-prop-from-prototype-3'); if (DESCRIPTORS) { const arr2 = parse('[1, 2]', function (key, value) { if (key === '0') defineProperty(this, '1', { configurable: false }); if (key === '1') return 22; return value; }); assert.same(arr2[0], 1, 'reviver-array-non-configurable-prop-create-1'); assert.same(arr2[1], 2, 'reviver-array-non-configurable-prop-create-2'); const arr3 = parse('[1, 2]', function (key, value) { if (key === '0') defineProperty(this, '1', { configurable: false }); if (key === '1') return; return value; }); assert.same(arr3[0], 1, 'reviver-array-non-configurable-prop-delete-1'); assert.true(hasOwn(arr3, '1'), 'reviver-array-non-configurable-prop-delete-2'); assert.same(arr3[1], 2, 'reviver-array-non-configurable-prop-delete-3'); const obj2 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') defineProperty(this, 'b', { configurable: false }); if (key === 'b') return 22; return value; }); assert.same(obj2.a, 1, 'reviver-object-non-configurable-prop-create-1'); assert.same(obj2.b, 2, 'reviver-object-non-configurable-prop-create-2'); const obj3 = parse('{"a": 1, "b": 2}', function (key, value) { if (key === 'a') defineProperty(this, 'b', { configurable: false }); if (key === 'b') return; return value; }); assert.same(obj3.a, 1, 'reviver-object-non-configurable-prop-delete-1'); assert.true(hasOwn(obj3, 'b'), 'reviver-object-non-configurable-prop-delete-2'); assert.same(obj3.b, 2, 'reviver-object-non-configurable-prop-delete-3'); assert.throws(() => parse('[0,0]', function () { defineProperty(this, '1', { get: () => { throw new EvalError('t262'); } }); }), EvalError, 'reviver-get-name-err'); } assert.throws(() => parse('0', () => { throw new EvalError('t262'); }), EvalError, 'reviver-call-err'); // FF20- enumeration order issue if (keys({ k: 1, 2: 3 })[0] === '2') { const calls = []; parse('{"p1":0,"p2":0,"p1":0,"2":0,"1":0}', (name, val) => { calls.push(name); return val; }); // The empty string is the _rootName_ in JSON.parse assert.arrayEqual(calls, ['1', '2', 'p1', 'p2', ''], 'reviver-call-order'); } assert.throws(() => parse(), SyntaxError, 'no args'); }); QUnit.test('JSON.parse source access', assert => { const spy = (k, v, { source: $source }) => source = $source; let source; parse('1234', spy); assert.same(source, '1234', '1234'); parse('"1234"', spy); assert.same(source, '"1234"', '"1234"'); parse('null', spy); assert.same(source, 'null', 'null'); parse('true', spy); assert.same(source, 'true', 'true'); parse('false', spy); assert.same(source, 'false', 'false'); parse('{}', spy); assert.same(source, undefined, '{}'); parse('[]', spy); assert.same(source, undefined, '[]'); parse('9007199254740993', spy); assert.same(source, '9007199254740993', '9007199254740993'); }); core-js-3.33.2/tests/unit-pure/esnext.json.raw-json.js000066400000000000000000000022501451776221300226200ustar00rootroot00000000000000import { FREEZING } from '../helpers/constants.js'; import rawJSON from 'core-js-pure/actual/json/raw-json'; import stringify from 'core-js-pure/actual/json/stringify'; import isFrozen from 'core-js-pure/es/object/is-frozen'; import hasOwn from 'core-js-pure/es/object/has-own'; QUnit.test('JSON.rawJSON', assert => { assert.isFunction(rawJSON); assert.arity(rawJSON, 1); assert.name(rawJSON, 'rawJSON'); const raw = rawJSON(1); assert.true(hasOwn(raw, 'rawJSON'), 'own rawJSON'); assert.same(raw.rawJSON, '1', 'is string 1'); if (FREEZING) assert.true(isFrozen(raw), 'frozen'); assert.same(stringify(rawJSON('"qwe"')), '"qwe"'); assert.same(stringify(rawJSON('null')), 'null'); assert.same(stringify(rawJSON('true')), 'true'); assert.same(stringify(rawJSON('9007199254740993')), '9007199254740993'); assert.same(stringify({ key: rawJSON('9007199254740993') }), '{"key":9007199254740993}'); assert.same(stringify([rawJSON('9007199254740993')]), '[9007199254740993]'); assert.throws(() => rawJSON('"qwe'), SyntaxError, 'invalid 1'); assert.throws(() => rawJSON({}), SyntaxError, 'invalid 2'); assert.throws(() => rawJSON(''), SyntaxError, 'invalid 3'); }); core-js-3.33.2/tests/unit-pure/esnext.map.delete-all.js000066400000000000000000000021021451776221300226700ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map#deleteAll', assert => { const { deleteAll } = Map.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.nonEnumerable(Map.prototype, 'deleteAll'); let set = new Map([[1, 2], [2, 3], [3, 4]]); assert.true(set.deleteAll(1, 2)); assert.deepEqual(from(set), [[3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.false(set.deleteAll(3, 4)); assert.deepEqual(from(set), [[1, 2], [2, 3]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.false(set.deleteAll(4, 5)); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.true(set.deleteAll()); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.emplace.js000066400000000000000000000036571451776221300223060ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#emplace', assert => { const { emplace } = Map.prototype; assert.isFunction(emplace); assert.arity(emplace, 2); assert.name(emplace, 'emplace'); assert.nonEnumerable(Map.prototype, 'emplace'); const map = new Map([['a', 2]]); let handler = { update(value, key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 'a', 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return value ** 2; }, insert() { assert.avoid(); }, }; assert.same(map.emplace('a', handler), 4, 'returns a correct value'); handler = { update() { assert.avoid(); }, insert(key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(key, 'b', 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return 3; }, }; assert.same(map.emplace('b', handler), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).emplace('b', { insert: () => 3 }), 3); assert.same(new Map([['a', 2]]).emplace('a', { update: value => value ** 2 }), 4); handler = { update() { /* empty */ }, insert() { /* empty */ } }; assert.throws(() => new Map().emplace('a'), TypeError); assert.throws(() => emplace.call({}, 'a', handler), TypeError); assert.throws(() => emplace.call([], 'a', handler), TypeError); assert.throws(() => emplace.call(undefined, 'a', handler), TypeError); assert.throws(() => emplace.call(null, 'a', handler), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.every.js000066400000000000000000000025231451776221300220210ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#every', assert => { const { every } = Map.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.nonEnumerable(Map.prototype, 'every'); let map = new Map([[9, 1]]); const context = {}; map.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, 2], [2, 3]]); assert.true(map.every(it => typeof it == 'number')); assert.true(map.every(it => it < 4)); assert.false(map.every(it => it < 3)); assert.false(map.every(it => typeof it == 'string')); assert.true(map.every(function () { return +this === 1; }, 1)); let result = ''; map.every((value, key) => result += key); assert.same(result, '012'); assert.true(map.every((value, key, that) => that === map)); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.filter.js000066400000000000000000000023771451776221300221630ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map#filter', assert => { const { filter } = Map.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.nonEnumerable(Map.prototype, 'filter'); const map = new Map([[1, 2]]); const context = {}; map.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).filter(it => typeof it == 'number')), [ ['a', 1], [1, 2], ['b', 3], [3, 4], [4, 5], ]); assert.true(new Map().filter(it => it) instanceof Map); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.find-key.js000066400000000000000000000020031451776221300223660ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#findKey', assert => { const { findKey } = Map.prototype; assert.isFunction(findKey); assert.arity(findKey, 1); assert.nonEnumerable(Map.prototype, 'findKey'); const set = new Map([[1, 2]]); const context = {}; set.findKey(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).findKey(it => it % 2), 2); assert.same(new Map().findKey(it => it === 42), undefined); assert.throws(() => findKey.call({}, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.find.js000066400000000000000000000017421451776221300216110ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#find', assert => { const { find } = Map.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(Map.prototype, 'find'); const set = new Map([[1, 2]]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).find(it => it % 2), 3); assert.same(new Map().find(it => it === 42), undefined); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.from.js000066400000000000000000000017551451776221300216400ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import toArray from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map.from', assert => { const { from } = Map; assert.isFunction(from); assert.arity(from, 1); assert.true(Map.from() instanceof Map); assert.deepEqual(toArray(Map.from([])), []); assert.deepEqual(toArray(Map.from([[1, 2]])), [[1, 2]]); assert.deepEqual(toArray(Map.from([[1, 2], [2, 3], [1, 4]])), [[1, 4], [2, 3]]); assert.deepEqual(toArray(Map.from(createIterable([[1, 2], [2, 3], [1, 4]]))), [[1, 4], [2, 3]]); const pair = [1, 2]; const context = {}; Map.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([1, 2])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-pure/esnext.map.group-by.js000066400000000000000000000015071451776221300224340ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map.groupBy', assert => { const { groupBy } = Map; assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.true(groupBy([], it => it) instanceof Map); assert.deepEqual(from(groupBy([], it => it)), []); assert.deepEqual(from(groupBy([1, 2], it => it ** 2)), [[1, [1]], [4, [2]]]); assert.deepEqual(from(groupBy([1, 2, 1], it => it ** 2)), [[1, [1, 1]], [4, [2]]]); assert.deepEqual(from(groupBy(createIterable([1, 2]), it => it ** 2)), [[1, [1]], [4, [2]]]); const element = {}; groupBy([element], function (it, i) { assert.same(arguments.length, 2); assert.same(it, element); assert.same(i, 0); }); }); core-js-3.33.2/tests/unit-pure/esnext.map.includes.js000066400000000000000000000014671451776221300225030ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#includes', assert => { const { includes } = Map.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.nonEnumerable(Map.prototype, 'includes'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.true(map.includes(1)); assert.true(map.includes(-0)); assert.true(map.includes(0)); assert.true(map.includes(object)); assert.false(map.includes(4)); assert.false(map.includes(-0.5)); assert.false(map.includes({})); assert.true(map.includes(NaN)); assert.throws(() => includes.call({}, 1), TypeError); assert.throws(() => includes.call(undefined, 1), TypeError); assert.throws(() => includes.call(null, 1), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.key-by.js000066400000000000000000000014311451776221300220640ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map.keyBy', assert => { const { keyBy } = Map; assert.isFunction(keyBy); assert.arity(keyBy, 2); assert.name(keyBy, 'keyBy'); assert.true(Map.keyBy([], it => it) instanceof Map); assert.deepEqual(from(Map.keyBy([], it => it)), []); assert.deepEqual(from(Map.keyBy([1, 2], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(from(Map.keyBy([1, 2, 1], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(from(Map.keyBy(createIterable([1, 2]), it => it ** 2)), [[1, 1], [4, 2]]); const element = {}; Map.keyBy([element], it => assert.same(it, element)); // assert.throws(() => keyBy([1, 2], it => it)); }); core-js-3.33.2/tests/unit-pure/esnext.map.key-of.js000066400000000000000000000014271451776221300220630ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#keyOf', assert => { const { keyOf } = Map.prototype; assert.isFunction(keyOf); assert.arity(keyOf, 1); assert.nonEnumerable(Map.prototype, 'keyOf'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.same(map.keyOf(1), 1); assert.same(map.keyOf(-0), 4); assert.same(map.keyOf(0), 4); assert.same(map.keyOf(object), 5); assert.same(map.keyOf(4), undefined); assert.same(map.keyOf(-0.5), undefined); assert.same(map.keyOf({}), undefined); assert.same(map.keyOf(NaN), undefined); assert.throws(() => keyOf.call({}, 1), TypeError); assert.throws(() => keyOf.call(undefined, 1), TypeError); assert.throws(() => keyOf.call(null, 1), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.map-keys.js000066400000000000000000000025441451776221300224200ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map#mapKeys', assert => { const { mapKeys } = Map.prototype; assert.isFunction(mapKeys); assert.arity(mapKeys, 1); assert.name(mapKeys, 'mapKeys'); assert.nonEnumerable(Map.prototype, 'mapKeys'); const map = new Map([[1, 2]]); const context = {}; map.mapKeys(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Map().mapKeys(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapKeys((value, key) => `${ key }${ value }`)), [ ['a1', 1], ['12', 2], ['b3', 3], ['2q', 'q'], ['c[object Object]', {}], ['34', 4], ['dtrue', true], ['45', 5], ]); assert.throws(() => mapKeys.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.map-values.js000066400000000000000000000026001451776221300227350ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map#mapValues', assert => { const { mapValues } = Map.prototype; assert.isFunction(mapValues); assert.arity(mapValues, 1); assert.name(mapValues, 'mapValues'); assert.nonEnumerable(Map.prototype, 'mapValues'); const map = new Map([[1, 2]]); const context = {}; map.mapValues(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Map().mapValues(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapValues((value, key) => `${ key }${ value }`)), [ ['a', 'a1'], [1, '12'], ['b', 'b3'], [2, '2q'], ['c', 'c[object Object]'], [3, '34'], ['d', 'dtrue'], [4, '45'], ]); assert.throws(() => mapValues.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.merge.js000066400000000000000000000017641451776221300217740ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map#merge', assert => { const { merge } = Map.prototype; assert.isFunction(merge); assert.arity(merge, 1); assert.name(merge, 'merge'); assert.nonEnumerable(Map.prototype, 'merge'); const map = new Map([[1, 2]]); const result = map.merge([[3, 4]]); assert.same(result, map); assert.true(result instanceof Map); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[5, 6]])), [[1, 2], [3, 4], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5], [5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([])), [[1, 2], [3, 4]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5]], [[5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.throws(() => merge.call({}, [[1, 2]]), TypeError); assert.throws(() => merge.call(undefined, [[1, 2]]), TypeError); assert.throws(() => merge.call(null, [[1, 2]]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.of.js000066400000000000000000000010031451776221300212630ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Map from 'core-js-pure/full/map'; QUnit.test('Map.of', assert => { const { of } = Map; assert.isFunction(of); assert.arity(of, 0); assert.true(Map.of() instanceof Map); assert.deepEqual(from(Map.of([1, 2])), [[1, 2]]); assert.deepEqual(from(Map.of([1, 2], [2, 3], [1, 4])), [[1, 4], [2, 3]]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-pure/esnext.map.reduce.js000066400000000000000000000034301451776221300221340ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#reduce', assert => { const { reduce } = Map.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.nonEnumerable(Map.prototype, 'reduce'); const set = new Map([['a', 1]]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 'a', 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Map([ ['a', 1], ['b', 2], ]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 'b', 'correct start index without initial accumulator'); }); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((memo, value, key, s) => { s.delete('b'); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, 'ac', 'correct order #2'); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.some.js000066400000000000000000000025401451776221300216310ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#some', assert => { const { some } = Map.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.nonEnumerable(Map.prototype, 'some'); let map = new Map([[9, 1]]); const context = {}; map.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, '2'], [2, 3]]); assert.true(map.some(it => typeof it == 'number')); assert.true(map.some(it => it < 3)); assert.false(map.some(it => it < 0)); assert.true(map.some(it => typeof it == 'string')); assert.false(map.some(function () { return +this !== 1; }, 1)); let result = ''; map.some((value, key) => { result += key; return false; }); assert.same(result, '012'); assert.true(map.some((value, key, that) => that === map)); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.update-or-insert.js000066400000000000000000000031721451776221300240720ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#updateOrInsert', assert => { const { updateOrInsert } = Map.prototype; assert.isFunction(updateOrInsert); assert.arity(updateOrInsert, 2); assert.nonEnumerable(Map.prototype, 'updateOrInsert'); const map = new Map([['a', 2]]); assert.same(map.updateOrInsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.updateOrInsert('b', value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).updateOrInsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).updateOrInsert('a', value => value ** 2), 4); assert.throws(() => new Map().updateOrInsert('a'), TypeError); assert.throws(() => updateOrInsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.update.js000066400000000000000000000035641451776221300221570ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#update', assert => { const { update } = Map.prototype; assert.isFunction(update); assert.arity(update, 2); assert.name(update, 'update'); assert.nonEnumerable(Map.prototype, 'update'); let map = new Map([[9, 2]]); assert.same(map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }), map, 'returns this'); assert.same(map.size, 1, 'correct size'); assert.same(map.get(9), 4, 'correct result'); map = new Map([[4, 5]]); map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }, function (key, that) { assert.same(arguments.length, 2, 'correct number of thunk arguments'); assert.same(key, 9, 'correct key in thunk'); assert.same(that, map, 'correct link to map in thunk'); return 2; }); assert.same(map.size, 2, 'correct size'); assert.same(map.get(4), 5, 'correct result #1'); assert.same(map.get(9), 4, 'correct result #2'); assert.throws(() => new Map([[9, 2]]).update(9), TypeError); assert.throws(() => new Map().update(9, () => { /* empty */ }), TypeError); assert.throws(() => update.call({}, () => { /* empty */ }), TypeError); assert.throws(() => update.call([], () => { /* empty */ }), TypeError); assert.throws(() => update.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => update.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.map.upsert.js000066400000000000000000000030121451776221300222030ustar00rootroot00000000000000import Map from 'core-js-pure/full/map'; QUnit.test('Map#upsert', assert => { const { upsert } = Map.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.nonEnumerable(Map.prototype, 'upsert'); const map = new Map([['a', 2]]); assert.same(map.upsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert('b', value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).upsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).upsert('a', value => value ** 2), 4); assert.throws(() => new Map().upsert('a'), TypeError); assert.throws(() => upsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.math.clamp.js000066400000000000000000000016211451776221300221350ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import clamp from 'core-js-pure/full/math/clamp'; QUnit.test('Math.clamp', assert => { assert.isFunction(clamp); assert.arity(clamp, 3); assert.same(clamp(2, 4, 6), 4); assert.same(clamp(4, 2, 6), 4); assert.same(clamp(6, 2, 4), 4); const checker1 = createConversionChecker(2); const checker2 = createConversionChecker(4); const checker3 = createConversionChecker(5); assert.same(clamp(checker1, checker2, checker3), 4, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.deg-per-rad.js000066400000000000000000000002551451776221300231320ustar00rootroot00000000000000import DEG_PER_RAD from 'core-js-pure/full/math/deg-per-rad'; QUnit.test('Math.DEG_PER_RAD', assert => { assert.same(DEG_PER_RAD, Math.PI / 180, 'Is Math.PI / 180'); }); core-js-3.33.2/tests/unit-pure/esnext.math.degrees.js000066400000000000000000000011321451776221300224540ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import degrees from 'core-js-pure/full/math/degrees'; QUnit.test('Math.degrees', assert => { assert.isFunction(degrees); assert.arity(degrees, 1); assert.same(degrees(0), 0); assert.same(degrees(Math.PI / 2), 90); assert.same(degrees(Math.PI), 180); assert.same(degrees(3 * Math.PI / 2), 270); const checker = createConversionChecker(3 * Math.PI / 2); assert.same(degrees(checker), 270, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.f16round.js000066400000000000000000000034261451776221300225120ustar00rootroot00000000000000// some asserts based on https://github.com/petamoriken/float16/blob/master/test/f16round.js import { createConversionChecker } from '../helpers/helpers.js'; import f16round from 'core-js-pure/actual/math/f16round'; const { MAX_VALUE, MIN_VALUE } = Number; QUnit.test('Math.f16round', assert => { assert.isFunction(f16round); assert.name(f16round, 'f16round'); assert.arity(f16round, 1); assert.same(f16round(), NaN); assert.same(f16round(undefined), NaN); assert.same(f16round(NaN), NaN); assert.same(f16round(null), 0); assert.same(f16round(0), 0); assert.same(f16round(-0), -0); assert.same(f16round(MIN_VALUE), 0); assert.same(f16round(-MIN_VALUE), -0); assert.same(f16round(Infinity), Infinity); assert.same(f16round(-Infinity), -Infinity); assert.same(f16round(MAX_VALUE), Infinity); assert.same(f16round(-MAX_VALUE), -Infinity); const MAX_FLOAT16 = 65504; const MIN_FLOAT16 = 2 ** -24; assert.same(f16round(MAX_FLOAT16), MAX_FLOAT16); assert.same(f16round(-MAX_FLOAT16), -MAX_FLOAT16); assert.same(f16round(MIN_FLOAT16), MIN_FLOAT16); assert.same(f16round(-MIN_FLOAT16), -MIN_FLOAT16); assert.same(f16round(MIN_FLOAT16 / 2), 0); assert.same(f16round(-MIN_FLOAT16 / 2), -0); assert.same(f16round(2.980232238769531911744490042422139897126953655970282852649688720703125e-8), MIN_FLOAT16); assert.same(f16round(-2.980232238769531911744490042422139897126953655970282852649688720703125e-8), -MIN_FLOAT16); assert.same(f16round(1.337), 1.3369140625); assert.same(f16round(0.499994), 0.5); assert.same(f16round(7.9999999), 8); const checker = createConversionChecker(1.1); assert.same(f16round(checker), 1.099609375, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.fscale.js000066400000000000000000000025211451776221300222760ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import fscale from 'core-js-pure/full/math/fscale'; QUnit.test('Math.fscale', assert => { assert.isFunction(fscale); assert.arity(fscale, 5); assert.same(fscale(3, 1, 2, 1, 2), 3); assert.same(fscale(0, 3, 5, 8, 10), 5); assert.same(fscale(1, 1, 1, 1, 1), NaN); assert.same(fscale(-1, -1, -1, -1, -1), NaN); const checker1 = createConversionChecker(3); const checker2 = createConversionChecker(1); const checker3 = createConversionChecker(2); const checker4 = createConversionChecker(1); const checker5 = createConversionChecker(2); assert.same(fscale(checker1, checker2, checker3, checker4, checker5), 3, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); assert.same(checker5.$valueOf, 1, 'checker5 valueOf calls'); assert.same(checker5.$toString, 0, 'checker5 toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.iaddh.js000066400000000000000000000005351451776221300221150ustar00rootroot00000000000000import iaddh from 'core-js-pure/full/math/iaddh'; QUnit.test('Math.iaddh', assert => { assert.isFunction(iaddh); assert.arity(iaddh, 4); assert.same(iaddh(0, 2, 1, 0), 2); assert.same(iaddh(0, 4, 1, 1), 5); assert.same(iaddh(2, 4, 1, 1), 5); assert.same(iaddh(0xFFFFFFFF, 4, 1, 1), 6); assert.same(iaddh(1, 4, 0xFFFFFFFF, 1), 6); }); core-js-3.33.2/tests/unit-pure/esnext.math.imulh.js000066400000000000000000000004431451776221300221600ustar00rootroot00000000000000import imulh from 'core-js-pure/full/math/imulh'; QUnit.test('Math.imulh', assert => { assert.isFunction(imulh); assert.arity(imulh, 2); assert.same(imulh(0xFFFFFFFF, 7), -1); assert.same(imulh(0xFFFFFFF, 77), 4); assert.same(imulh(1, 7), 0); assert.same(imulh(-1, 7), -1); }); core-js-3.33.2/tests/unit-pure/esnext.math.isubh.js000066400000000000000000000005351451776221300221560ustar00rootroot00000000000000import isubh from 'core-js-pure/full/math/isubh'; QUnit.test('Math.isubh', assert => { assert.isFunction(isubh); assert.arity(isubh, 4); assert.same(isubh(0, 2, 1, 0), 1); assert.same(isubh(0, 4, 1, 1), 2); assert.same(isubh(2, 4, 1, 1), 3); assert.same(isubh(0xFFFFFFFF, 4, 1, 1), 3); assert.same(isubh(1, 4, 0xFFFFFFFF, 1), 2); }); core-js-3.33.2/tests/unit-pure/esnext.math.rad-per-deg.js000066400000000000000000000002551451776221300231320ustar00rootroot00000000000000import RAD_PER_DEG from 'core-js-pure/full/math/rad-per-deg'; QUnit.test('Math.RAD_PER_DEG', assert => { assert.same(RAD_PER_DEG, 180 / Math.PI, 'Is 180 / Math.PI'); }); core-js-3.33.2/tests/unit-pure/esnext.math.radians.js000066400000000000000000000011321451776221300224570ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import radians from 'core-js-pure/full/math/radians'; QUnit.test('Math.radians', assert => { assert.isFunction(radians); assert.arity(radians, 1); assert.same(radians(0), 0); assert.same(radians(90), Math.PI / 2); assert.same(radians(180), Math.PI); assert.same(radians(270), 3 * Math.PI / 2); const checker = createConversionChecker(270); assert.same(radians(checker), 3 * Math.PI / 2, 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.scale.js000066400000000000000000000025071451776221300221340ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import scale from 'core-js-pure/full/math/scale'; QUnit.test('Math.scale', assert => { assert.isFunction(scale); assert.arity(scale, 5); assert.same(scale(3, 1, 2, 1, 2), 3); assert.same(scale(0, 3, 5, 8, 10), 5); assert.same(scale(1, 1, 1, 1, 1), NaN); assert.same(scale(-1, -1, -1, -1, -1), NaN); const checker1 = createConversionChecker(3); const checker2 = createConversionChecker(1); const checker3 = createConversionChecker(2); const checker4 = createConversionChecker(1); const checker5 = createConversionChecker(2); assert.same(scale(checker1, checker2, checker3, checker4, checker5), 3, 'object wrapper'); assert.same(checker1.$valueOf, 1, 'checker1 valueOf calls'); assert.same(checker1.$toString, 0, 'checker1 toString calls'); assert.same(checker2.$valueOf, 1, 'checker2 valueOf calls'); assert.same(checker2.$toString, 0, 'checker2 toString calls'); assert.same(checker3.$valueOf, 1, 'checker3 valueOf calls'); assert.same(checker3.$toString, 0, 'checker3 toString calls'); assert.same(checker4.$valueOf, 1, 'checker4 valueOf calls'); assert.same(checker4.$toString, 0, 'checker4 toString calls'); assert.same(checker5.$valueOf, 1, 'checker5 valueOf calls'); assert.same(checker5.$toString, 0, 'checker5 toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.seeded-prng.js000066400000000000000000000023761451776221300232460ustar00rootroot00000000000000import seededPRNG from 'core-js-pure/full/math/seeded-prng'; QUnit.test('Math.seededPRNG', assert => { assert.isFunction(seededPRNG); assert.arity(seededPRNG, 1); for (const gen of [seededPRNG({ seed: 42 }), seededPRNG({ seed: 42 })]) { assert.deepEqual(gen.next(), { value: 0.16461519912315087, done: false }); assert.deepEqual(gen.next(), { value: 0.2203933906000046, done: false }); assert.deepEqual(gen.next(), { value: 0.8249682894209105, done: false }); assert.deepEqual(gen.next(), { value: 0.10750079537509083, done: false }); assert.deepEqual(gen.next(), { value: 0.004673248161257476, done: false }); } for (const gen of [seededPRNG({ seed: 43 }), seededPRNG({ seed: 43 })]) { assert.deepEqual(gen.next(), { value: 0.1923438591811283, done: false }); assert.deepEqual(gen.next(), { value: 0.7896811578326683, done: false }); assert.deepEqual(gen.next(), { value: 0.9518230761883996, done: false }); assert.deepEqual(gen.next(), { value: 0.1414634102410296, done: false }); assert.deepEqual(gen.next(), { value: 0.7379838030207752, done: false }); } assert.throws(() => seededPRNG(), TypeError); assert.throws(() => seededPRNG(5), TypeError); assert.throws(() => seededPRNG({ seed: null }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.math.signbit.js000066400000000000000000000013561451776221300225050ustar00rootroot00000000000000import { createConversionChecker } from '../helpers/helpers.js'; import signbit from 'core-js-pure/full/math/signbit'; QUnit.test('Math.signbit', assert => { assert.isFunction(signbit); assert.false(signbit(NaN)); assert.false(signbit()); assert.true(signbit(-0)); assert.false(signbit(0)); assert.false(signbit(Infinity)); assert.true(signbit(-Infinity)); assert.false(signbit(13510798882111488)); assert.true(signbit(-13510798882111488)); assert.false(signbit(42.5)); assert.true(signbit(-42.5)); const checker = createConversionChecker(-13510798882111488); assert.true(signbit(checker), 'object wrapper'); assert.same(checker.$valueOf, 1, 'valueOf calls'); assert.same(checker.$toString, 0, 'toString calls'); }); core-js-3.33.2/tests/unit-pure/esnext.math.umulh.js000066400000000000000000000004411451776221300221720ustar00rootroot00000000000000import umulh from 'core-js-pure/full/math/umulh'; QUnit.test('Math.umulh', assert => { assert.isFunction(umulh); assert.arity(umulh, 2); assert.same(umulh(0xFFFFFFFF, 7), 6); assert.same(umulh(0xFFFFFFF, 77), 4); assert.same(umulh(1, 7), 0); assert.same(umulh(-1, 7), 6); }); core-js-3.33.2/tests/unit-pure/esnext.number.from-string.js000066400000000000000000000044231451776221300236520ustar00rootroot00000000000000import fromString from 'core-js-pure/full/number/from-string'; QUnit.test('Number.fromString', assert => { assert.isFunction(fromString); assert.name(fromString, 'fromString'); assert.arity(fromString, 2); assert.throws(() => fromString(undefined), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(Object('10')), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(''), SyntaxError, 'Empty string'); assert.same(fromString('-10', 2), -2, 'Works with negative numbers'); assert.throws(() => fromString('-'), SyntaxError, '-'); assert.same(fromString('10'), 10, 'Default radix is 10 #1'); assert.same(fromString('10', undefined), 10, 'Default radix is 10 #2'); for (let radix = 2; radix <= 36; ++radix) { assert.same(fromString('10', radix), radix, `Radix ${ radix }`); } assert.throws(() => fromString('10', -4294967294), RangeError, 'Radix uses ToInteger #1'); assert.same(fromString('10', 2.5), 2, 'Radix uses ToInteger #2'); assert.same(fromString('42'), 42); assert.same(fromString('42', 10), 42); assert.same(fromString('3.14159', 10), 3.14159); assert.same(fromString('-100.11', 2), -4.75); assert.same(fromString('202.1', 3), 20.333333333333332); assert.same(fromString('0'), 0); assert.same(fromString('0', 2), 0); assert.same(fromString('-0'), -0); assert.same(fromString('-0', 2), -0); assert.throws(() => fromString('0xc0ffee'), SyntaxError); assert.throws(() => fromString('0o755'), SyntaxError); assert.throws(() => fromString('0b00101010'), SyntaxError); assert.throws(() => fromString('C0FFEE', 16), SyntaxError); assert.same(fromString('c0ffee', 16), 12648430); assert.same(fromString('755', 8), 493); assert.throws(() => fromString(''), SyntaxError); assert.throws(() => fromString(' '), SyntaxError); assert.throws(() => fromString(' 1'), SyntaxError); assert.throws(() => fromString(' \n '), SyntaxError); assert.throws(() => fromString('x'), SyntaxError); assert.throws(() => fromString('1234', 0), RangeError); assert.throws(() => fromString('1234', 1), RangeError); assert.throws(() => fromString('1234', 37), RangeError); assert.throws(() => fromString('010'), SyntaxError); assert.throws(() => fromString('1_000_000_000'), SyntaxError); }); core-js-3.33.2/tests/unit-pure/esnext.number.range.js000066400000000000000000000044451451776221300225030ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import range from 'core-js-pure/full/number/range'; QUnit.test('range', assert => { assert.isFunction(range); assert.name(range, 'range'); assert.arity(range, 3); let iterator = range(1, 2); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.deepEqual(from(range(-1, 5)), [-1, 0, 1, 2, 3, 4]); assert.deepEqual(from(range(-5, 1)), [-5, -4, -3, -2, -1, 0]); assert.deepEqual( from(range(0, 1, 0.1)), [0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8, 0.9], ); assert.deepEqual( from(range(2 ** 53 - 1, 2 ** 53, { inclusive: true })), [9007199254740991, 9007199254740992], ); assert.deepEqual(from(range(0, 0)), []); assert.deepEqual(from(range(0, -5, 1)), []); assert.deepEqual(from(range(NaN, 0)), []); assert.deepEqual(from(range(0, NaN)), []); assert.deepEqual(from(range(NaN, NaN)), []); assert.deepEqual(from(range(0, 0, { step: NaN })), []); assert.deepEqual(from(range(0, 5, NaN)), []); iterator = range(1, 3); assert.deepEqual(iterator.start, 1); assert.deepEqual(iterator.end, 3); assert.deepEqual(iterator.step, 1); assert.false(iterator.inclusive); iterator = range(-1, -3, { inclusive: true }); assert.deepEqual(iterator.start, -1); assert.deepEqual(iterator.end, -3); assert.same(iterator.step, -1); assert.true(iterator.inclusive); iterator = range(-1, -3, { step: 4, inclusive() { /* empty */ } }); assert.same(iterator.start, -1); assert.same(iterator.end, -3); assert.same(iterator.step, 4); assert.true(iterator.inclusive); iterator = range(0, 5); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe assert.throws(() => Object.getOwnPropertyDescriptor(iterator, 'start').get.call({}), TypeError); assert.throws(() => range(Infinity, 10, 0), RangeError); assert.throws(() => range(-Infinity, 10, 0), RangeError); assert.throws(() => range(0, 10, Infinity), RangeError); assert.throws(() => range(0, 10, { step: Infinity }), RangeError); assert.throws(() => range({}, 1), TypeError); assert.throws(() => range(1, {}), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.object.group-by.js000066400000000000000000000016531451776221300231270ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import groupBy from 'core-js-pure/actual/object/group-by'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import entries from 'core-js-pure/es/object/entries'; QUnit.test('Object.groupBy', assert => { assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.same(getPrototypeOf(groupBy([], it => it)), null); assert.deepEqual(entries(groupBy([], it => it)), []); assert.deepEqual(entries(groupBy([1, 2], it => it ** 2)), [['1', [1]], ['4', [2]]]); assert.deepEqual(entries(groupBy([1, 2, 1], it => it ** 2)), [['1', [1, 1]], ['4', [2]]]); assert.deepEqual(entries(groupBy(createIterable([1, 2]), it => it ** 2)), [['1', [1]], ['4', [2]]]); const element = {}; groupBy([element], function (it, i) { assert.same(arguments.length, 2); assert.same(it, element); assert.same(i, 0); }); }); core-js-3.33.2/tests/unit-pure/esnext.object.iterate-entries.js000066400000000000000000000014131451776221300244610ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import iterateEntries from 'core-js-pure/full/object/iterate-entries'; QUnit.test('Object.iterateEntries', assert => { assert.isFunction(iterateEntries); assert.name(iterateEntries, 'iterateEntries'); assert.arity(iterateEntries, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateEntries(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 1], done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: ['e', 3], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/esnext.object.iterate-keys.js000066400000000000000000000013511451776221300237640ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import iterateKeys from 'core-js-pure/full/object/iterate-keys'; QUnit.test('Object.iterateKeys', assert => { assert.isFunction(iterateKeys); assert.name(iterateKeys, 'iterateKeys'); assert.arity(iterateKeys, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateKeys(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/esnext.object.iterate-values.js000066400000000000000000000013651451776221300243150ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import iterateValues from 'core-js-pure/full/object/iterate-values'; QUnit.test('Object.iterateValues', assert => { assert.isFunction(iterateValues); assert.name(iterateValues, 'iterateValues'); assert.arity(iterateValues, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateValues(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 3, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.33.2/tests/unit-pure/esnext.observable.constructor.js000066400000000000000000000033421451776221300246230ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import Symbol from 'core-js-pure/full/symbol'; import Observable from 'core-js-pure/full/observable'; QUnit.test('Observable', assert => { assert.isFunction(Observable); assert.arity(Observable, 1); assert.throws(() => Observable(() => { /* empty */ }), 'throws w/o `new`'); const observable = new Observable(function (subscriptionObserver) { assert.same(typeof subscriptionObserver, 'object', 'Subscription observer is object'); assert.same(subscriptionObserver.constructor, Object); const { next, error, complete } = subscriptionObserver; assert.isFunction(next); assert.isFunction(error); assert.isFunction(complete); assert.arity(next, 1); assert.arity(error, 1); assert.arity(complete, 0); if (STRICT) { assert.same(this, undefined, 'correct executor context'); } }); observable.subscribe({}); assert.true(observable instanceof Observable); }); QUnit.test('Observable#subscribe', assert => { assert.isFunction(Observable.prototype.subscribe); assert.arity(Observable.prototype.subscribe, 1); const subscription = new Observable(() => { /* empty */ }).subscribe({}); assert.same(typeof subscription, 'object', 'Subscription is object'); assert.same(subscription.constructor, Object); assert.isFunction(subscription.unsubscribe); assert.arity(subscription.unsubscribe, 0); }); QUnit.test('Observable#constructor', assert => { assert.same(Observable.prototype.constructor, Observable); }); QUnit.test('Observable#@@observable', assert => { assert.isFunction(Observable.prototype[Symbol.observable]); const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); core-js-3.33.2/tests/unit-pure/esnext.observable.from.js000066400000000000000000000002601451776221300231750ustar00rootroot00000000000000import Observable from 'core-js-pure/full/observable'; QUnit.test('Observable.from', assert => { assert.isFunction(Observable.from); assert.arity(Observable.from, 1); }); core-js-3.33.2/tests/unit-pure/esnext.observable.of.js000066400000000000000000000002521451776221300226370ustar00rootroot00000000000000import Observable from 'core-js-pure/full/observable'; QUnit.test('Observable.of', assert => { assert.isFunction(Observable.of); assert.arity(Observable.of, 0); }); core-js-3.33.2/tests/unit-pure/esnext.promise.try.js000066400000000000000000000011361451776221300224050ustar00rootroot00000000000000import Promise from 'core-js-pure/full/promise'; QUnit.test('Promise.try', assert => { assert.isFunction(Promise.try); assert.arity(Promise.try, 1); assert.true(Promise.try(() => 42) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.try, resolved', assert => { return Promise.try(() => 42).then(it => { assert.same(it, 42, 'resolved with a correct value'); }); }); QUnit.test('Promise.try, rejected', assert => { return Promise.try(() => { throw new Error(); }).then(() => { assert.avoid(); }, () => { assert.true(true, 'rejected as expected'); }); }); core-js-3.33.2/tests/unit-pure/esnext.promise.with-resolvers.js000066400000000000000000000033311451776221300245630ustar00rootroot00000000000000import Promise from 'core-js-pure/full/promise'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; QUnit.test('Promise.withResolvers', assert => { const { withResolvers } = Promise; assert.isFunction(withResolvers); assert.arity(withResolvers, 0); assert.name(withResolvers, 'withResolvers'); const d1 = Promise.withResolvers(); assert.same(getPrototypeOf(d1), Object.prototype, 'proto is Object.prototype'); assert.true(d1.promise instanceof Promise, 'promise is promise'); assert.isFunction(d1.resolve, 'resolve is function'); assert.isFunction(d1.reject, 'reject is function'); const promise = {}; const resolve = () => { /* empty */ }; let reject = () => { /* empty */ }; function P(exec) { exec(resolve, reject); return promise; } const d2 = withResolvers.call(P); assert.same(d2.promise, promise, 'promise is promise #2'); assert.same(d2.resolve, resolve, 'resolve is resolve #2'); assert.same(d2.reject, reject, 'reject is reject #2'); reject = {}; assert.throws(() => withResolvers.call(P), TypeError, 'broken resolver'); assert.throws(() => withResolvers.call({}), TypeError, 'broken constructor #1'); assert.throws(() => withResolvers.call(null), TypeError, 'broken constructor #2'); }); QUnit.test('Promise.withResolvers, resolve', assert => { const d = Promise.withResolvers(); d.resolve(42); return d.promise.then(it => { assert.same(it, 42, 'resolved as expected'); }, () => { assert.avoid(); }); }); QUnit.test('Promise.withResolvers, reject', assert => { const d = Promise.withResolvers(); d.reject(42); return d.promise.then(() => { assert.avoid(); }, error => { assert.same(error, 42, 'rejected as expected'); }); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.define-metadata.js000066400000000000000000000006551451776221300245520ustar00rootroot00000000000000import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; QUnit.test('Reflect.defineMetadata', assert => { assert.isFunction(defineMetadata); assert.arity(defineMetadata, 3); assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); assert.same(defineMetadata('key', 'value', {}, undefined), undefined); assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.delete-metadata.js000066400000000000000000000017221451776221300245560ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import hasOwnMetadata from 'core-js-pure/full/reflect/has-own-metadata'; import deleteMetadata from 'core-js-pure/full/reflect/delete-metadata'; QUnit.test('Reflect.deleteMetadata', assert => { assert.isFunction(deleteMetadata); assert.arity(deleteMetadata, 2); assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); assert.false(deleteMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(deleteMetadata('key', object, undefined)); const prototype = {}; defineMetadata('key', 'value', prototype, undefined); assert.false(deleteMetadata('key', create(prototype), undefined)); object = {}; defineMetadata('key', 'value', object, undefined); deleteMetadata('key', object, undefined); assert.false(hasOwnMetadata('key', object, undefined)); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.get-metadata-keys.js000066400000000000000000000045301451776221300250440ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import getMetadataKeys from 'core-js-pure/full/reflect/get-metadata-keys'; QUnit.test('Reflect.getMetadataKeys', assert => { assert.isFunction(getMetadataKeys); assert.arity(getMetadataKeys, 1); assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); object = {}; assert.deepEqual(getMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.get-metadata.js000066400000000000000000000021101451776221300240630ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import getMetadata from 'core-js-pure/full/reflect/get-metadata'; QUnit.test('Reflect.getMetadata', assert => { assert.isFunction(getMetadata); assert.arity(getMetadata, 2); assert.throws(() => getMetadata('key', undefined, undefined), TypeError); assert.same(getMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getMetadata('key', object, undefined), 'value'); assert.same(getMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.get-own-matadata.js000066400000000000000000000021611451776221300246660ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import getOwnMetadata from 'core-js-pure/full/reflect/get-own-metadata'; QUnit.test('Reflect.getOwnMetadata', assert => { assert.isFunction(getOwnMetadata); assert.arity(getOwnMetadata, 2); assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); assert.same(getOwnMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getOwnMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getOwnMetadata('key', object, undefined), undefined); assert.same(getOwnMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getOwnMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getOwnMetadata('key', object, 'name'), undefined); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.get-own-metadata-keys.js000066400000000000000000000045621451776221300256520ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import getOwnMetadataKeys from 'core-js-pure/full/reflect/get-own-metadata-keys'; QUnit.test('Reflect.getOwnMetadataKeys', assert => { assert.isFunction(getOwnMetadataKeys); assert.arity(getOwnMetadataKeys, 1); assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getOwnMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), []); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.has-metadata.js000066400000000000000000000020201451776221300240570ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import hasMetadata from 'core-js-pure/full/reflect/has-metadata'; QUnit.test('Reflect.hasMetadata', assert => { assert.isFunction(hasMetadata); assert.arity(hasMetadata, 2); assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); assert.false(hasMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(hasMetadata('key', object, undefined)); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.true(hasMetadata('key', object, undefined)); assert.false(hasMetadata('key', {}, 'name')); object = {}; defineMetadata('key', 'value', object, 'name'); assert.true(hasMetadata('key', object, 'name')); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.true(hasMetadata('key', object, 'name')); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.has-own-metadata.js000066400000000000000000000020671451776221300246730ustar00rootroot00000000000000import create from 'core-js-pure/full/object/create'; import defineMetadata from 'core-js-pure/full/reflect/define-metadata'; import hasOwnMetadata from 'core-js-pure/full/reflect/has-own-metadata'; QUnit.test('Reflect.hasOwnMetadata', assert => { assert.isFunction(hasOwnMetadata); assert.arity(hasOwnMetadata, 2); assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); assert.false(hasOwnMetadata('key', {}, undefined)); let object = {}; defineMetadata('key', 'value', object, undefined); assert.true(hasOwnMetadata('key', object, undefined)); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.false(hasOwnMetadata('key', object, undefined)); assert.false(hasOwnMetadata('key', {}, 'name')); object = {}; defineMetadata('key', 'value', object, 'name'); assert.true(hasOwnMetadata('key', object, 'name')); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.false(hasOwnMetadata('key', object, 'name')); }); core-js-3.33.2/tests/unit-pure/esnext.reflect.metadata.js000066400000000000000000000011511451776221300233120ustar00rootroot00000000000000import hasOwnMetadata from 'core-js-pure/full/reflect/has-own-metadata'; import metadata from 'core-js-pure/full/reflect/metadata'; QUnit.test('Reflect.metadata', assert => { assert.isFunction(metadata); assert.arity(metadata, 2); assert.isFunction(metadata('key', 'value')); const decorator = metadata('key', 'value'); assert.throws(() => decorator(undefined, 'name'), TypeError); let target = function () { /* empty */ }; decorator(target); assert.true(hasOwnMetadata('key', target, undefined)); target = {}; decorator(target, 'name'); assert.true(hasOwnMetadata('key', target, 'name')); }); core-js-3.33.2/tests/unit-pure/esnext.regexp.escape.js000066400000000000000000000017331451776221300226460ustar00rootroot00000000000000import escape from 'core-js-pure/full/regexp/escape'; import Symbol from 'core-js-pure/es/symbol'; import { createConversionChecker } from '../helpers/helpers.js'; QUnit.test('RegExp.escape', assert => { assert.isFunction(escape); assert.arity(escape, 1); assert.name(escape, 'escape'); assert.same(escape('10$'), '\\x310\\$', '10$'); assert.same(escape('abcdefg_123456'), 'abcdefg_123456', 'abcdefg_123456'); assert.same( escape('(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`'), '\\(\\)\\{\\}\\[\\]\\|\\,\\.\\?\\*\\+\\-\\^\\$\\=\\<\\>\\\\\\/\\#\\&\\!\\%\\:\\;\\@\\~\\\'\\"\\`', '(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`', ); const checker = createConversionChecker('10$'); assert.same(escape(checker), '\\x310\\$', 'checker result'); assert.same(checker.$valueOf, 0, 'checker valueOf calls'); assert.same(checker.$toString, 1, 'checker toString calls'); if (!Symbol.sham) { assert.throws(() => escape(Symbol('thrower')), TypeError, 'throws on symbol'); } }); core-js-3.33.2/tests/unit-pure/esnext.set.add-all.js000066400000000000000000000015171451776221300222050ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#addAll', assert => { const { addAll } = Set.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.nonEnumerable(Set.prototype, 'addAll'); const set = new Set([1]); assert.same(set.addAll(2), set); assert.deepEqual(from(new Set([1, 2, 3]).addAll(4, 5)), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).addAll(3, 4)), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).addAll()), [1, 2, 3]); assert.throws(() => addAll.call({ add() { /* empty */ } }, 1, 2, 3)); assert.throws(() => addAll.call({}, 1, 2, 3), TypeError); assert.throws(() => addAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => addAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.delete-all.js000066400000000000000000000020001451776221300227030ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#deleteAll', assert => { const { deleteAll } = Set.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.nonEnumerable(Set.prototype, 'deleteAll'); let set = new Set([1, 2, 3]); assert.true(set.deleteAll(1, 2)); assert.deepEqual(from(set), [3]); set = new Set([1, 2, 3]); assert.false(set.deleteAll(3, 4)); assert.deepEqual(from(set), [1, 2]); set = new Set([1, 2, 3]); assert.false(set.deleteAll(4, 5)); assert.deepEqual(from(set), [1, 2, 3]); set = new Set([1, 2, 3]); assert.true(set.deleteAll()); assert.deepEqual(from(set), [1, 2, 3]); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.difference.js000066400000000000000000000025361451776221300230030ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#difference', assert => { const { difference } = Set.prototype; assert.isFunction(difference); assert.arity(difference, 1); assert.name(difference, 'difference'); assert.nonEnumerable(Set.prototype, 'difference'); const set = new Set([1]); assert.notSame(set.difference(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).difference(new Set([4, 5]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference(new Set([3, 4]))), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createSetLike([3, 4]))), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createSetLike([3, 4]))), [1, 2]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).difference([4, 5])), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference([3, 4])), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createIterable([3, 4]))), [1, 2]); assert.throws(() => new Set([1, 2, 3]).difference(), TypeError); assert.throws(() => difference.call({}, [1, 2, 3]), TypeError); assert.throws(() => difference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => difference.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.every.js000066400000000000000000000022321451776221300220340ustar00rootroot00000000000000import Set from 'core-js-pure/full/set'; QUnit.test('Set#every', assert => { const { every } = Set.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.nonEnumerable(Set.prototype, 'every'); const set = new Set([1]); const context = {}; set.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set([1, 2, 3]).every(it => typeof it == 'number')); assert.false(new Set(['1', '2', '3']).some(it => typeof it == 'number')); assert.false(new Set([1, '2', 3]).every(it => typeof it == 'number')); assert.true(new Set().every(it => typeof it == 'number')); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.filter.js000066400000000000000000000021571451776221300221750ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#filter', assert => { const { filter } = Set.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.nonEnumerable(Set.prototype, 'filter'); const set = new Set([1]); const context = {}; set.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set().filter(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3, 'q', {}, 4, true, 5]).filter(it => typeof it == 'number')), [1, 2, 3, 4, 5]); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.find.js000066400000000000000000000017531451776221300216310ustar00rootroot00000000000000import Set from 'core-js-pure/full/set'; QUnit.test('Set#find', assert => { const { find } = Set.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.nonEnumerable(Set.prototype, 'find'); const set = new Set([1]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([2, 3, 4]).find(it => it % 2), 3); assert.same(new Set().find(it => it === 42), undefined); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.from.js000066400000000000000000000016411451776221300216500ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import toArray from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set.from', assert => { const { from } = Set; assert.isFunction(from); assert.arity(from, 1); assert.true(Set.from() instanceof Set); assert.deepEqual(toArray(Set.from([])), []); assert.deepEqual(toArray(Set.from([1])), [1]); assert.deepEqual(toArray(Set.from([1, 2, 3, 2, 1])), [1, 2, 3]); assert.deepEqual(toArray(Set.from(createIterable([1, 2, 3, 2, 1]))), [1, 2, 3]); const context = {}; Set.from([1], function (element, index) { assert.same(element, 1); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from(1)); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-pure/esnext.set.intersection.js000066400000000000000000000036471451776221300234230ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#intersection', assert => { const { intersection } = Set.prototype; assert.isFunction(intersection); assert.arity(intersection, 1); assert.name(intersection, 'intersection'); assert.nonEnumerable(Set.prototype, 'intersection'); const set = new Set([1]); assert.notSame(set.intersection(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([4, 5]))), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([2, 3, 4]))), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([4, 5]))), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([2, 3, 4]))), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2]))), [3, 2]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2, 1]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(new Set([3, 2, 1, 0]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2]))), [3, 2]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2, 1]))), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createSetLike([3, 2, 1, 0]))), [1, 2, 3]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).intersection([4, 5])), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection([2, 3, 4])), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createIterable([2, 3, 4]))), [2, 3]); assert.throws(() => new Set([1, 2, 3]).intersection(), TypeError); assert.throws(() => intersection.call({}, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.is-disjoint-from.js000066400000000000000000000031031451776221300240750ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#isDisjointFrom', assert => { const { isDisjointFrom } = Set.prototype; assert.isFunction(isDisjointFrom); assert.arity(isDisjointFrom, 1); assert.name(isDisjointFrom, 'isDisjointFrom'); assert.nonEnumerable(Set.prototype, 'isDisjointFrom'); assert.true(new Set([1]).isDisjointFrom(new Set([2]))); assert.false(new Set([1]).isDisjointFrom(new Set([1]))); assert.true(new Set([1, 2, 3]).isDisjointFrom(new Set([4, 5, 6]))); assert.false(new Set([1, 2, 3]).isDisjointFrom(new Set([5, 4, 3]))); assert.true(new Set([1]).isDisjointFrom(createSetLike([2]))); assert.false(new Set([1]).isDisjointFrom(createSetLike([1]))); assert.true(new Set([1, 2, 3]).isDisjointFrom(createSetLike([4, 5, 6]))); assert.false(new Set([1, 2, 3]).isDisjointFrom(createSetLike([5, 4, 3]))); // TODO: drop from core-js@4 assert.true(new Set([1]).isDisjointFrom([2])); assert.false(new Set([1]).isDisjointFrom([1])); assert.true(new Set([1, 2, 3]).isDisjointFrom([4, 5, 6])); assert.false(new Set([1, 2, 3]).isDisjointFrom([5, 4, 3])); assert.true(new Set([1]).isDisjointFrom(createIterable([2]))); assert.false(new Set([1]).isDisjointFrom(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isDisjointFrom(), TypeError); assert.throws(() => isDisjointFrom.call({}, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.is-subset-of.js000066400000000000000000000030521451776221300232230ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#isSubsetOf', assert => { const { isSubsetOf } = Set.prototype; assert.isFunction(isSubsetOf); assert.arity(isSubsetOf, 1); assert.name(isSubsetOf, 'isSubsetOf'); assert.nonEnumerable(Set.prototype, 'isSubsetOf'); assert.true(new Set([1]).isSubsetOf(new Set([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(new Set([2, 3, 4]))); assert.true(new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2, 1]))); assert.false(new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2]))); assert.true(new Set([1]).isSubsetOf(createSetLike([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(createSetLike([2, 3, 4]))); assert.true(new Set([1, 2, 3]).isSubsetOf(createSetLike([5, 4, 3, 2, 1]))); assert.false(new Set([1, 2, 3]).isSubsetOf(createSetLike([5, 4, 3, 2]))); // TODO: drop from core-js@4 assert.true(new Set([1]).isSubsetOf([1, 2, 3])); assert.false(new Set([1]).isSubsetOf([2, 3, 4])); assert.true(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2, 1])); assert.false(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2])); assert.true(new Set([1]).isSubsetOf(createIterable([1, 2, 3]))); assert.false(new Set([1]).isSubsetOf(createIterable([2, 3, 4]))); assert.throws(() => new Set([1, 2, 3]).isSubsetOf(), TypeError); assert.throws(() => isSubsetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.is-superset-of.js000066400000000000000000000031341451776221300235710ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#isSupersetOf', assert => { const { isSupersetOf } = Set.prototype; assert.isFunction(isSupersetOf); assert.arity(isSupersetOf, 1); assert.name(isSupersetOf, 'isSupersetOf'); assert.nonEnumerable(Set.prototype, 'isSupersetOf'); assert.true(new Set([1, 2, 3]).isSupersetOf(new Set([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(new Set([1]))); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf(new Set([1, 2, 3]))); assert.false(new Set([5, 4, 3, 2]).isSupersetOf(new Set([1, 2, 3]))); assert.true(new Set([1, 2, 3]).isSupersetOf(createSetLike([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(createSetLike([1]))); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf(createSetLike([1, 2, 3]))); assert.false(new Set([5, 4, 3, 2]).isSupersetOf(createSetLike([1, 2, 3]))); // TODO: drop from core-js@4 assert.true(new Set([1, 2, 3]).isSupersetOf([1])); assert.false(new Set([2, 3, 4]).isSupersetOf([1])); assert.true(new Set([5, 4, 3, 2, 1]).isSupersetOf([1, 2, 3])); assert.false(new Set([5, 4, 3, 2]).isSupersetOf([1, 2, 3])); assert.true(new Set([1, 2, 3]).isSupersetOf(createIterable([1]))); assert.false(new Set([2, 3, 4]).isSupersetOf(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isSupersetOf(), TypeError); assert.throws(() => isSupersetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.join.js000066400000000000000000000012111451776221300216350ustar00rootroot00000000000000/* eslint-disable unicorn/require-array-join-separator -- required for testing */ import Set from 'core-js-pure/full/set'; QUnit.test('Set#join', assert => { const { join } = Set.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.nonEnumerable(Set.prototype, 'join'); assert.same(new Set([1, 2, 3]).join(), '1,2,3'); assert.same(new Set([1, 2, 3]).join(undefined), '1,2,3'); assert.same(new Set([1, 2, 3]).join('|'), '1|2|3'); assert.throws(() => join.call({}), TypeError); assert.throws(() => join.call(undefined), TypeError); assert.throws(() => join.call(null), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.map.js000066400000000000000000000021471451776221300214640ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#map', assert => { const { map } = Set.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.nonEnumerable(Set.prototype, 'map'); const set = new Set([1]); const context = {}; set.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set().map(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it ** 2)), [1, 4, 9]); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it % 2)), [1, 0]); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.of.js000066400000000000000000000007511451776221300213120ustar00rootroot00000000000000import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set.of', assert => { const { of } = Set; assert.isFunction(of); assert.arity(of, 0); assert.true(Set.of() instanceof Set); assert.deepEqual(from(Set.of(1)), [1]); assert.deepEqual(from(Set.of(1, 2, 3, 2, 1)), [1, 2, 3]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-pure/esnext.set.reduce.js000066400000000000000000000031761451776221300221610ustar00rootroot00000000000000import Set from 'core-js-pure/full/set'; QUnit.test('Set#reduce', assert => { const { reduce } = Set.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.nonEnumerable(Set.prototype, 'reduce'); const set = new Set([1]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Set([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Set([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 2, 'correct start index without initial accumulator'); }); assert.same(new Set([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Set([1, 2, 3]).reduce((memo, value, key, s) => { s.delete(2); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, '13', 'correct order #2'); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.some.js000066400000000000000000000022141451776221300216450ustar00rootroot00000000000000import Set from 'core-js-pure/full/set'; QUnit.test('Set#some', assert => { const { some } = Set.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.nonEnumerable(Set.prototype, 'some'); const set = new Set([1]); const context = {}; set.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.true(new Set([1, 2, 3]).some(it => typeof it == 'number')); assert.false(new Set(['1', '2', '3']).some(it => typeof it == 'number')); assert.true(new Set([1, '2', 3]).some(it => typeof it == 'number')); assert.false(new Set().some(it => typeof it == 'number')); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.symmetric-difference.js000066400000000000000000000032251451776221300250110ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#symmetricDifference', assert => { const { symmetricDifference } = Set.prototype; assert.isFunction(symmetricDifference); assert.arity(symmetricDifference, 1); assert.name(symmetricDifference, 'symmetricDifference'); assert.nonEnumerable(Set.prototype, 'symmetricDifference'); const set = new Set([1]); assert.notSame(set.symmetricDifference(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(new Set([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(new Set([3, 4]))), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createSetLike([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createSetLike([3, 4]))), [1, 2, 4]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([3, 4])), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([3, 4]))), [1, 2, 4]); assert.throws(() => new Set([1, 2, 3]).symmetricDifference(), TypeError); assert.throws(() => symmetricDifference.call({}, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.set.union.js000066400000000000000000000024541451776221300220400ustar00rootroot00000000000000import { createIterable, createSetLike } from '../helpers/helpers.js'; import from from 'core-js-pure/es/array/from'; import Set from 'core-js-pure/full/set'; QUnit.test('Set#union', assert => { const { union } = Set.prototype; assert.isFunction(union); assert.arity(union, 1); assert.name(union, 'union'); assert.nonEnumerable(Set.prototype, 'union'); const set = new Set([1]); assert.notSame(set.union(new Set()), set); assert.deepEqual(from(new Set([1, 2, 3]).union(new Set([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union(new Set([3, 4]))), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createSetLike([4, 5]))), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union(createSetLike([3, 4]))), [1, 2, 3, 4]); // TODO: drop from core-js@4 assert.deepEqual(from(new Set([1, 2, 3]).union([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union([3, 4])), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createIterable([3, 4]))), [1, 2, 3, 4]); assert.throws(() => new Set([1, 2, 3]).union(), TypeError); assert.throws(() => union.call({}, [1, 2, 3]), TypeError); assert.throws(() => union.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => union.call(null, [1, 2, 3]), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.string.at.js000066400000000000000000000101261451776221300220220ustar00rootroot00000000000000import { STRICT } from '../helpers/constants.js'; import at from 'core-js-pure/full/string/at'; QUnit.test('String#at', assert => { assert.isFunction(at); // String that starts with a BMP symbol // assert.same(at('abc\uD834\uDF06def', -Infinity), ''); // assert.same(at('abc\uD834\uDF06def', -1), ''); assert.same(at('abc\uD834\uDF06def', -0), 'a'); assert.same(at('abc\uD834\uDF06def', +0), 'a'); assert.same(at('abc\uD834\uDF06def', 1), 'b'); assert.same(at('abc\uD834\uDF06def', 3), '\uD834\uDF06'); assert.same(at('abc\uD834\uDF06def', 4), '\uDF06'); assert.same(at('abc\uD834\uDF06def', 5), 'd'); // assert.same(at('abc\uD834\uDF06def', 42), ''); // assert.same(at('abc\uD834\uDF06def', Infinity), ''); assert.same(at('abc\uD834\uDF06def', null), 'a'); assert.same(at('abc\uD834\uDF06def', undefined), 'a'); assert.same(at('abc\uD834\uDF06def'), 'a'); assert.same(at('abc\uD834\uDF06def', false), 'a'); assert.same(at('abc\uD834\uDF06def', NaN), 'a'); assert.same(at('abc\uD834\uDF06def', ''), 'a'); assert.same(at('abc\uD834\uDF06def', '_'), 'a'); assert.same(at('abc\uD834\uDF06def', '1'), 'b'); assert.same(at('abc\uD834\uDF06def', []), 'a'); assert.same(at('abc\uD834\uDF06def', {}), 'a'); assert.same(at('abc\uD834\uDF06def', -0.9), 'a'); assert.same(at('abc\uD834\uDF06def', 1.9), 'b'); assert.same(at('abc\uD834\uDF06def', 7.9), 'f'); // assert.same(at('abc\uD834\uDF06def', 2 ** 32), ''); // String that starts with an astral symbol // assert.same(at('\uD834\uDF06def', -Infinity), ''); // assert.same(at('\uD834\uDF06def', -1), ''); assert.same(at('\uD834\uDF06def', -0), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', 0), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', 1), '\uDF06'); assert.same(at('\uD834\uDF06def', 2), 'd'); assert.same(at('\uD834\uDF06def', 3), 'e'); assert.same(at('\uD834\uDF06def', 4), 'f'); // assert.same(at('\uD834\uDF06def', 42), ''); // assert.same(at('\uD834\uDF06def', Infinity), ''); assert.same(at('\uD834\uDF06def', null), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', undefined), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def'), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', false), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', NaN), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', ''), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', '_'), '\uD834\uDF06'); assert.same(at('\uD834\uDF06def', '1'), '\uDF06'); // Lone high surrogates // assert.same(at('\uD834abc', -Infinity), ''); // assert.same(at('\uD834abc', -1), ''); assert.same(at('\uD834abc', -0), '\uD834'); assert.same(at('\uD834abc', 0), '\uD834'); assert.same(at('\uD834abc', 1), 'a'); // assert.same(at('\uD834abc', 42), ''); // assert.same(at('\uD834abc', Infinity), ''); assert.same(at('\uD834abc', null), '\uD834'); assert.same(at('\uD834abc', undefined), '\uD834'); assert.same(at('\uD834abc'), '\uD834'); assert.same(at('\uD834abc', false), '\uD834'); assert.same(at('\uD834abc', NaN), '\uD834'); assert.same(at('\uD834abc', ''), '\uD834'); assert.same(at('\uD834abc', '_'), '\uD834'); assert.same(at('\uD834abc', '1'), 'a'); // Lone low surrogates // assert.same(at('\uDF06abc', -Infinity), ''); // assert.same(at('\uDF06abc', -1), ''); assert.same(at('\uDF06abc', -0), '\uDF06'); assert.same(at('\uDF06abc', 0), '\uDF06'); assert.same(at('\uDF06abc', 1), 'a'); // assert.same(at('\uDF06abc', 42), ''); // assert.same(at('\uDF06abc', Infinity), ''); assert.same(at('\uDF06abc', null), '\uDF06'); assert.same(at('\uDF06abc', undefined), '\uDF06'); assert.same(at('\uDF06abc'), '\uDF06'); assert.same(at('\uDF06abc', false), '\uDF06'); assert.same(at('\uDF06abc', NaN), '\uDF06'); assert.same(at('\uDF06abc', ''), '\uDF06'); assert.same(at('\uDF06abc', '_'), '\uDF06'); assert.same(at('\uDF06abc', '1'), 'a'); assert.same(at(42, 0), '4'); assert.same(at(42, 1), '2'); assert.same(at({ toString() { return 'abc'; }, }, 2), 'c'); if (STRICT) { assert.throws(() => at(null, 0), TypeError); assert.throws(() => at(undefined, 0), TypeError); } }); core-js-3.33.2/tests/unit-pure/esnext.string.code-points.js000066400000000000000000000024631451776221300236470ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import codePoints from 'core-js-pure/full/string/code-points'; QUnit.test('String#codePoints', assert => { assert.isFunction(codePoints); let iterator = codePoints('qwe'); assert.isIterator(iterator); assert.isIterable(iterator); assert.same(iterator[Symbol.toStringTag], 'String Iterator'); assert.same(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: { codePoint: 113, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 119, position: 1 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 101, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); iterator = codePoints('𠮷𠮷𠮷'); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 4 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.throws(() => codePoints(Symbol()), 'throws on symbol context'); }); core-js-3.33.2/tests/unit-pure/esnext.string.cooked.js000066400000000000000000000015451451776221300226670ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import cooked from 'core-js-pure/full/string/cooked'; QUnit.test('String.cooked', assert => { assert.isFunction(cooked); assert.arity(cooked, 1); assert.name(cooked, 'cooked'); assert.same(cooked(['Hi\\n', '!'], 'Bob'), 'Hi\\nBob!', 'template is an array'); assert.same(cooked('test', 0, 1, 2), 't0e1s2t', 'template is a string'); assert.same(cooked('test', 0), 't0est', 'lacks substituting'); assert.same(cooked([]), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { const symbol = Symbol('cooked test'); assert.throws(() => cooked([symbol]), TypeError, 'throws on symbol #1'); assert.throws(() => cooked('test', symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => cooked([undefined]), TypeError); assert.throws(() => cooked(null), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.string.dedent.js000066400000000000000000000031631451776221300226640ustar00rootroot00000000000000import Symbol from 'core-js-pure/es/symbol'; import cooked from 'core-js-pure/full/string/cooked'; import dedent from 'core-js-pure/full/string/dedent'; import freeze from 'core-js-pure/es/object/freeze'; QUnit.test('String.dedent', assert => { assert.isFunction(dedent); assert.arity(dedent, 1); assert.name(dedent, 'dedent'); assert.same(dedent` qwe asd zxc `, 'qwe\nasd\nzxc', '#1'); assert.same(dedent` qwe asd zxc `, ' qwe\nasd\n zxc', '#2'); assert.same(dedent` qwe asd ${ ' zxc' } `, ' qwe\n asd\n zxc', '#3'); assert.same(dedent({ raw: freeze(['\n qwe\n ']) }), 'qwe', '#4'); assert.same(dedent({ raw: freeze(['\n qwe', '\n ']) }, 1), 'qwe1', '#5'); assert.same(dedent(cooked)` qwe asd zxc `, ' qwe\nasd\n zxc', '#6'); const tag = (it => it)` abc `; assert.same(dedent(tag), dedent(tag), '#7'); if (typeof Symbol == 'function' && !Symbol.sham) { assert.throws(() => dedent({ raw: freeze(['\n', Symbol('dedent test'), '\n']) }), TypeError, 'throws on symbol'); } assert.throws(() => dedent([]), TypeError, '[]'); assert.throws(() => dedent(['qwe']), TypeError, '[qwe]'); assert.throws(() => dedent({ raw: freeze([]) }), TypeError, 'empty tpl'); assert.throws(() => dedent({ raw: freeze(['qwe']) }), TypeError, 'wrong start'); assert.throws(() => dedent({ raw: freeze(['\n', 'qwe']) }), TypeError, 'wrong start'); assert.throws(() => dedent({ raw: freeze(['\n qwe', 5, '\n ']) }, 1, 2), TypeError, 'wrong part'); assert.throws(() => dedent([undefined]), TypeError); assert.throws(() => dedent(null), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.suppressed-error.constructor.js000066400000000000000000000037021451776221300260230ustar00rootroot00000000000000import SuppressedError from 'core-js-pure/actual/suppressed-error'; import Symbol from 'core-js-pure/es/symbol'; import toString from 'core-js-pure/es/object/to-string'; QUnit.test('SuppressedError', assert => { assert.isFunction(SuppressedError); assert.arity(SuppressedError, 3); assert.name(SuppressedError, 'SuppressedError'); assert.true(new SuppressedError() instanceof SuppressedError); assert.true(new SuppressedError() instanceof Error); assert.true(SuppressedError() instanceof SuppressedError); assert.true(SuppressedError() instanceof Error); assert.same(SuppressedError().error, undefined); assert.same(SuppressedError().suppressed, undefined); assert.same(SuppressedError().message, ''); assert.same(SuppressedError().cause, undefined); assert.same(SuppressedError().name, 'SuppressedError'); assert.same(new SuppressedError().error, undefined); assert.same(new SuppressedError().suppressed, undefined); assert.same(new SuppressedError().message, ''); assert.same(new SuppressedError().cause, undefined); assert.same(new SuppressedError().name, 'SuppressedError'); const error1 = SuppressedError(1, 2, 3, { cause: 4 }); assert.same(error1.error, 1); assert.same(error1.suppressed, 2); assert.same(error1.message, '3'); assert.same(error1.cause, undefined); assert.same(error1.name, 'SuppressedError'); const error2 = new SuppressedError(1, 2, 3, { cause: 4 }); assert.same(error2.error, 1); assert.same(error2.suppressed, 2); assert.same(error2.message, '3'); assert.same(error2.cause, undefined); assert.same(error2.name, 'SuppressedError'); assert.throws(() => SuppressedError(1, 2, Symbol('SuppressedError constructor test')), 'throws on symbol as a message'); assert.same(toString(SuppressedError()), '[object Error]', 'Object#toString'); // eslint-disable-next-line no-prototype-builtins -- safe assert.false(SuppressedError.prototype.hasOwnProperty('cause'), 'prototype has not cause'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.async-dispose.js000066400000000000000000000004131451776221300241740ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.asyncDispose', assert => { assert.true('asyncDispose' in Symbol, 'Symbol.asyncDispose available'); assert.true(Object(Symbol.asyncDispose) instanceof Symbol, 'Symbol.asyncDispose is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.dispose.js000066400000000000000000000003641451776221300230660ustar00rootroot00000000000000import Symbol from 'core-js-pure/actual/symbol'; QUnit.test('Symbol.dispose', assert => { assert.true('dispose' in Symbol, 'Symbol.dispose available'); assert.true(Object(Symbol.dispose) instanceof Symbol, 'Symbol.dispose is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.is-registered-symbol.js000066400000000000000000000021341451776221300254660ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.isRegisteredSymbol', assert => { const { isRegisteredSymbol } = Symbol; assert.isFunction(isRegisteredSymbol, 'Symbol.isRegisteredSymbol is function'); assert.arity(isRegisteredSymbol, 1, 'Symbol.isRegisteredSymbol arity is 1'); assert.name(isRegisteredSymbol, 'isRegisteredSymbol', 'Symbol.isRegisteredSymbol.name is "isRegisteredSymbol"'); assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered'); assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered, boxed'); const symbol = Symbol('Symbol.isRegisteredSymbol test'); assert.false(isRegisteredSymbol(symbol), 'non-registered'); assert.false(isRegisteredSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isRegisteredSymbol(1), '1'); assert.false(isRegisteredSymbol(true), 'true'); assert.false(isRegisteredSymbol('1'), 'string'); assert.false(isRegisteredSymbol(null), 'null'); assert.false(isRegisteredSymbol(), 'undefined'); assert.false(isRegisteredSymbol({}), 'object'); assert.false(isRegisteredSymbol([]), 'array'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.is-registered.js000066400000000000000000000017441451776221300241710ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.isRegistered', assert => { const { isRegistered } = Symbol; assert.isFunction(isRegistered, 'Symbol.isRegistered is function'); assert.arity(isRegistered, 1, 'Symbol.isRegistered arity is 1'); assert.name(isRegistered, 'isRegisteredSymbol', 'Symbol.isRegistered.name is "isRegisteredSymbol"'); assert.true(isRegistered(Symbol.for('foo')), 'registered'); assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered, boxed'); const symbol = Symbol('Symbol.isRegistered test'); assert.false(isRegistered(symbol), 'non-registered'); assert.false(isRegistered(Object(symbol)), 'non-registered, boxed'); assert.false(isRegistered(1), '1'); assert.false(isRegistered(true), 'true'); assert.false(isRegistered('1'), 'string'); assert.false(isRegistered(null), 'null'); assert.false(isRegistered(), 'undefined'); assert.false(isRegistered({}), 'object'); assert.false(isRegistered([]), 'array'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.is-well-known-symbol.js000066400000000000000000000023431451776221300254300ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.isWellKnownSymbol', assert => { const { isWellKnownSymbol } = Symbol; assert.isFunction(isWellKnownSymbol, 'Symbol.isWellKnownSymbol is function'); assert.arity(isWellKnownSymbol, 1, 'Symbol.isWellKnownSymbol arity is 1'); assert.name(isWellKnownSymbol, 'isWellKnownSymbol', 'Symbol.isWellKnownSymbol.name is "isWellKnownSymbol"'); assert.true(isWellKnownSymbol(Symbol.iterator), 'registered-1'); assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnownSymbol(Symbol.patternMatch), 'registered-3'); assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4, boxed'); const symbol = Symbol('Symbol.isWellKnownSymbol test'); assert.false(isWellKnownSymbol(symbol), 'non-registered'); assert.false(isWellKnownSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnownSymbol(1), '1'); assert.false(isWellKnownSymbol(true), 'true'); assert.false(isWellKnownSymbol('1'), 'string'); assert.false(isWellKnownSymbol(null), 'null'); assert.false(isWellKnownSymbol(), 'undefined'); assert.false(isWellKnownSymbol({}), 'object'); assert.false(isWellKnownSymbol([]), 'array'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.is-well-known.js000066400000000000000000000021371451776221300241260ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.isWellKnown', assert => { const { isWellKnown } = Symbol; assert.isFunction(isWellKnown, 'Symbol.isWellKnown is function'); assert.arity(isWellKnown, 1, 'Symbol.isWellKnown arity is 1'); assert.name(isWellKnown, 'isWellKnownSymbol', 'Symbol.isWellKnown.name is "isWellKnownSymbol"'); assert.true(isWellKnown(Symbol.iterator), 'registered-1'); assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnown(Symbol.patternMatch), 'registered-3'); assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4, boxed'); const symbol = Symbol('Symbol.isWellKnown test'); assert.false(isWellKnown(symbol), 'non-registered'); assert.false(isWellKnown(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnown(1), '1'); assert.false(isWellKnown(true), 'true'); assert.false(isWellKnown('1'), 'string'); assert.false(isWellKnown(null), 'null'); assert.false(isWellKnown(), 'undefined'); assert.false(isWellKnown({}), 'object'); assert.false(isWellKnown([]), 'array'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.matcher.js000066400000000000000000000003621451776221300230410ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.matcher', assert => { assert.true('matcher' in Symbol, 'Symbol.matcher available'); assert.true(Object(Symbol.matcher) instanceof Symbol, 'Symbol.matcher is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.metadata-key.js000066400000000000000000000004061451776221300237630ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.metadataKey', assert => { assert.true('metadataKey' in Symbol, 'Symbol.metadataKey available'); assert.true(Object(Symbol.metadataKey) instanceof Symbol, 'Symbol.metadataKey is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.metadata.js000066400000000000000000000003711451776221300231760ustar00rootroot00000000000000import Symbol from 'core-js-pure/actual/symbol'; QUnit.test('Symbol.metadata', assert => { assert.true('metadata' in Symbol, 'Symbol.metadata available'); assert.true(Object(Symbol.metadata) instanceof Symbol, 'Symbol.metadata is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.observable.js000066400000000000000000000004011451776221300235340ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.observable', assert => { assert.true('observable' in Symbol, 'Symbol.observable available'); assert.true(Object(Symbol.observable) instanceof Symbol, 'Symbol.observable is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.pattern-match.js000066400000000000000000000004131451776221300241620ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.patternMatch', assert => { assert.true('patternMatch' in Symbol, 'Symbol.patternMatch available'); assert.true(Object(Symbol.patternMatch) instanceof Symbol, 'Symbol.patternMatch is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.symbol.replace-all.js000066400000000000000000000004041451776221300235740ustar00rootroot00000000000000import Symbol from 'core-js-pure/full/symbol'; QUnit.test('Symbol.replaceAll', assert => { assert.true('replaceAll' in Symbol, 'Symbol.replaceAll is available'); assert.true(Object(Symbol.replaceAll) instanceof Symbol, 'Symbol.replaceAll is symbol'); }); core-js-3.33.2/tests/unit-pure/esnext.weak-map.delete-all.js000066400000000000000000000027441451776221300236310ustar00rootroot00000000000000import WeakMap from 'core-js-pure/full/weak-map'; QUnit.test('WeakMap#deleteAll', assert => { const { deleteAll } = WeakMap.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.nonEnumerable(WeakMap.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.true(set.deleteAll(a, b)); assert.false(set.has(a)); assert.false(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.false(set.deleteAll(c, d)); assert.true(set.has(a)); assert.true(set.has(b)); assert.false(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.false(set.deleteAll(d, e)); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.true(set.deleteAll()); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.weak-map.emplace.js000066400000000000000000000036511451776221300232250ustar00rootroot00000000000000import WeakMap from 'core-js-pure/full/weak-map'; QUnit.test('WeakMap#emplace', assert => { const { emplace } = WeakMap.prototype; assert.isFunction(emplace); assert.arity(emplace, 2); assert.name(emplace, 'emplace'); assert.nonEnumerable(WeakMap.prototype, 'emplace'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); let handler = { update(value, key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, a, 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return value ** 2; }, insert() { assert.avoid(); }, }; assert.same(map.emplace(a, handler), 4, 'returns a correct value'); handler = { update() { assert.avoid(); }, insert(key, that) { assert.same(this, handler, 'correct handler in callback'); assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(key, b, 'correct key in callback'); assert.same(that, map, 'correct map in callback'); return 3; }, }; assert.same(map.emplace(b, handler), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).emplace(b, { insert: () => 3 }), 3); assert.same(new WeakMap([[a, 2]]).emplace(a, { update: value => value ** 2 }), 4); handler = { update() { /* empty */ }, insert() { /* empty */ } }; assert.throws(() => new WeakMap().emplace(a), TypeError); assert.throws(() => emplace.call({}, a, handler), TypeError); assert.throws(() => emplace.call([], a, handler), TypeError); assert.throws(() => emplace.call(undefined, a, handler), TypeError); assert.throws(() => emplace.call(null, a, handler), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.weak-map.from.js000066400000000000000000000015201451776221300225530ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import WeakMap from 'core-js-pure/full/weak-map'; QUnit.test('WeakMap.from', assert => { const { from } = WeakMap; assert.isFunction(from); assert.arity(from, 1); assert.true(WeakMap.from() instanceof WeakMap); const array = []; assert.same(WeakMap.from([[array, 2]]).get(array), 2); assert.same(WeakMap.from(createIterable([[array, 2]])).get(array), 2); const pair = [{}, 1]; const context = {}; WeakMap.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([{}, 1])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-pure/esnext.weak-map.of.js000066400000000000000000000006661451776221300222260ustar00rootroot00000000000000import WeakMap from 'core-js-pure/full/weak-map'; QUnit.test('WeakMap.of', assert => { const { of } = WeakMap; assert.isFunction(of); assert.arity(of, 0); const array = []; assert.true(WeakMap.of() instanceof WeakMap); assert.same(WeakMap.of([array, 2]).get(array), 2); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-pure/esnext.weak-map.upsert.js000066400000000000000000000030101451776221300231260ustar00rootroot00000000000000import WeakMap from 'core-js-pure/full/weak-map'; QUnit.test('WeakMap#upsert', assert => { const { upsert } = WeakMap.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.nonEnumerable(WeakMap.prototype, 'upsert'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); assert.same(map.upsert(a, function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.avoid(); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert(b, value => { assert.avoid(); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).upsert(b, null, () => 3), 3); assert.same(new WeakMap([[a, 2]]).upsert(a, value => value ** 2), 4); assert.throws(() => new WeakMap().upsert(a), TypeError); assert.throws(() => upsert.call({}, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.weak-set.add-all.js000066400000000000000000000016461451776221300231350ustar00rootroot00000000000000import WeakSet from 'core-js-pure/full/weak-set'; QUnit.test('WeakSet#addAll', assert => { const { addAll } = WeakSet.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.nonEnumerable(WeakSet.prototype, 'addAll'); const a = []; const b = []; const c = []; let set = new WeakSet([a]); assert.same(set.addAll(b), set); set = new WeakSet([a]).addAll(b, c); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); set = new WeakSet([a]).addAll(a, b); assert.true(set.has(a)); assert.true(set.has(b)); set = new WeakSet([a]).addAll(); assert.true(set.has(a)); assert.throws(() => addAll.call({ add() { /* empty */ } }, a, b, c)); assert.throws(() => addAll.call({}, a, b, c), TypeError); assert.throws(() => addAll.call(undefined, a, b, c), TypeError); assert.throws(() => addAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.weak-set.delete-all.js000066400000000000000000000027171451776221300236470ustar00rootroot00000000000000import WeakSet from 'core-js-pure/full/weak-set'; QUnit.test('WeakSet#deleteAll', assert => { const { deleteAll } = WeakSet.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.nonEnumerable(WeakSet.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakSet([a, b, c]); assert.true(set.deleteAll(a, b)); assert.false(set.has(a)); assert.false(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.false(set.deleteAll(c, d)); assert.true(set.has(a)); assert.true(set.has(b)); assert.false(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.false(set.deleteAll(d, e)); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); set = new WeakSet([a, b, c]); assert.true(set.deleteAll()); assert.true(set.has(a)); assert.true(set.has(b)); assert.true(set.has(c)); assert.false(set.has(d)); assert.false(set.has(e)); assert.throws(() => deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.33.2/tests/unit-pure/esnext.weak-set.from.js000066400000000000000000000014741451776221300226010ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import WeakSet from 'core-js-pure/full/weak-set'; QUnit.test('WeakSet.from', assert => { const { from } = WeakSet; assert.isFunction(from); assert.arity(from, 1); assert.true(WeakSet.from() instanceof WeakSet); const array = []; assert.true(WeakSet.from([array]).has(array)); assert.true(WeakSet.from(createIterable([array])).has(array)); const object = {}; const context = {}; WeakSet.from([object], function (element, index) { assert.same(element, object); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from({})); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.33.2/tests/unit-pure/esnext.weak-set.of.js000066400000000000000000000006471451776221300222430ustar00rootroot00000000000000import WeakSet from 'core-js-pure/full/weak-set'; QUnit.test('WeakSet.of', assert => { const { of } = WeakSet; assert.isFunction(of); assert.arity(of, 0); const array = []; assert.true(WeakSet.of() instanceof WeakSet); assert.true(WeakSet.of(array).has(array)); assert.throws(() => of(1)); let arg = null; function F(it) { arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.33.2/tests/unit-pure/helpers.get-iterator-method.js000066400000000000000000000012621451776221300241320ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import getIteratorMethod from 'core-js-pure/full/get-iterator-method'; QUnit.test('getIteratorMethod helper', assert => { assert.isFunction(getIteratorMethod); const iterable = createIterable([]); const iterFn = getIteratorMethod(iterable); assert.isFunction(iterFn); assert.isIterator(iterFn.call(iterable)); assert.isFunction(getIteratorMethod([])); assert.isFunction(getIteratorMethod(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.isFunction(getIteratorMethod(Array.prototype)); assert.same(getIteratorMethod({}), undefined); }); core-js-3.33.2/tests/unit-pure/helpers.get-iterator.js000066400000000000000000000007561451776221300226630ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import getIterator from 'core-js-pure/full/get-iterator'; QUnit.test('getIterator helper', assert => { assert.isFunction(getIterator); assert.isIterator(getIterator([])); assert.isIterator(getIterator(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.isIterator(getIterator(createIterable([]))); assert.throws(() => getIterator({}), TypeError); }); core-js-3.33.2/tests/unit-pure/helpers.is-iterable.js000066400000000000000000000007551451776221300224540ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers.js'; import isIterable from 'core-js-pure/full/is-iterable'; QUnit.test('isIterable helper', assert => { assert.isFunction(isIterable); assert.true(isIterable(createIterable([]))); assert.true(isIterable([])); assert.true(isIterable(function () { // eslint-disable-next-line prefer-rest-params -- required for testing return arguments; }())); assert.true(isIterable(Array.prototype)); assert.true(isIterable({})); }); core-js-3.33.2/tests/unit-pure/web.atob.js000066400000000000000000000024121451776221300203040ustar00rootroot00000000000000// based on https://github.com/davidchambers/Base64.js/blob/master/test/base64.js import atob from 'core-js-pure/stable/atob'; QUnit.test('atob', assert => { assert.isFunction(atob); assert.arity(atob, 1); assert.same(atob(''), ''); assert.same(atob('Zg=='), 'f'); assert.same(atob('Zm8='), 'fo'); assert.same(atob('Zm9v'), 'foo'); assert.same(atob('cXV1eA=='), 'quux'); assert.same(atob('ISIjJCU='), '!"#$%'); assert.same(atob('JicoKSor'), "&'()*+"); assert.same(atob('LC0uLzAxMg=='), ',-./012'); assert.same(atob('MzQ1Njc4OTo='), '3456789:'); assert.same(atob('Ozw9Pj9AQUJD'), ';<=>?@ABC'); assert.same(atob('REVGR0hJSktMTQ=='), 'DEFGHIJKLM'); assert.same(atob('Tk9QUVJTVFVWV1g='), 'NOPQRSTUVWX'); assert.same(atob('WVpbXF1eX2BhYmM='), 'YZ[\\]^_`abc'); assert.same(atob('ZGVmZ2hpamtsbW5vcA=='), 'defghijklmnop'); assert.same(atob('cXJzdHV2d3h5ent8fX4='), 'qrstuvwxyz{|}~'); assert.same(atob(' '), ''); assert.same(atob(42), atob('42')); assert.same(atob(null), atob('null')); assert.throws(() => atob(), TypeError, 'no args'); assert.throws(() => atob('a'), 'invalid #1'); assert.throws(() => atob('a '), 'invalid #2'); assert.throws(() => atob('aaaaa'), 'invalid #3'); assert.throws(() => atob('[object Object]'), 'invalid #4'); }); core-js-3.33.2/tests/unit-pure/web.btoa.js000066400000000000000000000023011451776221300203010ustar00rootroot00000000000000// based on https://github.com/davidchambers/Base64.js/blob/master/test/base64.js import btoa from 'core-js-pure/stable/btoa'; QUnit.test('btoa', assert => { assert.isFunction(btoa); assert.arity(btoa, 1); assert.same(btoa(''), ''); assert.same(btoa('f'), 'Zg=='); assert.same(btoa('fo'), 'Zm8='); assert.same(btoa('foo'), 'Zm9v'); assert.same(btoa('quux'), 'cXV1eA=='); assert.same(btoa('!"#$%'), 'ISIjJCU='); assert.same(btoa("&'()*+"), 'JicoKSor'); assert.same(btoa(',-./012'), 'LC0uLzAxMg=='); assert.same(btoa('3456789:'), 'MzQ1Njc4OTo='); assert.same(btoa(';<=>?@ABC'), 'Ozw9Pj9AQUJD'); assert.same(btoa('DEFGHIJKLM'), 'REVGR0hJSktMTQ=='); assert.same(btoa('NOPQRSTUVWX'), 'Tk9QUVJTVFVWV1g='); assert.same(btoa('YZ[\\]^_`abc'), 'WVpbXF1eX2BhYmM='); assert.same(btoa('defghijklmnop'), 'ZGVmZ2hpamtsbW5vcA=='); assert.same(btoa('qrstuvwxyz{|}~'), 'cXJzdHV2d3h5ent8fX4='); assert.same(btoa('qrstuvwxyz{|}~'), 'cXJzdHV2d3h5ent8fX4='); assert.same(btoa(42), btoa('42')); assert.same(btoa(null), btoa('null')); assert.same(btoa({ x: 1 }), btoa('[object Object]')); assert.throws(() => btoa(), TypeError, 'no args'); assert.throws(() => btoa('✈'), 'non-ASCII'); }); core-js-3.33.2/tests/unit-pure/web.dom-collections.iterator.js000066400000000000000000000032331451776221300243040ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants.js'; import Symbol from 'core-js-pure/es/symbol'; import getIteratorMethod from 'core-js-pure/stable/get-iterator-method'; QUnit.test('Iterable DOM collections', assert => { let absent = true; const collections = [ 'CSSRuleList', 'CSSStyleDeclaration', 'CSSValueList', 'ClientRectList', 'DOMRectList', 'DOMStringList', 'DOMTokenList', 'DataTransferItemList', 'FileList', 'HTMLAllCollection', 'HTMLCollection', 'HTMLFormElement', 'HTMLSelectElement', 'MediaList', 'MimeTypeArray', 'NamedNodeMap', 'NodeList', 'PaintRequestList', 'Plugin', 'PluginArray', 'SVGLengthList', 'SVGNumberList', 'SVGPathSegList', 'SVGPointList', 'SVGStringList', 'SVGTransformList', 'SourceBufferList', 'StyleSheetList', 'TextTrackCueList', 'TextTrackList', 'TouchList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { absent = false; assert.same(Collection.prototype[Symbol.toStringTag], name, `${ name }::@@toStringTag is '${ name }'`); if (Object.prototype.toString.call(Collection.prototype).slice(8, -1) === name) { assert.isFunction(getIteratorMethod(Collection.prototype), `${ name }::@@iterator is function`); } } } if (GLOBAL.NodeList && GLOBAL.document && document.querySelectorAll && document.querySelectorAll('div') instanceof NodeList) { assert.isFunction(getIteratorMethod(document.querySelectorAll('div')), 'works with document.querySelectorAll'); } if (absent) { assert.required('DOM collections are absent'); } }); core-js-3.33.2/tests/unit-pure/web.dom-exception.constructor.js000066400000000000000000000114321451776221300245200ustar00rootroot00000000000000import { DESCRIPTORS, NODE } from '../helpers/constants.js'; import DOMException from 'core-js-pure/stable/dom-exception'; import Symbol from 'core-js-pure/es/symbol'; const errors = { IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 }, }; const HAS_STACK = 'stack' in Error('1'); QUnit.test('DOMException', assert => { assert.isFunction(DOMException); assert.arity(DOMException, 0); assert.name(DOMException, 'DOMException'); let error = new DOMException({}, 'Foo'); assert.true(error instanceof DOMException, 'new DOMException({}, "Foo") instanceof DOMException'); assert.same(error.message, '[object Object]', 'new DOMException({}, "Foo").message'); assert.same(error.name, 'Foo', 'new DOMException({}, "Foo").name'); assert.same(error.code, 0, 'new DOMException({}, "Foo").code'); assert.same(String(error), 'Foo: [object Object]', 'String(new DOMException({}, "Foo"))'); // Safari 10.1 bug // assert.same(error.constructor, DOMException, 'new DOMException({}, "Foo").constructor'); assert.same(error[Symbol.toStringTag], 'DOMException', 'DOMException.prototype[Symbol.toStringTag]'); if (HAS_STACK) assert.true('stack' in error, "'stack' in new DOMException()"); assert.same(new DOMException().message, '', 'new DOMException().message'); assert.same(new DOMException(undefined).message, '', 'new DOMException(undefined).message'); assert.same(new DOMException(42).name, 'Error', 'new DOMException(42).name'); assert.same(new DOMException(42, undefined).name, 'Error', 'new DOMException(42, undefined).name'); for (const name in errors) { error = new DOMException(42, name); assert.true(error instanceof DOMException, `new DOMException({}, "${ name }") instanceof DOMException`); assert.same(error.message, '42', `new DOMException({}, "${ name }").message`); assert.same(error.name, name, `new DOMException({}, "${ name }").name`); if (errors[name].m) assert.same(error.code, errors[name].c, `new DOMException({}, "${ name }").code`); // NodeJS and Deno set codes to deprecated errors else if (!NODE) assert.same(error.code, 0, `new DOMException({}, "${ name }").code`); assert.same(String(error), `${ name }: 42`, `String(new DOMException({}, "${ name }"))`); // Safari 10.1 bug if (HAS_STACK) assert.true('stack' in error, `'stack' in new DOMException({}, "${ name }")`); assert.same(DOMException[errors[name].s], errors[name].c, `DOMException.${ errors[name].s }`); assert.same(DOMException.prototype[errors[name].s], errors[name].c, `DOMException.prototype.${ errors[name].s }`); } assert.throws(() => DOMException(42, 'DataCloneError'), "DOMException(42, 'DataCloneError')"); const symbol = Symbol('DOMException constructor test'); assert.throws(() => new DOMException(symbol, 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); assert.throws(() => new DOMException(42, symbol), 'new DOMException(42, Symbol())'); if (DESCRIPTORS) { // assert.throws(() => DOMException.prototype.message, 'DOMException.prototype.message'); // FF55- , Safari 10.1 bug // assert.throws(() => DOMException.prototype.name, 'DOMException.prototype.name'); // FF55-, Safari 10.1 bug bug // assert.throws(() => DOMException.prototype.code, 'DOMException.prototype.code'); // Safari 10.1 bug // assert.throws(() => DOMException.prototype.toString(), 'DOMException.prototype.toString()'); // FF55- bug } }); core-js-3.33.2/tests/unit-pure/web.queue-microtask.js000066400000000000000000000007341451776221300225020ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; import queueMicrotask from 'core-js-pure/full/queue-microtask'; QUnit.test('queueMicrotask', assert => { assert.isFunction(queueMicrotask); assert.arity(queueMicrotask, 1); return timeLimitedPromise(3e3, resolve => { let called = false; queueMicrotask(() => { called = true; resolve(); }); assert.false(called, 'async'); }).then(() => { assert.required('works'); }); }); core-js-3.33.2/tests/unit-pure/web.self.js000066400000000000000000000002651451776221300203140ustar00rootroot00000000000000import self from 'core-js-pure/stable/self'; QUnit.test('self', assert => { assert.same(self, Object(self), 'is object'); assert.same(self.Math, Math, 'contains globals'); }); core-js-3.33.2/tests/unit-pure/web.set-immediate.js000066400000000000000000000023611451776221300221110ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; import setImmediate from 'core-js-pure/stable/set-immediate'; import clearImmediate from 'core-js-pure/stable/clear-immediate'; QUnit.test('setImmediate / clearImmediate', assert => { assert.isFunction(setImmediate, 'setImmediate is function'); assert.isFunction(clearImmediate, 'clearImmediate is function'); let called = false; const promise = timeLimitedPromise(1e3, resolve => { setImmediate(() => { called = true; resolve(); }); }).then(() => { assert.required('setImmediate works'); }, () => { assert.avoid('setImmediate works'); }).then(() => { return timeLimitedPromise(1e3, resolve => { setImmediate((a, b) => { resolve(a + b); }, 'a', 'b'); }); }).then(it => { assert.same(it, 'ab', 'setImmediate works with additional args'); }, () => { assert.avoid('setImmediate works with additional args'); }).then(() => { return timeLimitedPromise(50, resolve => { clearImmediate(setImmediate(resolve)); }); }).then(() => { assert.avoid('clearImmediate works'); }, () => { assert.required('clearImmediate works'); }); assert.false(called, 'setImmediate is async'); return promise; }); core-js-3.33.2/tests/unit-pure/web.set-interval.js000066400000000000000000000016121451776221300217750ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; import setTimeout from 'core-js-pure/stable/set-timeout'; import setInterval from 'core-js-pure/stable/set-interval'; QUnit.test('setInterval / clearInterval', assert => { assert.isFunction(setInterval, 'setInterval is function'); assert.isFunction(clearInterval, 'clearInterval is function'); return timeLimitedPromise(1e4, (resolve, reject) => { let i = 0; const interval = setInterval((a, b) => { if (a + b !== 'ab' || i > 2) reject({ a, b, i }); if (i++ === 2) { clearInterval(interval); setTimeout(resolve, 30); } }, 5, 'a', 'b'); }).then(() => { assert.required('setInterval & clearInterval works with additional args'); }, (error = {}) => { assert.avoid(`setInterval & clearInterval works with additional args: ${ error.a }, ${ error.b }, times: ${ error.i }`); }); }); core-js-3.33.2/tests/unit-pure/web.set-timeout.js000066400000000000000000000015261451776221300216430ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers.js'; import setTimeout from 'core-js-pure/stable/set-timeout'; QUnit.test('setTimeout / clearTimeout', assert => { assert.isFunction(setTimeout, 'setTimeout is function'); assert.isFunction(clearTimeout, 'clearTimeout is function'); return timeLimitedPromise(1e3, resolve => { setTimeout((a, b) => { resolve(a + b); }, 10, 'a', 'b'); }).then(it => { assert.same(it, 'ab', 'setTimeout works with additional args'); }, () => { assert.avoid('setTimeout works with additional args'); }).then(() => { return timeLimitedPromise(50, resolve => { clearTimeout(setTimeout(resolve, 10)); }); }).then(() => { assert.avoid('clearImmediate works with wrapped setTimeout'); }, () => { assert.required('clearImmediate works with wrapped setTimeout'); }); }); core-js-3.33.2/tests/unit-pure/web.structured-clone.js000066400000000000000000000406671451776221300226770ustar00rootroot00000000000000// Originally from: https://github.com/web-platform-tests/wpt/blob/4b35e758e2fc4225368304b02bcec9133965fd1a/IndexedDB/structured-clone.any.js // Copyright © web-platform-tests contributors. Available under the 3-Clause BSD License. /* eslint-disable es/no-error-cause, es/no-typed-arrays -- safe */ import { GLOBAL, NODE } from '../helpers/constants.js'; import { bufferToArray, fromSource } from '../helpers/helpers.js'; import structuredClone from 'core-js-pure/stable/structured-clone'; import from from 'core-js-pure/es/array/from'; import assign from 'core-js-pure/es/object/assign'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import keys from 'core-js-pure/es/object/keys'; import Symbol from 'core-js-pure/es/symbol'; import Map from 'core-js-pure/es/map'; import Set from 'core-js-pure/es/set'; import AggregateError from 'core-js-pure/es/aggregate-error'; import DOMException from 'core-js-pure/stable/dom-exception'; QUnit.module('structuredClone', () => { QUnit.test('identity', assert => { assert.isFunction(structuredClone, 'structuredClone is a function'); assert.name(structuredClone, 'structuredClone'); assert.arity(structuredClone, 1); assert.throws(() => structuredClone(), 'throws without arguments'); assert.same(structuredClone(1, null), 1, 'null as options'); assert.same(structuredClone(1, undefined), 1, 'undefined as options'); }); function cloneTest(value, verifyFunc) { verifyFunc(value, structuredClone(value)); } // Specialization of cloneTest() for objects, with common asserts. function cloneObjectTest(assert, value, verifyFunc) { cloneTest(value, (orig, clone) => { assert.notSame(orig, clone, 'clone should have different reference'); assert.same(typeof clone, 'object', 'clone should be an object'); // https://github.com/qunitjs/node-qunit/issues/146 assert.true(getPrototypeOf(orig) === getPrototypeOf(clone), 'clone should have same prototype'); verifyFunc(orig, clone); }); } // ECMAScript types // Primitive values: Undefined, Null, Boolean, Number, BigInt, String const booleans = [false, true]; const numbers = [ NaN, -Infinity, -Number.MAX_VALUE, -0xFFFFFFFF, -0x80000000, -0x7FFFFFFF, -1, -Number.MIN_VALUE, -0, 0, 1, Number.MIN_VALUE, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, Number.MAX_VALUE, Infinity, ]; const bigints = fromSource(`[ -12345678901234567890n, -1n, 0n, 1n, 12345678901234567890n, ]`) || []; const strings = [ '', 'this is a sample string', 'null(\0)', ]; QUnit.test('primitives', assert => { const primitives = [undefined, null, ...booleans, ...numbers, ...bigints, ...strings]; for (const value of primitives) cloneTest(value, (orig, clone) => { assert.same(orig, clone, 'primitives should be same after cloned'); }); }); // "Primitive" Objects (Boolean, Number, BigInt, String) QUnit.test('primitive objects', assert => { const primitives = [...booleans, ...numbers, ...bigints, ...strings]; for (const value of primitives) cloneObjectTest(assert, Object(value), (orig, clone) => { assert.same(orig.valueOf(), clone.valueOf(), 'primitive wrappers should have same value'); }); }); // Dates QUnit.test('Date', assert => { const dates = [ new Date(-1e13), new Date(-1e12), new Date(-1e9), new Date(-1e6), new Date(-1e3), new Date(0), new Date(1e3), new Date(1e6), new Date(1e9), new Date(1e12), new Date(1e13), ]; for (const date of dates) cloneTest(date, (orig, clone) => { assert.notSame(orig, clone); assert.same(typeof clone, 'object'); assert.same(getPrototypeOf(orig), getPrototypeOf(clone)); assert.same(orig.valueOf(), clone.valueOf()); }); }); // Regular Expressions QUnit.test('RegExp', assert => { const regexes = [ new RegExp(), /abc/, /abc/g, /abc/i, /abc/gi, /abc/, /abc/g, /abc/i, /abc/gi, ]; const giuy = fromSource('/abc/giuy'); if (giuy) regexes.push(giuy); for (const regex of regexes) cloneObjectTest(assert, regex, (orig, clone) => { assert.same(orig.toString(), clone.toString(), `regex ${ regex }`); }); }); if (fromSource('ArrayBuffer.prototype.slice || DataView')) { // ArrayBuffer if (typeof Uint8Array == 'function') QUnit.test('ArrayBuffer', assert => { // Crashes cloneObjectTest(assert, new Uint8Array([0, 1, 254, 255]).buffer, (orig, clone) => { assert.arrayEqual(new Uint8Array(orig), new Uint8Array(clone)); }); }); // TODO SharedArrayBuffer // Array Buffer Views if (typeof Int8Array != 'undefined') { QUnit.test('%TypedArray%', assert => { const arrays = [ new Uint8Array([]), new Uint8Array([0, 1, 254, 255]), new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), new Int8Array([0, 1, 254, 255]), new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN]), new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN]), ]; if (typeof Uint8ClampedArray != 'undefined') { arrays.push(new Uint8ClampedArray([0, 1, 254, 255])); } for (const array of arrays) cloneObjectTest(assert, array, (orig, clone) => { assert.arrayEqual(orig, clone); }); }); if (typeof DataView != 'undefined') QUnit.test('DataView', assert => { const array = new Int8Array([1, 2, 3, 4]); const view = new DataView(array.buffer); cloneObjectTest(assert, array, (orig, clone) => { assert.same(orig.byteLength, clone.byteLength); assert.same(orig.byteOffset, clone.byteOffset); assert.arrayEqual(new Int8Array(view.buffer), array); }); }); } if ('resizable' in ArrayBuffer.prototype) { QUnit.test('Resizable ArrayBuffer', assert => { const array = [1, 2, 3, 4, 5, 6, 7, 8]; let buffer = new ArrayBuffer(8, { maxByteLength: 16 }); new Int8Array(buffer).set(array); let copy = structuredClone(buffer); assert.arrayEqual(bufferToArray(copy), array, 'resizable-ab-1'); assert.true(copy.resizable, 'resizable-ab-1'); buffer = new ArrayBuffer(8); new Int8Array(buffer).set(array); copy = structuredClone(buffer); assert.arrayEqual(bufferToArray(copy), array, 'non-resizable-ab-1'); assert.false(copy.resizable, 'non-resizable-ab-1'); buffer = new ArrayBuffer(8, { maxByteLength: 16 }); let tarray = new Int8Array(buffer); tarray.set(array); copy = structuredClone(tarray).buffer; assert.arrayEqual(bufferToArray(copy), array, 'resizable-ab-2'); assert.true(copy.resizable, 'resizable-ab-2'); buffer = new ArrayBuffer(8); tarray = new Int8Array(buffer); tarray.set(array); copy = structuredClone(tarray).buffer; assert.arrayEqual(bufferToArray(copy), array, 'non-resizable-ab-2'); assert.false(copy.resizable, 'non-resizable-ab-2'); }); } } // Map QUnit.test('Map', assert => { cloneObjectTest(assert, new Map([[1, 2], [3, 4]]), (orig, clone) => { assert.deepEqual(from(orig.keys()), from(clone.keys())); assert.deepEqual(from(orig.values()), from(clone.values())); }); }); // Set QUnit.test('Set', assert => { cloneObjectTest(assert, new Set([1, 2, 3, 4]), (orig, clone) => { assert.deepEqual(from(orig.values()), from(clone.values())); }); }); // Error QUnit.test('Error', assert => { const errors = [ ['Error', new Error()], ['Error', new Error('msg', { cause: 42 })], ['EvalError', new EvalError()], ['EvalError', new EvalError('msg', { cause: 42 })], ['RangeError', new RangeError()], ['RangeError', new RangeError('msg', { cause: 42 })], ['ReferenceError', new ReferenceError()], ['ReferenceError', new ReferenceError('msg', { cause: 42 })], ['SyntaxError', new SyntaxError()], ['SyntaxError', new SyntaxError('msg', { cause: 42 })], ['TypeError', new TypeError()], ['TypeError', new TypeError('msg', { cause: 42 })], ['URIError', new URIError()], ['URIError', new URIError('msg', { cause: 42 })], ['AggregateError', new AggregateError([1, 2])], ['AggregateError', new AggregateError([1, 2], 'msg', { cause: 42 })], ]; const compile = fromSource('WebAssembly.CompileError()'); const link = fromSource('WebAssembly.LinkError()'); const runtime = fromSource('WebAssembly.RuntimeError()'); if (compile && compile.name === 'CompileError') errors.push(['CompileError', compile]); if (link && link.name === 'LinkError') errors.push(['LinkError', link]); if (runtime && runtime.name === 'RuntimeError') errors.push(['RuntimeError', runtime]); for (const [name, error] of errors) cloneObjectTest(assert, error, (orig, clone) => { assert.same(orig.constructor, clone.constructor, `${ name }#constructor`); assert.same(orig.name, clone.name, `${ name }#name`); assert.same(orig.message, clone.message, `${ name }#message`); assert.same(orig.stack, clone.stack, `${ name }#stack`); assert.same(orig.cause, clone.cause, `${ name }#cause`); assert.deepEqual(orig.errors, clone.errors, `${ name }#errors`); }); }); // Arrays QUnit.test('Array', assert => { const arrays = [ [], [1, 2, 3], Array(1), assign( ['foo', 'bar'], { 10: true, 11: false, 20: 123, 21: 456, 30: null }), assign( ['foo', 'bar'], { a: true, b: false, foo: 123, bar: 456, '': null }), ]; for (const array of arrays) cloneObjectTest(assert, array, (orig, clone) => { assert.deepEqual(orig, clone, `array content should be same: ${ array }`); assert.deepEqual(orig.length, clone.length, `array length should be same: ${ array }`); assert.deepEqual(keys(orig), keys(clone), `array key should be same: ${ array }`); for (const key of keys(orig)) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); // Objects QUnit.test('Object', assert => { cloneObjectTest(assert, { foo: true, bar: false }, (orig, clone) => { assert.deepEqual(keys(orig), keys(clone)); for (const key of keys(orig)) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); // [Serializable] Platform objects // Geometry types if (typeof DOMMatrix == 'function') { QUnit.test('Geometry types, DOMMatrix', assert => { cloneObjectTest(assert, new DOMMatrix(), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMMatrixReadOnly == 'function' && typeof DOMMatrixReadOnly.fromMatrix == 'function') { QUnit.test('Geometry types, DOMMatrixReadOnly', assert => { cloneObjectTest(assert, new DOMMatrixReadOnly(), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMPoint == 'function') { QUnit.test('Geometry types, DOMPoint', assert => { cloneObjectTest(assert, new DOMPoint(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMPointReadOnly == 'function' && typeof DOMPointReadOnly.fromPoint == 'function') { QUnit.test('Geometry types, DOMPointReadOnly', assert => { cloneObjectTest(assert, new DOMPointReadOnly(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMQuad == 'function' && typeof DOMPoint == 'function') { QUnit.test('Geometry types, DOMQuad', assert => { cloneObjectTest(assert, new DOMQuad( new DOMPoint(1, 2, 3, 4), new DOMPoint(2, 2, 3, 4), new DOMPoint(1, 3, 3, 4), new DOMPoint(1, 2, 4, 4), ), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.deepEqual(orig[key], clone[key], `Property ${ key }`); } }); }); } if (fromSource('new DOMRect(1, 2, 3, 4)')) { QUnit.test('Geometry types, DOMRect', assert => { cloneObjectTest(assert, new DOMRect(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } if (typeof DOMRectReadOnly == 'function' && typeof DOMRectReadOnly.fromRect == 'function') { QUnit.test('Geometry types, DOMRectReadOnly', assert => { cloneObjectTest(assert, new DOMRectReadOnly(1, 2, 3, 4), (orig, clone) => { for (const key of keys(getPrototypeOf(orig))) { assert.same(orig[key], clone[key], `Property ${ key }`); } }); }); } // Safari 8- does not support `{ colorSpace }` option if (fromSource('new ImageData(new ImageData(8, 8).data, 8, 8, { colorSpace: new ImageData(8, 8).colorSpace })')) { QUnit.test('ImageData', assert => { const imageData = new ImageData(8, 8); for (let i = 0; i < 256; ++i) { imageData.data[i] = i; } cloneObjectTest(assert, imageData, (orig, clone) => { assert.same(orig.width, clone.width); assert.same(orig.height, clone.height); assert.same(orig.colorSpace, clone.colorSpace); assert.arrayEqual(orig.data, clone.data); }); }); } if (fromSource('new Blob(["test"])')) QUnit.test('Blob', assert => { cloneObjectTest( assert, new Blob(['This is a test.'], { type: 'a/b' }), (orig, clone) => { assert.same(orig.size, clone.size); assert.same(orig.type, clone.type); // TODO: async // assert.same(await orig.text(), await clone.text()); }); }); QUnit.test('DOMException', assert => { const errors = [ new DOMException(), new DOMException('foo', 'DataCloneError'), ]; for (const error of errors) cloneObjectTest(assert, error, (orig, clone) => { assert.same(orig.name, clone.name); assert.same(orig.message, clone.message); assert.same(orig.code, clone.code); assert.same(orig.stack, clone.stack); }); }); if (fromSource('new File(["test"], "foo.txt")')) QUnit.test('File', assert => { cloneObjectTest( assert, new File(['This is a test.'], 'foo.txt', { type: 'c/d' }), (orig, clone) => { assert.same(orig.size, clone.size); assert.same(orig.type, clone.type); assert.same(orig.name, clone.name); assert.same(orig.lastModified, clone.lastModified); // TODO: async // assert.same(await orig.text(), await clone.text()); }); }); // FileList if (fromSource('new File(["test"], "foo.txt")') && fromSource('new DataTransfer()')) QUnit.test('FileList', assert => { const transfer = new DataTransfer(); transfer.items.add(new File(['test'], 'foo.txt')); cloneObjectTest( assert, transfer.files, (orig, clone) => { assert.same(1, clone.length); assert.same(orig[0].size, clone[0].size); assert.same(orig[0].type, clone[0].type); assert.same(orig[0].name, clone[0].name); assert.same(orig[0].lastModified, clone[0].lastModified); }, ); }); // Non-serializable types QUnit.test('Non-serializable types', assert => { const nons = [ function () { return 1; }, Symbol('desc'), GLOBAL, ]; const event = fromSource('new Event("")'); const port = fromSource('new MessageChannel().port1'); // NodeJS events are simple objects if (event && !NODE) nons.push(event); if (port) nons.push(port); for (const it of nons) { // native NodeJS `structuredClone` throws a `TypeError` on transferable non-serializable instead of `DOMException` // https://github.com/nodejs/node/issues/40841 assert.throws(() => structuredClone(it)); } }); }); core-js-3.33.2/tests/unit-pure/web.url-search-params.js000066400000000000000000000730031451776221300227110ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants.js'; import { createIterable } from '../helpers/helpers.js'; import getPrototypeOf from 'core-js-pure/es/object/get-prototype-of'; import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor'; import Symbol from 'core-js-pure/es/symbol'; import URL from 'core-js-pure/stable/url'; import URLSearchParams from 'core-js-pure/stable/url-search-params'; QUnit.test('URLSearchParams', assert => { assert.isFunction(URLSearchParams); assert.arity(URLSearchParams, 0); assert.same(String(new URLSearchParams()), ''); assert.same(String(new URLSearchParams('')), ''); assert.same(String(new URLSearchParams('a=b')), 'a=b'); assert.same(String(new URLSearchParams(new URLSearchParams('a=b'))), 'a=b'); assert.same(String(new URLSearchParams([])), ''); assert.same(String(new URLSearchParams([[1, 2], ['a', 'b']])), '1=2&a=b'); assert.same(String(new URLSearchParams(createIterable([createIterable(['a', 'b']), createIterable(['c', 'd'])]))), 'a=b&c=d'); assert.same(String(new URLSearchParams({})), ''); assert.same(String(new URLSearchParams({ 1: 2, a: 'b' })), '1=2&a=b'); assert.same(String(new URLSearchParams('?a=b')), 'a=b', 'leading ? should be ignored'); assert.same(String(new URLSearchParams('??a=b')), '%3Fa=b'); assert.same(String(new URLSearchParams('?')), ''); assert.same(String(new URLSearchParams('??')), '%3F='); assert.same(String(new URLSearchParams('a=b c')), 'a=b+c'); assert.same(String(new URLSearchParams('a=b&b=c&a=d')), 'a=b&b=c&a=d'); assert.same(String(new URLSearchParams('a==')), 'a=%3D'); assert.same(String(new URLSearchParams('a=b=')), 'a=b%3D'); assert.same(String(new URLSearchParams('a=b=c')), 'a=b%3Dc'); assert.same(String(new URLSearchParams('a==b')), 'a=%3Db'); let params = new URLSearchParams('a=b'); assert.true(params.has('a'), 'search params object has name "a"'); assert.false(params.has('b'), 'search params object has not got name "b"'); params = new URLSearchParams('a=b&c'); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('c'), 'search params object has name "c"'); params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8'); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('a b'), 'search params object has name "a b"'); assert.true(params.has(' '), 'search params object has name " "'); assert.false(params.has('c'), 'search params object did not have the name "c"'); assert.true(params.has(' c'), 'search params object has name " c"'); assert.true(params.has('møø'), 'search params object has name "møø"'); params = new URLSearchParams('a=b+c'); assert.same(params.get('a'), 'b c', 'parse +'); params = new URLSearchParams('a+b=c'); assert.same(params.get('a b'), 'c', 'parse +'); params = new URLSearchParams('a=b c'); assert.same(params.get('a'), 'b c', 'parse " "'); params = new URLSearchParams('a b=c'); assert.same(params.get('a b'), 'c', 'parse " "'); params = new URLSearchParams('a=b%20c'); assert.same(params.get('a'), 'b c', 'parse %20'); params = new URLSearchParams('a%20b=c'); assert.same(params.get('a b'), 'c', 'parse %20'); params = new URLSearchParams('a=b\0c'); assert.same(params.get('a'), 'b\0c', 'parse \\0'); params = new URLSearchParams('a\0b=c'); assert.same(params.get('a\0b'), 'c', 'parse \\0'); params = new URLSearchParams('a=b%00c'); assert.same(params.get('a'), 'b\0c', 'parse %00'); params = new URLSearchParams('a%00b=c'); assert.same(params.get('a\0b'), 'c', 'parse %00'); params = new URLSearchParams('a=b\u2384'); assert.same(params.get('a'), 'b\u2384', 'parse \u2384'); params = new URLSearchParams('a\u2384b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse \u2384'); params = new URLSearchParams('a=b%e2%8e%84'); assert.same(params.get('a'), 'b\u2384', 'parse %e2%8e%84'); params = new URLSearchParams('a%e2%8e%84b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse %e2%8e%84'); params = new URLSearchParams('a=b\uD83D\uDCA9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a\uD83D\uDCA9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a=b%f0%9f%92%a9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); params = new URLSearchParams('a%f0%9f%92%a9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); params = new URLSearchParams(); params.set('query', '+15555555555'); assert.same(params.toString(), 'query=%2B15555555555'); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); params = new URLSearchParams(params.toString()); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); const testData = [ { input: '?a=%', output: [['a', '%']], name: 'handling %' }, { input: { '+': '%C2' }, output: [['+', '%C2']], name: 'object with +' }, { input: { c: 'x', a: '?' }, output: [['c', 'x'], ['a', '?']], name: 'object with two keys' }, { input: [['c', 'x'], ['a', '?']], output: [['c', 'x'], ['a', '?']], name: 'array with two keys' }, // eslint-disable-next-line @stylistic/js/max-len -- ignore // !!! { input: { 'a\0b': '42', 'c\uD83D': '23', dሴ: 'foo' }, output: [['a\0b', '42'], ['c\uFFFD', '23'], ['d\u1234', 'foo']], name: 'object with NULL, non-ASCII, and surrogate keys' }, ]; for (const { input, output, name } of testData) { params = new URLSearchParams(input); let i = 0; params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey, `construct with ${ name }`); assert.same(value, reqValue, `construct with ${ name }`); }); } assert.throws(() => { URLSearchParams(''); }, 'throws w/o `new`'); assert.throws(() => { new URLSearchParams([[1, 2, 3]]); }, 'sequence elements must be pairs #1'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1, 2, 3])])]); }, 'sequence elements must be pairs #2'); assert.throws(() => { new URLSearchParams([[1]]); }, 'sequence elements must be pairs #3'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1])])]); }, 'sequence elements must be pairs #4'); }); QUnit.test('URLSearchParams#append', assert => { const { append } = URLSearchParams.prototype; assert.isFunction(append); assert.arity(append, 2); assert.enumerable(URLSearchParams.prototype, 'append'); assert.same(new URLSearchParams().append('a', 'b'), undefined, 'void'); let params = new URLSearchParams(); params.append('a', 'b'); assert.same(String(params), 'a=b'); params.append('a', 'b'); assert.same(String(params), 'a=b&a=b'); params.append('a', 'c'); assert.same(String(params), 'a=b&a=b&a=c'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined'); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined&undefined=undefined'); params = new URLSearchParams(); params.append(null, null); assert.same(String(params), 'null=null'); params.append(null, null); assert.same(String(params), 'null=null&null=null'); params = new URLSearchParams(); params.append('first', 1); params.append('second', 2); params.append('third', ''); params.append('first', 10); assert.true(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.same(params.get('second'), '2', 'search params object has name "second" with value "2"'); assert.same(params.get('third'), '', 'search params object has name "third" with value ""'); params.append('first', 10); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.throws(() => { return new URLSearchParams('').append(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#delete', assert => { const $delete = URLSearchParams.prototype.delete; assert.isFunction($delete); assert.arity($delete, 1); assert.enumerable(URLSearchParams.prototype, 'delete'); let params = new URLSearchParams('a=b&c=d'); params.delete('a'); assert.same(String(params), 'c=d'); params = new URLSearchParams('a=a&b=b&a=a&c=c'); params.delete('a'); assert.same(String(params), 'b=b&c=c'); params = new URLSearchParams('a=a&=&b=b&c=c'); params.delete(''); assert.same(String(params), 'a=a&b=b&c=c'); params = new URLSearchParams('a=a&null=null&b=b'); params.delete(null); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams('a=a&undefined=undefined&b=b'); params.delete(undefined); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams(); params.append('first', 1); assert.true(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); params.delete('first'); assert.false(params.has('first'), 'search params object has no "first" name'); params.append('first', 1); params.append('first', 10); params.delete('first'); assert.false(params.has('first'), 'search params object has no "first" name'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', 2); assert.same(String(params), 'a=1&a=null&a=3&b=4'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', null); assert.same(String(params), 'a=1&a=2&a=3&b=4'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); params.delete('a', undefined); assert.same(String(params), 'b=4'); if (DESCRIPTORS) { let url = new URL('http://example.com/?param1¶m2'); url.searchParams.delete('param1'); url.searchParams.delete('param2'); assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); assert.same(url.search, '', 'url.search does not have ?'); url = new URL('http://example.com/?'); url.searchParams.delete('param1'); // assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); // Safari bug assert.same(url.search, '', 'url.search does not have ?'); } assert.throws(() => { return new URLSearchParams('').delete(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#get', assert => { const { get } = URLSearchParams.prototype; assert.isFunction(get); assert.arity(get, 1); assert.enumerable(URLSearchParams.prototype, 'get'); let params = new URLSearchParams('a=b&c=d'); assert.same(params.get('a'), 'b'); assert.same(params.get('c'), 'd'); assert.same(params.get('e'), null); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.get('a'), 'b'); params = new URLSearchParams('=b&c=d'); assert.same(params.get(''), 'b'); params = new URLSearchParams('a=&c=d&a=e'); assert.same(params.get('a'), ''); params = new URLSearchParams('first=second&third&&'); assert.true(params.has('first'), 'Search params object has name "first"'); assert.same(params.get('first'), 'second', 'Search params object has name "first" with value "second"'); assert.same(params.get('third'), '', 'Search params object has name "third" with the empty value.'); assert.same(params.get('fourth'), null, 'Search params object has no "fourth" name and value.'); assert.same(new URLSearchParams('a=b c').get('a'), 'b c'); assert.same(new URLSearchParams('a b=c').get('a b'), 'c'); assert.same(new URLSearchParams('a=b%20c').get('a'), 'b c', 'parse %20'); assert.same(new URLSearchParams('a%20b=c').get('a b'), 'c', 'parse %20'); assert.same(new URLSearchParams('a=b\0c').get('a'), 'b\0c', 'parse \\0'); assert.same(new URLSearchParams('a\0b=c').get('a\0b'), 'c', 'parse \\0'); assert.same(new URLSearchParams('a=b%2Bc').get('a'), 'b+c', 'parse %2B'); assert.same(new URLSearchParams('a%2Bb=c').get('a+b'), 'c', 'parse %2B'); assert.same(new URLSearchParams('a=b%00c').get('a'), 'b\0c', 'parse %00'); assert.same(new URLSearchParams('a%00b=c').get('a\0b'), 'c', 'parse %00'); assert.same(new URLSearchParams('a==').get('a'), '=', 'parse ='); assert.same(new URLSearchParams('a=b=').get('a'), 'b=', 'parse ='); assert.same(new URLSearchParams('a=b=c').get('a'), 'b=c', 'parse ='); assert.same(new URLSearchParams('a==b').get('a'), '=b', 'parse ='); assert.same(new URLSearchParams('a=b\u2384').get('a'), 'b\u2384', 'parse \\u2384'); assert.same(new URLSearchParams('a\u2384b=c').get('a\u2384b'), 'c', 'parse \\u2384'); assert.same(new URLSearchParams('a=b%e2%8e%84').get('a'), 'b\u2384', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a%e2%8e%84b=c').get('a\u2384b'), 'c', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a=b\uD83D\uDCA9c').get('a'), 'b\uD83D\uDCA9c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a\uD83D\uDCA9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a=b%f0%9f%92%a9c').get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('a%f0%9f%92%a9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('=').get(''), '', 'parse ='); assert.throws(() => { return new URLSearchParams('').get(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#getAll', assert => { const { getAll } = URLSearchParams.prototype; assert.isFunction(getAll); assert.arity(getAll, 1); assert.enumerable(URLSearchParams.prototype, 'getAll'); let params = new URLSearchParams('a=b&c=d'); assert.arrayEqual(params.getAll('a'), ['b']); assert.arrayEqual(params.getAll('c'), ['d']); assert.arrayEqual(params.getAll('e'), []); params = new URLSearchParams('a=b&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['b', 'e']); params = new URLSearchParams('=b&c=d'); assert.arrayEqual(params.getAll(''), ['b']); params = new URLSearchParams('a=&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['', 'e']); params = new URLSearchParams('a=1&a=2&a=3&a'); assert.arrayEqual(params.getAll('a'), ['1', '2', '3', ''], 'search params object has expected name "a" values'); params.set('a', 'one'); assert.arrayEqual(params.getAll('a'), ['one'], 'search params object has expected name "a" values'); assert.throws(() => { return new URLSearchParams('').getAll(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#has', assert => { const { has } = URLSearchParams.prototype; assert.isFunction(has); assert.arity(has, 1); assert.enumerable(URLSearchParams.prototype, 'has'); let params = new URLSearchParams('a=b&c=d'); assert.true(params.has('a')); assert.true(params.has('c')); assert.false(params.has('e')); params = new URLSearchParams('a=b&c=d&a=e'); assert.true(params.has('a')); params = new URLSearchParams('=b&c=d'); assert.true(params.has('')); params = new URLSearchParams('null=a'); assert.true(params.has(null)); params = new URLSearchParams('a=b&c=d&&'); params.append('first', 1); params.append('first', 2); assert.true(params.has('a'), 'search params object has name "a"'); assert.true(params.has('c'), 'search params object has name "c"'); assert.true(params.has('first'), 'search params object has name "first"'); assert.false(params.has('d'), 'search params object has no name "d"'); params.delete('first'); assert.false(params.has('first'), 'search params object has no name "first"'); params = new URLSearchParams('a=1&a=2&a=null&a=3&b=4'); assert.true(params.has('a', 2)); assert.true(params.has('a', null)); assert.false(params.has('a', 4)); assert.true(params.has('b', 4)); assert.false(params.has('b', null)); assert.true(params.has('b', undefined)); assert.false(params.has('c', undefined)); assert.throws(() => { return new URLSearchParams('').has(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#set', assert => { const { set } = URLSearchParams.prototype; assert.isFunction(set); assert.arity(set, 2); assert.enumerable(URLSearchParams.prototype, 'set'); let params = new URLSearchParams('a=b&c=d'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params = new URLSearchParams('a=b&c=d&a=e'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params.set('e', 'f'); assert.same(String(params), 'a=B&c=d&e=f'); params = new URLSearchParams('a=1&a=2&a=3'); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); params.set('first', 4); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); assert.same(String(params), 'a=1&a=2&a=3&first=4'); params.set('a', 4); assert.true(params.has('a'), 'search params object has name "a"'); assert.same(params.get('a'), '4', 'search params object has name "a" with value "4"'); assert.same(String(params), 'a=4&first=4'); assert.throws(() => { return new URLSearchParams('').set(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#sort', assert => { const { sort } = URLSearchParams.prototype; assert.isFunction(sort); assert.arity(sort, 0); assert.enumerable(URLSearchParams.prototype, 'sort'); let params = new URLSearchParams('a=1&b=4&a=3&b=2'); params.sort(); assert.same(String(params), 'a=1&a=3&b=4&b=2'); params.delete('a'); params.append('a', '0'); params.append('b', '0'); params.sort(); assert.same(String(params), 'a=0&b=4&b=2&b=0'); const testData = [ { input: 'z=b&a=b&z=a&a=a', output: [['a', 'b'], ['a', 'a'], ['z', 'b'], ['z', 'a']], }, { input: '\uFFFD=x&\uFFFC&\uFFFD=a', output: [['\uFFFC', ''], ['\uFFFD', 'x'], ['\uFFFD', 'a']], }, { input: 'ffi&🌈', // 🌈 > code point, but < code unit because two code units output: [['🌈', ''], ['ffi', '']], }, { input: 'é&e\uFFFD&e\u0301', output: [['e\u0301', ''], ['e\uFFFD', ''], ['é', '']], }, { input: 'z=z&a=a&z=y&a=b&z=x&a=c&z=w&a=d&z=v&a=e&z=u&a=f&z=t&a=g', output: [ ['a', 'a'], ['a', 'b'], ['a', 'c'], ['a', 'd'], ['a', 'e'], ['a', 'f'], ['a', 'g'], ['z', 'z'], ['z', 'y'], ['z', 'x'], ['z', 'w'], ['z', 'v'], ['z', 'u'], ['z', 't'], ], }, { input: 'bbb&bb&aaa&aa=x&aa=y', output: [['aa', 'x'], ['aa', 'y'], ['aaa', ''], ['bb', ''], ['bbb', '']], }, { input: 'z=z&=f&=t&=x', output: [['', 'f'], ['', 't'], ['', 'x'], ['z', 'z']], }, { input: 'a🌈&a💩', output: [['a🌈', ''], ['a💩', '']], }, ]; for (const { input, output } of testData) { let i = 0; params = new URLSearchParams(input); params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); i = 0; const url = new URL(`?${ input }`, 'https://example/'); params = url.searchParams; params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); } if (DESCRIPTORS) { const url = new URL('http://example.com/?'); url.searchParams.sort(); assert.same(url.href, 'http://example.com/', 'Sorting non-existent params removes ? from URL'); assert.same(url.search, '', 'Sorting non-existent params removes ? from URL'); } }); QUnit.test('URLSearchParams#toString', assert => { const { toString } = URLSearchParams.prototype; assert.isFunction(toString); assert.arity(toString, 0); let params = new URLSearchParams(); params.append('a', 'b c'); assert.same(String(params), 'a=b+c'); params.delete('a'); params.append('a b', 'c'); assert.same(String(params), 'a+b=c'); params = new URLSearchParams(); params.append('a', ''); assert.same(String(params), 'a='); params.append('a', ''); assert.same(String(params), 'a=&a='); params.append('', 'b'); assert.same(String(params), 'a=&a=&=b'); params.append('', ''); assert.same(String(params), 'a=&a=&=b&='); params.append('', ''); assert.same(String(params), 'a=&a=&=b&=&='); params = new URLSearchParams(); params.append('', 'b'); assert.same(String(params), '=b'); params.append('', 'b'); assert.same(String(params), '=b&=b'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append('a', 'b+c'); assert.same(String(params), 'a=b%2Bc'); params.delete('a'); params.append('a+b', 'c'); assert.same(String(params), 'a%2Bb=c'); params = new URLSearchParams(); params.append('=', 'a'); assert.same(String(params), '%3D=a'); params.append('b', '='); assert.same(String(params), '%3D=a&b=%3D'); params = new URLSearchParams(); params.append('&', 'a'); assert.same(String(params), '%26=a'); params.append('b', '&'); assert.same(String(params), '%26=a&b=%26'); params = new URLSearchParams(); params.append('a', '\r'); assert.same(String(params), 'a=%0D'); params = new URLSearchParams(); params.append('a', '\n'); assert.same(String(params), 'a=%0A'); params = new URLSearchParams(); params.append('a', '\r\n'); assert.same(String(params), 'a=%0D%0A'); params = new URLSearchParams(); params.append('a', 'b%c'); assert.same(String(params), 'a=b%25c'); params.delete('a'); params.append('a%b', 'c'); assert.same(String(params), 'a%25b=c'); params = new URLSearchParams(); params.append('a', 'b\0c'); assert.same(String(params), 'a=b%00c'); params.delete('a'); params.append('a\0b', 'c'); assert.same(String(params), 'a%00b=c'); params = new URLSearchParams(); params.append('a', 'b\uD83D\uDCA9c'); assert.same(String(params), 'a=b%F0%9F%92%A9c'); params.delete('a'); params.append('a\uD83D\uDCA9b', 'c'); assert.same(String(params), 'a%F0%9F%92%A9b=c'); params = new URLSearchParams('a=b&c=d&&e&&'); assert.same(String(params), 'a=b&c=d&e='); params = new URLSearchParams('a = b &a=b&c=d%20'); assert.same(String(params), 'a+=+b+&a=b&c=d+'); params = new URLSearchParams('a=&a=b'); assert.same(String(params), 'a=&a=b'); }); QUnit.test('URLSearchParams#forEach', assert => { const { forEach } = URLSearchParams.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.enumerable(URLSearchParams.prototype, 'forEach'); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let result = ''; params.forEach((value, key, that) => { assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); assert.same(that, params); result += key; }); assert.same(result, 'abc'); new URL('http://a.b/c').searchParams.forEach(() => { assert.avoid(); }); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); params = url.searchParams; result = ''; params.forEach((val, key) => { url.search = 'x=1&y=2&z=3'; result += key + val; }); assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); result = ''; params.forEach((value, key) => { params.delete('b'); result += key + value; }); assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#entries', assert => { const { entries } = URLSearchParams.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.enumerable(URLSearchParams.prototype, 'entries'); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params.entries(); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams.entries().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.entries(); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.entries(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().entries()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#keys', assert => { const { keys } = URLSearchParams.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.enumerable(URLSearchParams.prototype, 'keys'); let iterator = new URLSearchParams('a=1&b=2&c=3').keys(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams.keys().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const key = entry.value; url.search = 'x=1&y=2&z=3'; result += key; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.keys(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, 'ac'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().keys()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#values', assert => { const { values } = URLSearchParams.prototype; assert.isFunction(values); assert.arity(values, 0); assert.enumerable(URLSearchParams.prototype, 'values'); let iterator = new URLSearchParams('a=1&b=2&c=3').values(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, '123'); assert.true(new URL('http://a.b/c').searchParams.values().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=a&b=b&c=c&d=d'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const { value } = entry; url.search = 'x=x&y=y&z=z'; result += value; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.values(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, '13'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams().values()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#@@iterator', assert => { const entries = URLSearchParams.prototype[Symbol.iterator]; assert.isFunction(entries); assert.arity(entries, 0); assert.same(entries, URLSearchParams.prototype.entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params[Symbol.iterator](); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.true(new URL('http://a.b/c').searchParams[Symbol.iterator]().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); if (DESCRIPTORS) assert.true(getOwnPropertyDescriptor(getPrototypeOf(new URLSearchParams()[Symbol.iterator]()), 'next').enumerable, 'enumerable .next'); }); QUnit.test('URLSearchParams#size', assert => { const params = new URLSearchParams('a=1&b=2&b=3'); assert.true('size' in params); assert.same(params.size, 3); if (DESCRIPTORS) { assert.true('size' in URLSearchParams.prototype); const { enumerable, configurable, get } = getOwnPropertyDescriptor(URLSearchParams.prototype, 'size'); assert.true(enumerable, 'enumerable'); assert.true(configurable, 'configurable'); assert.throws(() => get.call([])); } }); core-js-3.33.2/tests/unit-pure/web.url.can-parse.js000066400000000000000000000031451451776221300220350ustar00rootroot00000000000000import canParse from 'core-js-pure/stable/url/can-parse'; QUnit.test('URL.canParse', assert => { assert.isFunction(canParse); assert.arity(canParse, 1); assert.name(canParse, 'canParse'); assert.false(canParse(undefined), 'undefined'); assert.false(canParse(undefined, undefined), 'undefined, undefined'); assert.true(canParse('q:w'), 'q:w'); assert.true(canParse('q:w', undefined), 'q:w, undefined'); // assert.false(canParse(undefined, 'q:w'), 'undefined, q:w'); // fails in Chromium on Windows assert.true(canParse('q:/w'), 'q:/w'); assert.true(canParse('q:/w', undefined), 'q:/w, undefined'); assert.true(canParse(undefined, 'q:/w'), 'undefined, q:/w'); assert.false(canParse('https://login:password@examp:le.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'https://login:password@examp:le.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.true(canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.true(canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment', undefined), 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment, undefined'); assert.true(canParse('x', 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'), 'x, https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); assert.throws(() => canParse(), 'no args'); assert.throws(() => canParse({ toString() { throw new Error('thrower'); } }), 'conversion thrower #1'); assert.throws(() => canParse('q:w', { toString() { throw new Error('thrower'); } }), 'conversion thrower #2'); }); core-js-3.33.2/tests/unit-pure/web.url.js000066400000000000000000000673471451776221300202030ustar00rootroot00000000000000/* eslint-disable es/no-object-getownpropertydescriptor, unicorn/relative-url-style -- required for testing */ import { DESCRIPTORS, NODE } from '../helpers/constants.js'; import urlTestData from '../wpt-url-resources/urltestdata.js'; import settersTestData from '../wpt-url-resources/setters.js'; import toASCIITestData from '../wpt-url-resources/toascii.js'; import URL from 'core-js-pure/stable/url'; import URLSearchParams from 'core-js-pure/stable/url-search-params'; const { hasOwnProperty } = Object.prototype; QUnit.test('URL constructor', assert => { assert.isFunction(URL); if (!NODE) assert.arity(URL, 1); assert.same(String(new URL('http://www.domain.com/a/b')), 'http://www.domain.com/a/b'); assert.same(String(new URL('/c/d', 'http://www.domain.com/a/b')), 'http://www.domain.com/c/d'); assert.same(String(new URL('b/c', 'http://www.domain.com/a/b')), 'http://www.domain.com/a/b/c'); assert.same(String(new URL('b/c', new URL('http://www.domain.com/a/b'))), 'http://www.domain.com/a/b/c'); assert.same(String(new URL({ toString: () => 'https://example.org/' })), 'https://example.org/'); assert.same(String(new URL('nonspecial://example.com/')), 'nonspecial://example.com/'); assert.same(String(new URL('https://測試')), 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(new URL('https://xxпривет.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('https://xxПРИВЕТ.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('http://Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https://Example.com/', 'https://example.org/')), 'https://example.com/'); assert.same(String(new URL('nonspecial://Example.com/', 'https://example.org/')), 'nonspecial://Example.com/'); assert.same(String(new URL('http:Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https:Example.com/', 'https://example.org/')), 'https://example.org/Example.com/'); assert.same(String(new URL('nonspecial:Example.com/', 'https://example.org/')), 'nonspecial:Example.com/'); assert.same(String(new URL('http://0300.168.0xF0')), 'http://192.168.0.240/'); assert.same(String(new URL('http://[20:0:0:1:0:0:0:ff]')), 'http://[20:0:0:1::ff]/'); // assert.same(String(new URL('http://257.168.0xF0')), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // TypeError in Chrome and Safari assert.same(String(new URL('http://0300.168.0xG0')), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(new URL('file:///var/log/system.log')), 'file:///var/log/system.log', 'file scheme'); // assert.same(String(new URL('file://nnsc.nsf.net/bar/baz')), 'file://nnsc.nsf.net/bar/baz', 'file scheme'); // 'file:///bar/baz' in FF // assert.same(String(new URL('file://localhost/bar/baz')), 'file:///bar/baz', 'file scheme'); // 'file://localhost/bar/baz' in Chrome assert.throws(() => new URL(), 'TypeError: Failed to construct URL: 1 argument required, but only 0 present.'); assert.throws(() => new URL(''), 'TypeError: Failed to construct URL: Invalid URL'); // Node 19.7 // https://github.com/nodejs/node/issues/46755 // assert.throws(() => new URL('', 'about:blank'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('abc'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('//abc'), 'TypeError: Failed to construct URL: Invalid URL'); assert.throws(() => new URL('http:///www.domain.com/', 'abc'), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('http:///www.domain.com/', null), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('//abc', null), 'TypeError: Failed to construct URL: Invalid base URL'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:ff'), 'incorrect IPv6'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:fg]'), 'incorrect IPv6'); // assert.throws(() => new URL('http://a%b'), 'forbidden host code point'); // no error in FF assert.throws(() => new URL('1http://zloirock.ru'), 'incorrect scheme'); }); QUnit.test('URL#href', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'href')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'href'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.href, 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.href, 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://測試'; assert.same(url.href, 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(url), 'https://xn--g6w251d/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxпривет.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxПРИВЕТ.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/'); assert.same(String(url), 'http://192.168.0.240/'); url = new URL('http://zloirock.ru/'); url.href = 'http://[20:0:0:1:0:0:0:ff]'; assert.same(url.href, 'http://[20:0:0:1::ff]/'); assert.same(String(url), 'http://[20:0:0:1::ff]/'); // url = new URL('http://zloirock.ru/'); // url.href = 'http://257.168.0xF0'; // TypeError and Safari // assert.same(url.href, 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome // assert.same(String(url), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xG0'; assert.same(url.href, 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(url), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); url = new URL('http://192.168.0.240/'); url.href = 'file:///var/log/system.log'; assert.same(url.href, 'file:///var/log/system.log', 'file -> ip'); assert.same(String(url), 'file:///var/log/system.log', 'file -> ip'); url = new URL('file:///var/log/system.log'); url.href = 'http://0300.168.0xF0'; // Node 19.7 // https://github.com/nodejs/node/issues/46755 // assert.same(url.href, 'http://192.168.0.240/', 'file -> http'); // assert.same(String(url), 'http://192.168.0.240/', 'file -> http'); // assert.throws(() => new URL('http://zloirock.ru/').href = undefined, 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '//abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:ff', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:fg]', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://a%b', 'forbidden host code point'); // no error in Chrome and FF // assert.throws(() => new URL('http://zloirock.ru/').href = '1http://zloirock.ru', 'incorrect scheme'); // no error in Chrome } }); QUnit.test('URL#origin', assert => { const url = new URL('http://es6.zloirock.ru/tests.html'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'origin')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'origin'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); } assert.same(url.origin, 'http://es6.zloirock.ru'); assert.same(new URL('https://測試/tests').origin, 'https://xn--g6w251d'); }); QUnit.test('URL#protocol', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'protocol')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'protocol'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.protocol, 'http:'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.protocol = 'https'; assert.same(url.protocol, 'https:'); assert.same(String(url), 'https://zloirock.ru/'); // https://nodejs.org/api/url.html#url_special_schemes // url = new URL('http://zloirock.ru/'); // url.protocol = 'fish'; // assert.same(url.protocol, 'http:'); // assert.same(url.href, 'http://zloirock.ru/'); // assert.same(String(url), 'http://zloirock.ru/'); url = new URL('http://zloirock.ru/'); url.protocol = '1http'; assert.same(url.protocol, 'http:'); assert.same(url.href, 'http://zloirock.ru/', 'incorrect scheme'); assert.same(String(url), 'http://zloirock.ru/', 'incorrect scheme'); } }); QUnit.test('URL#username', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'username')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'username'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.username, ''); url = new URL('http://username@zloirock.ru/'); assert.same(url.username, 'username'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; assert.same(url.username, 'username'); assert.same(String(url), 'http://username@zloirock.ru/'); } }); QUnit.test('URL#password', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'password')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'password'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.password, ''); url = new URL('http://username:password@zloirock.ru/'); assert.same(url.password, 'password'); // url = new URL('http://:password@zloirock.ru/'); // TypeError in FF // assert.same(url.password, 'password'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; url.password = 'password'; assert.same(url.password, 'password'); assert.same(String(url), 'http://username:password@zloirock.ru/'); // url = new URL('http://zloirock.ru/'); // url.password = 'password'; // assert.same(url.password, 'password'); // '' in FF // assert.same(String(url), 'http://:password@zloirock.ru/'); // 'http://zloirock.ru/' in FF } }); QUnit.test('URL#host', assert => { let url = new URL('http://zloirock.ru:81/path'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'host')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'host'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.host, 'zloirock.ru:81'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/path'); url.host = 'example.com:82'; assert.same(url.host, 'example.com:82'); assert.same(String(url), 'http://example.com:82/path'); // url = new URL('http://zloirock.ru:81/path'); // url.host = 'other?domain.com'; // assert.same(String(url), 'http://other:81/path'); // 'http://other/?domain.com/path' in Safari url = new URL('https://www.mydomain.com:8080/path/'); url.host = 'www.otherdomain.com:80'; assert.same(url.href, 'https://www.otherdomain.com:80/path/', 'set default port for another protocol'); // url = new URL('https://www.mydomain.com:8080/path/'); // url.host = 'www.otherdomain.com:443'; // assert.same(url.href, 'https://www.otherdomain.com/path/', 'set default port'); url = new URL('http://zloirock.ru/foo'); url.host = '測試'; assert.same(url.host, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxпривет.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxПРИВЕТ.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = '0300.168.0xF0'; assert.same(url.host, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.host = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.host, '[20:0:0:1::ff]'); // ':0' in Chrome, 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://[20:0/foo' in Chrome, 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.host = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:ff'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = 'a%b'; // assert.same(url.host, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#hostname', assert => { let url = new URL('http://zloirock.ru:81/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'hostname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hostname'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hostname, 'zloirock.ru'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/'); url.hostname = 'example.com'; assert.same(url.hostname, 'example.com'); assert.same(String(url), 'http://example.com:81/'); // url = new URL('http://zloirock.ru:81/'); // url.hostname = 'example.com:82'; // assert.same(url.hostname, 'example.com'); // '' in Chrome // assert.same(String(url), 'http://example.com:81/'); // 'http://example.com:82:81/' in Chrome url = new URL('http://zloirock.ru/foo'); url.hostname = '測試'; assert.same(url.hostname, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxпривет.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxПРИВЕТ.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = '0300.168.0xF0'; assert.same(url.hostname, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.hostname = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.hostname, '[20:0:0:1::ff]'); // 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.hostname = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:ff'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff/' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = 'a%b'; // assert.same(url.hostname, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#port', assert => { let url = new URL('http://zloirock.ru:1337/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'port')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'port'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.port, '1337'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.port = 80; assert.same(url.port, ''); assert.same(String(url), 'http://zloirock.ru/'); url.port = 1337; assert.same(url.port, '1337'); assert.same(String(url), 'http://zloirock.ru:1337/'); // url.port = 'abcd'; // assert.same(url.port, '1337'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1337/'); // 'http://zloirock.ru:0/' in Chrome // url.port = '5678abcd'; // assert.same(url.port, '5678'); // '1337' in FF // assert.same(String(url), 'http://zloirock.ru:5678/'); // 'http://zloirock.ru:1337/"' in FF url.port = 1234.5678; assert.same(url.port, '1234'); assert.same(String(url), 'http://zloirock.ru:1234/'); // url.port = 1e10; // assert.same(url.port, '1234'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1234/'); // 'http://zloirock.ru:0/' in Chrome } }); QUnit.test('URL#pathname', assert => { let url = new URL('http://zloirock.ru/foo/bar'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'pathname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'pathname'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.pathname, '/foo/bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.pathname = 'bar/baz'; assert.same(url.pathname, '/bar/baz'); assert.same(String(url), 'http://zloirock.ru/bar/baz'); } }); QUnit.test('URL#search', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'search')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'search'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.search, ''); url = new URL('http://zloirock.ru/?foo=bar'); assert.same(url.search, '?foo=bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/?'); assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/?'); url.search = 'foo=bar'; assert.same(url.search, '?foo=bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url.search = '?bar=baz'; assert.same(url.search, '?bar=baz'); assert.same(String(url), 'http://zloirock.ru/?bar=baz'); url.search = ''; assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/'); } }); QUnit.test('URL#searchParams', assert => { let url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'searchParams')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'searchParams'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); } assert.true(url.searchParams instanceof URLSearchParams); assert.same(url.searchParams.get('foo'), 'bar'); assert.same(url.searchParams.get('bar'), 'baz'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.searchParams.append('foo', 'bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/'); url.search = 'foo=bar'; assert.same(url.searchParams.get('foo'), 'bar'); url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); url.search = ''; assert.false(url.searchParams.has('foo')); } }); QUnit.test('URL#hash', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.false(hasOwnProperty.call(url, 'hash')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hash'); assert.true(descriptor.enumerable); assert.true(descriptor.configurable); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hash, ''); url = new URL('http://zloirock.ru/#foo'); assert.same(url.hash, '#foo'); url = new URL('http://zloirock.ru/#'); assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/#'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/#'); url.hash = 'foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = ''; assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/'); // url.hash = '#'; // assert.same(url.hash, ''); // assert.same(String(url), 'http://zloirock.ru/'); // 'http://zloirock.ru/#' in FF url.hash = '#foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = '#foo#bar'; assert.same(url.hash, '#foo#bar'); assert.same(String(url), 'http://zloirock.ru/#foo#bar'); url = new URL('http://zloirock.ru/'); url.hash = 'абa'; assert.same(url.hash, '#%D0%B0%D0%B1a'); // url = new URL('http://zloirock.ru/'); // url.hash = '\udc01\ud802a'; // assert.same(url.hash, '#%EF%BF%BD%EF%BF%BDa', 'unmatched surrogates'); } }); QUnit.test('URL#toJSON', assert => { const { toJSON } = URL.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 0); assert.enumerable(URL.prototype, 'toJSON'); const url = new URL('http://zloirock.ru/'); assert.same(url.toJSON(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toJSON(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#toString', assert => { const { toString } = URL.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.enumerable(URL.prototype, 'toString'); const url = new URL('http://zloirock.ru/'); assert.same(url.toString(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toString(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL.sham', assert => { assert.same(URL.sham, DESCRIPTORS ? undefined : true); }); // `core-js` URL implementation pass all (exclude some encoding-related) tests // from the next 3 test cases, but URLs from all of popular browsers fail a serious part of tests. // Replacing all of them does not looks like a good idea, so next test cases disabled by default. // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT URL constructor tests', assert => { for (const expected of urlTestData) { if (typeof expected == 'string') continue; const name = `Parsing: <${ expected.input }> against <${ expected.base }>`; if (expected.failure) { assert.throws(() => new URL(expected.input, expected.base || 'about:blank'), name); } else { const url = new URL(expected.input, expected.base || 'about:blank'); assert.same(url.href, expected.href, `${ name }: href`); assert.same(url.protocol, expected.protocol, `${ name }: protocol`); assert.same(url.username, expected.username, `${ name }: username`); assert.same(url.password, expected.password, `${ name }: password`); assert.same(url.host, expected.host, `${ name }: host`); assert.same(url.hostname, expected.hostname, `${ name }: hostname`); assert.same(url.port, expected.port, `${ name }: port`); assert.same(url.pathname, expected.pathname, `${ name }: pathname`); assert.same(url.search, expected.search, `${ name }: search`); if ('searchParams' in expected) { assert.same(url.searchParams.toString(), expected.searchParams, `${ name }: searchParams`); } assert.same(url.hash, expected.hash, `${ name }: hash`); if ('origin' in expected) { assert.same(url.origin, expected.origin, `${ name }: origin`); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url if (DESCRIPTORS) QUnit.skip('WPT URL setters tests', assert => { for (const setter in settersTestData) { const testCases = settersTestData[setter]; for (const { href, newValue, comment, expected } of testCases) { let name = `Setting <${ href }>.${ setter } = '${ newValue }'.`; if (comment) name += ` ${ comment }`; const url = new URL(href); url[setter] = newValue; for (const attribute in expected) { assert.same(url[attribute], expected[attribute], name); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT conversion to ASCII tests', assert => { for (const { comment, input, output } of toASCIITestData) { let name = `Parsing: <${ input }>`; if (comment) name += ` ${ comment }`; if (output === null) { assert.throws(() => new URL(`https://${ input }/x`), name); } else { const url = new URL(`https://${ input }/x`); assert.same(url.host, output, name); assert.same(url.hostname, output, name); assert.same(url.pathname, '/x', name); assert.same(url.href, `https://${ output }/x`, name); } } }); core-js-3.33.2/tests/worker/000077500000000000000000000000001451776221300156275ustar00rootroot00000000000000core-js-3.33.2/tests/worker/index.html000066400000000000000000000001531451776221300176230ustar00rootroot00000000000000 Worker test core-js-3.33.2/tests/worker/runner.js000066400000000000000000000004561451776221300175030ustar00rootroot00000000000000'use strict'; importScripts('../../packages/core-js-bundle/index.js'); postMessage(typeof core != 'undefined'); setImmediate(function () { postMessage('setImmediate'); }); // eslint-disable-next-line es/no-promise -- safe Promise.resolve().then(function () { postMessage('Promise.resolve'); }); core-js-3.33.2/tests/worker/test.js000066400000000000000000000005061451776221300171450ustar00rootroot00000000000000'use strict'; var worker = new Worker('./worker/runner.js'); worker.addEventListener('error', function (e) { // eslint-disable-next-line no-console -- output console.error(e); }); worker.addEventListener('message', function (message) { // eslint-disable-next-line no-console -- output console.log(message.data); }); core-js-3.33.2/tests/wpt-url-resources/000077500000000000000000000000001451776221300177405ustar00rootroot00000000000000core-js-3.33.2/tests/wpt-url-resources/setters.js000066400000000000000000001264261451776221300220020ustar00rootroot00000000000000// Copyright © web-platform-tests contributors // Originally from https://github.com/web-platform-tests/wpt // Available under the 3-Clause BSD License https://github.com/web-platform-tests/wpt/blob/master/LICENSE.md /* eslint-disable no-script-url -- required for testing */ export default { protocol: [ { comment: 'The empty string is not a valid scheme. Setter leaves the URL unchanged.', href: 'a://example.net', newValue: '', expected: { href: 'a://example.net', protocol: 'a:', }, }, { href: 'a://example.net', newValue: 'b', expected: { href: 'b://example.net', protocol: 'b:', }, }, { href: 'javascript:alert(1)', newValue: 'defuse', expected: { href: 'defuse:alert(1)', protocol: 'defuse:', }, }, { comment: 'Upper-case ASCII is lower-cased', href: 'a://example.net', newValue: 'B', expected: { href: 'b://example.net', protocol: 'b:', }, }, { comment: 'Non-ASCII is rejected', href: 'a://example.net', newValue: 'é', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'No leading digit', href: 'a://example.net', newValue: '0b', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'No leading punctuation', href: 'a://example.net', newValue: '+b', expected: { href: 'a://example.net', protocol: 'a:', }, }, { href: 'a://example.net', newValue: 'bC0+-.', expected: { href: 'bc0+-.://example.net', protocol: 'bc0+-.:', }, }, { comment: 'Only some punctuation is acceptable', href: 'a://example.net', newValue: 'b,c', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'Non-ASCII is rejected', href: 'a://example.net', newValue: 'bé', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'Can’t switch from URL containing username/password/port to file', href: 'http://test@example.net', newValue: 'file', expected: { href: 'http://test@example.net/', protocol: 'http:', }, }, { href: 'wss://x:x@example.net:1234', newValue: 'file', expected: { href: 'wss://x:x@example.net:1234/', protocol: 'wss:', }, }, { comment: 'Can’t switch from file URL with no host', href: 'file://localhost/', newValue: 'http', expected: { href: 'file:///', protocol: 'file:', }, }, { href: 'file:', newValue: 'wss', expected: { href: 'file:///', protocol: 'file:', }, }, { comment: 'Can’t switch from special scheme to non-special', href: 'http://example.net', newValue: 'b', expected: { href: 'http://example.net/', protocol: 'http:', }, }, { href: 'file://hi/path', newValue: 's', expected: { href: 'file://hi/path', protocol: 'file:', }, }, { href: 'https://example.net', newValue: 's', expected: { href: 'https://example.net/', protocol: 'https:', }, }, { href: 'ftp://example.net', newValue: 'test', expected: { href: 'ftp://example.net/', protocol: 'ftp:', }, }, { comment: 'Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.', href: 'mailto:me@example.net', newValue: 'http', expected: { href: 'mailto:me@example.net', protocol: 'mailto:', }, }, { comment: 'Can’t switch from non-special scheme to special', href: 'ssh://me@example.net', newValue: 'http', expected: { href: 'ssh://me@example.net', protocol: 'ssh:', }, }, { href: 'ssh://me@example.net', newValue: 'file', expected: { href: 'ssh://me@example.net', protocol: 'ssh:', }, }, { href: 'ssh://example.net', newValue: 'file', expected: { href: 'ssh://example.net', protocol: 'ssh:', }, }, { href: 'nonsense:///test', newValue: 'https', expected: { href: 'nonsense:///test', protocol: 'nonsense:', }, }, { comment: "Stuff after the first ':' is ignored", href: 'http://example.net', newValue: 'https:foo : bar', expected: { href: 'https://example.net/', protocol: 'https:', }, }, { comment: "Stuff after the first ':' is ignored", href: 'data:text/html,

Test', newValue: 'view-source+data:foo : bar', expected: { href: 'view-source+data:text/html,

Test', protocol: 'view-source+data:', }, }, { comment: 'Port is set to null if it is the default for new scheme.', href: 'http://foo.com:443/', newValue: 'https', expected: { href: 'https://foo.com/', protocol: 'https:', port: '', }, }, ], username: [ { comment: 'No host means no username', href: 'file:///home/you/index.html', newValue: 'me', expected: { href: 'file:///home/you/index.html', username: '', }, }, { comment: 'No host means no username', href: 'unix:/run/foo.socket', newValue: 'me', expected: { href: 'unix:/run/foo.socket', username: '', }, }, { comment: 'Cannot-be-a-base means no username', href: 'mailto:you@example.net', newValue: 'me', expected: { href: 'mailto:you@example.net', username: '', }, }, { href: 'javascript:alert(1)', newValue: 'wario', expected: { href: 'javascript:alert(1)', username: '', }, }, { href: 'http://example.net', newValue: 'me', expected: { href: 'http://me@example.net/', username: 'me', }, }, { href: 'http://:secret@example.net', newValue: 'me', expected: { href: 'http://me:secret@example.net/', username: 'me', }, }, { href: 'http://me@example.net', newValue: '', expected: { href: 'http://example.net/', username: '', }, }, { href: 'http://me:secret@example.net', newValue: '', expected: { href: 'http://:secret@example.net/', username: '', }, }, { comment: 'UTF-8 percent encoding with the userinfo encode set.', href: 'http://example.net', newValue: "\u0000\u0001\t\n\r\u001F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007F\u0080\u0081Éé", expected: { href: "http://%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/", username: "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is.', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://%c3%89t%C3%A9@example.net/', username: '%c3%89t%C3%A9', }, }, { href: 'sc:///', newValue: 'x', expected: { href: 'sc:///', username: '', }, }, { href: 'javascript://x/', newValue: 'wario', expected: { href: 'javascript://wario@x/', username: 'wario', }, }, { href: 'file://test/', newValue: 'test', expected: { href: 'file://test/', username: '', }, }, ], password: [ { comment: 'No host means no password', href: 'file:///home/me/index.html', newValue: 'secret', expected: { href: 'file:///home/me/index.html', password: '', }, }, { comment: 'No host means no password', href: 'unix:/run/foo.socket', newValue: 'secret', expected: { href: 'unix:/run/foo.socket', password: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'mailto:me@example.net', newValue: 'secret', expected: { href: 'mailto:me@example.net', password: '', }, }, { href: 'http://example.net', newValue: 'secret', expected: { href: 'http://:secret@example.net/', password: 'secret', }, }, { href: 'http://me@example.net', newValue: 'secret', expected: { href: 'http://me:secret@example.net/', password: 'secret', }, }, { href: 'http://:secret@example.net', newValue: '', expected: { href: 'http://example.net/', password: '', }, }, { href: 'http://me:secret@example.net', newValue: '', expected: { href: 'http://me@example.net/', password: '', }, }, { comment: 'UTF-8 percent encoding with the userinfo encode set.', href: 'http://example.net', newValue: "\u0000\u0001\t\n\r\u001F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007F\u0080\u0081Éé", expected: { href: "http://:%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/", password: "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is.', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://:%c3%89t%C3%A9@example.net/', password: '%c3%89t%C3%A9', }, }, { href: 'sc:///', newValue: 'x', expected: { href: 'sc:///', password: '', }, }, { href: 'javascript://x/', newValue: 'bowser', expected: { href: 'javascript://:bowser@x/', password: 'bowser', }, }, { href: 'file://test/', newValue: 'test', expected: { href: 'file://test/', password: '', }, }, ], host: [ { comment: 'Non-special scheme', href: 'sc://x/', newValue: '\u0000', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '\u0009', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000A', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000D', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: ' ', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '#', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '/', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '?', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '@', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: 'ß', expected: { href: 'sc://%C3%9F/', host: '%C3%9F', hostname: '%C3%9F', }, }, { comment: 'IDNA Nontransitional_Processing', href: 'https://x/', newValue: 'ß', expected: { href: 'https://xn--zca/', host: 'xn--zca', hostname: 'xn--zca', }, }, { comment: 'Cannot-be-a-base means no host', href: 'mailto:me@example.net', newValue: 'example.com', expected: { href: 'mailto:me@example.net', host: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'data:text/plain,Stuff', newValue: 'example.net', expected: { href: 'data:text/plain,Stuff', host: '', }, }, { href: 'http://example.net', newValue: 'example.com:8080', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port number is unchanged if not specified in the new value', href: 'http://example.net:8080', newValue: 'example.com', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port number is unchanged if not specified', href: 'http://example.net:8080', newValue: 'example.com:', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'The empty host is not valid for special schemes', href: 'http://example.net', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', }, }, { comment: 'The empty host is OK for non-special schemes', href: 'view-source+http://example.net/foo', newValue: '', expected: { href: 'view-source+http:///foo', host: '', }, }, { comment: 'Path-only URLs can gain a host', href: 'a:/foo', newValue: 'example.net', expected: { href: 'a://example.net/foo', host: 'example.net', }, }, { comment: 'IPv4 address syntax is normalized', href: 'http://example.net', newValue: '0x7F000001:8080', expected: { href: 'http://127.0.0.1:8080/', host: '127.0.0.1:8080', hostname: '127.0.0.1', port: '8080', }, }, { comment: 'IPv6 address syntax is normalized', href: 'http://example.net', newValue: '[::0:01]:2', expected: { href: 'http://[::1]:2/', host: '[::1]:2', hostname: '[::1]', port: '2', }, }, { comment: 'Default port number is removed', href: 'http://example.net', newValue: 'example.com:80', expected: { href: 'http://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Default port number is removed', href: 'https://example.net', newValue: 'example.com:443', expected: { href: 'https://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Default port number is only removed for the relevant scheme', href: 'https://example.net', newValue: 'example.com:80', expected: { href: 'https://example.com:80/', host: 'example.com:80', hostname: 'example.com', port: '80', }, }, { comment: 'Port number is removed if new port is scheme default and existing URL has a non-default port', href: 'http://example.net:8080', newValue: 'example.com:80', expected: { href: 'http://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com/stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080/stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com?stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080?stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com#stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080#stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com:8080\\stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: '\\ is not a delimiter for non-special schemes, but still forbidden in hosts', href: 'view-source+http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'view-source+http://example.net/path', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'view-source+http://example.net/path', newValue: 'example.com:8080stuff2', expected: { href: 'view-source+http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: 'example.com:8080stuff2', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: 'example.com:8080+2', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers', href: 'http://example.net/path', newValue: 'example.com:65535', expected: { href: 'http://example.com:65535/path', host: 'example.com:65535', hostname: 'example.com', port: '65535', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though.', href: 'http://example.net/path', newValue: 'example.com:65536', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Broken IPv6', href: 'http://example.net/', newValue: '[google.com]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.4x]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'file://y/', newValue: 'x:123', expected: { href: 'file://y/', host: 'y', hostname: 'y', port: '', }, }, { href: 'file://y/', newValue: 'loc%41lhost', expected: { href: 'file:///', host: '', hostname: '', port: '', }, }, { href: 'file://hi/x', newValue: '', expected: { href: 'file:///x', host: '', hostname: '', port: '', }, }, { href: 'sc://test@test/', newValue: '', expected: { href: 'sc://test@test/', host: 'test', hostname: 'test', username: 'test', }, }, { href: 'sc://test:12/', newValue: '', expected: { href: 'sc://test:12/', host: 'test:12', hostname: 'test', port: '12', }, }, ], hostname: [ { comment: 'Non-special scheme', href: 'sc://x/', newValue: '\u0000', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '\u0009', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000A', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000D', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: ' ', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '#', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '/', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '?', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '@', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { comment: 'Cannot-be-a-base means no host', href: 'mailto:me@example.net', newValue: 'example.com', expected: { href: 'mailto:me@example.net', host: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'data:text/plain,Stuff', newValue: 'example.net', expected: { href: 'data:text/plain,Stuff', host: '', }, }, { href: 'http://example.net:8080', newValue: 'example.com', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'The empty host is not valid for special schemes', href: 'http://example.net', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', }, }, { comment: 'The empty host is OK for non-special schemes', href: 'view-source+http://example.net/foo', newValue: '', expected: { href: 'view-source+http:///foo', host: '', }, }, { comment: 'Path-only URLs can gain a host', href: 'a:/foo', newValue: 'example.net', expected: { href: 'a://example.net/foo', host: 'example.net', }, }, { comment: 'IPv4 address syntax is normalized', href: 'http://example.net:8080', newValue: '0x7F000001', expected: { href: 'http://127.0.0.1:8080/', host: '127.0.0.1:8080', hostname: '127.0.0.1', port: '8080', }, }, { comment: 'IPv6 address syntax is normalized', href: 'http://example.net', newValue: '[::0:01]', expected: { href: 'http://[::1]/', host: '[::1]', hostname: '[::1]', port: '', }, }, { comment: 'Stuff after a : delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a : delimiter is ignored', href: 'http://example.net:8080/path', newValue: 'example.com:', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com/stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com?stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com#stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: '\\ is not a delimiter for non-special schemes, but still forbidden in hosts', href: 'view-source+http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'view-source+http://example.net/path', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Broken IPv6', href: 'http://example.net/', newValue: '[google.com]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.4x]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'file://y/', newValue: 'x:123', expected: { href: 'file://y/', host: 'y', hostname: 'y', port: '', }, }, { href: 'file://y/', newValue: 'loc%41lhost', expected: { href: 'file:///', host: '', hostname: '', port: '', }, }, { href: 'file://hi/x', newValue: '', expected: { href: 'file:///x', host: '', hostname: '', port: '', }, }, { href: 'sc://test@test/', newValue: '', expected: { href: 'sc://test@test/', host: 'test', hostname: 'test', username: 'test', }, }, { href: 'sc://test:12/', newValue: '', expected: { href: 'sc://test:12/', host: 'test:12', hostname: 'test', port: '12', }, }, ], port: [ { href: 'http://example.net', newValue: '8080', expected: { href: 'http://example.net:8080/', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port number is removed if empty is the new value', href: 'http://example.net:8080', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is removed', href: 'http://example.net:8080', newValue: '80', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is removed', href: 'https://example.net:4433', newValue: '443', expected: { href: 'https://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is only removed for the relevant scheme', href: 'https://example.net', newValue: '80', expected: { href: 'https://example.net:80/', host: 'example.net:80', hostname: 'example.net', port: '80', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: '8080/stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: '8080?stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: '8080#stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: '8080\\stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'view-source+http://example.net/path', newValue: '8080stuff2', expected: { href: 'view-source+http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: '8080stuff2', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: '8080+2', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers', href: 'http://example.net/path', newValue: '65535', expected: { href: 'http://example.net:65535/path', host: 'example.net:65535', hostname: 'example.net', port: '65535', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error', href: 'http://example.net:8080/path', newValue: '65536', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error', href: 'non-special://example.net:8080/path', newValue: '65536', expected: { href: 'non-special://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { href: 'file://test/', newValue: '12', expected: { href: 'file://test/', port: '', }, }, { href: 'file://localhost/', newValue: '12', expected: { href: 'file:///', port: '', }, }, { href: 'non-base:value', newValue: '12', expected: { href: 'non-base:value', port: '', }, }, { href: 'sc:///', newValue: '12', expected: { href: 'sc:///', port: '', }, }, { href: 'sc://x/', newValue: '12', expected: { href: 'sc://x:12/', port: '12', }, }, { href: 'javascript://x/', newValue: '12', expected: { href: 'javascript://x:12/', port: '12', }, }, ], pathname: [ { comment: 'Cannot-be-a-base don’t have a path', href: 'mailto:me@example.net', newValue: '/foo', expected: { href: 'mailto:me@example.net', pathname: 'me@example.net', }, }, { href: 'unix:/run/foo.socket?timeout=10', newValue: '/var/log/../run/bar.socket', expected: { href: 'unix:/var/run/bar.socket?timeout=10', pathname: '/var/run/bar.socket', }, }, { href: 'https://example.net#nav', newValue: 'home', expected: { href: 'https://example.net/home#nav', pathname: '/home', }, }, { href: 'https://example.net#nav', newValue: '../home', expected: { href: 'https://example.net/home#nav', pathname: '/home', }, }, { comment: "\\ is a segment delimiter for 'special' URLs", href: 'http://example.net/home?lang=fr#nav', newValue: '\\a\\%2E\\b\\%2e.\\c', expected: { href: 'http://example.net/a/c?lang=fr#nav', pathname: '/a/c', }, }, { comment: "\\ is *not* a segment delimiter for non-'special' URLs", href: 'view-source+http://example.net/home?lang=fr#nav', newValue: '\\a\\%2E\\b\\%2e.\\c', expected: { href: 'view-source+http://example.net/\\a\\%2E\\b\\%2e.\\c?lang=fr#nav', pathname: '/\\a\\%2E\\b\\%2e.\\c', }, }, { comment: 'UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007F\u0080\u0081Éé", expected: { href: "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", pathname: "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is, including %2E outside dotted segments.', href: 'http://example.net', newValue: '%2e%2E%c3%89té', expected: { href: 'http://example.net/%2e%2E%c3%89t%C3%A9', pathname: '/%2e%2E%c3%89t%C3%A9', }, }, { comment: '? needs to be encoded', href: 'http://example.net', newValue: '?', expected: { href: 'http://example.net/%3F', pathname: '/%3F', }, }, { comment: '# needs to be encoded', href: 'http://example.net', newValue: '#', expected: { href: 'http://example.net/%23', pathname: '/%23', }, }, { comment: '? needs to be encoded, non-special scheme', href: 'sc://example.net', newValue: '?', expected: { href: 'sc://example.net/%3F', pathname: '/%3F', }, }, { comment: '# needs to be encoded, non-special scheme', href: 'sc://example.net', newValue: '#', expected: { href: 'sc://example.net/%23', pathname: '/%23', }, }, { comment: 'File URLs and (back)slashes', href: 'file://monkey/', newValue: '\\\\', expected: { href: 'file://monkey/', pathname: '/', }, }, { comment: 'File URLs and (back)slashes', href: 'file:///unicorn', newValue: '//\\/', expected: { href: 'file:///', pathname: '/', }, }, { comment: 'File URLs and (back)slashes', href: 'file:///unicorn', newValue: '//monkey/..//', expected: { href: 'file:///', pathname: '/', }, }, ], search: [ { href: 'https://example.net#nav', newValue: 'lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: 'lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '?lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '??lang=fr', expected: { href: 'https://example.net/??lang=fr#nav', search: '??lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '?', expected: { href: 'https://example.net/?#nav', search: '', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '', expected: { href: 'https://example.net/#nav', search: '', }, }, { href: 'https://example.net?lang=en-US', newValue: '', expected: { href: 'https://example.net/', search: '', }, }, { href: 'https://example.net', newValue: '', expected: { href: 'https://example.net/', search: '', }, }, /* URI malformed { comment: 'UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "a:/?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", search: "?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, */ { comment: 'Bytes already percent-encoded are left as-is', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://example.net/?%c3%89t%C3%A9', search: '?%c3%89t%C3%A9', }, }, ], hash: [ { href: 'https://example.net', newValue: 'main', expected: { href: 'https://example.net/#main', hash: '#main', }, }, { href: 'https://example.net#nav', newValue: 'main', expected: { href: 'https://example.net/#main', hash: '#main', }, }, { href: 'https://example.net?lang=en-US', newValue: '##nav', expected: { href: 'https://example.net/?lang=en-US##nav', hash: '##nav', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '#main', expected: { href: 'https://example.net/?lang=en-US#main', hash: '#main', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '#', expected: { href: 'https://example.net/?lang=en-US#', hash: '', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '', expected: { href: 'https://example.net/?lang=en-US', hash: '', }, }, { href: 'http://example.net', newValue: '#foo bar', expected: { href: 'http://example.net/#foo%20bar', hash: '#foo%20bar', }, }, { href: 'http://example.net', newValue: '#foo"bar', expected: { href: 'http://example.net/#foo%22bar', hash: '#foo%22bar', }, }, { href: 'http://example.net', newValue: '#foobar', expected: { href: 'http://example.net/#foo%3Ebar', hash: '#foo%3Ebar', }, }, { href: 'http://example.net', newValue: '#foo`bar', expected: { href: 'http://example.net/#foo%60bar', hash: '#foo%60bar', }, }, { comment: 'Simple percent-encoding; nuls, tabs, and newlines are removed', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007F\u0080\u0081Éé", expected: { href: "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", hash: "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://example.net/#%c3%89t%C3%A9', hash: '#%c3%89t%C3%A9', }, }, { href: 'javascript:alert(1)', newValue: 'castle', expected: { href: 'javascript:alert(1)#castle', hash: '#castle', }, }, ], }; core-js-3.33.2/tests/wpt-url-resources/toascii.js000066400000000000000000000111671451776221300217370ustar00rootroot00000000000000// Copyright © web-platform-tests contributors // Originally from https://github.com/web-platform-tests/wpt // Available under the 3-Clause BSD License https://github.com/web-platform-tests/wpt/blob/master/LICENSE.md /* eslint-disable @stylistic/js/max-len -- ignore */ export default [ { comment: 'Label with hyphens in 3rd and 4th position', input: 'aa--', output: 'aa--', }, { input: 'a†--', output: 'xn--a---kp0a', }, { input: 'ab--c', output: 'ab--c', }, { comment: 'Label with leading hyphen', input: '-x', output: '-x', }, { input: '-†', output: 'xn----xhn', }, { input: '-x.xn--nxa', output: '-x.xn--nxa', }, { input: '-x.β', output: '-x.xn--nxa', }, { comment: 'Label with trailing hyphen', input: 'x-.xn--nxa', output: 'x-.xn--nxa', }, { input: 'x-.β', output: 'x-.xn--nxa', }, { comment: 'Empty labels', input: 'x..xn--nxa', output: 'x..xn--nxa', }, { input: 'x..β', output: 'x..xn--nxa', }, { comment: 'Invalid Punycode', input: 'xn--a', output: null, }, { input: 'xn--a.xn--nxa', output: null, }, { input: 'xn--a.β', output: null, }, { comment: 'Valid Punycode', input: 'xn--nxa.xn--nxa', output: 'xn--nxa.xn--nxa', }, { comment: 'Mixed', input: 'xn--nxa.β', output: 'xn--nxa.xn--nxa', }, { input: 'ab--c.xn--nxa', output: 'ab--c.xn--nxa', }, { input: 'ab--c.β', output: 'ab--c.xn--nxa', }, { comment: 'CheckJoiners is true', input: '\u200D.example', output: null, }, { input: 'xn--1ug.example', output: null, }, { comment: 'CheckBidi is true', input: 'يa', output: null, }, { input: 'xn--a-yoc', output: null, }, { comment: 'processing_option is Nontransitional_Processing', input: 'ශ්‍රී', output: 'xn--10cl1a0b660p', }, { input: 'نامه‌ای', output: 'xn--mgba3gch31f060k', }, { comment: 'U+FFFD', input: '\uFFFD.com', output: null, }, { comment: 'U+FFFD character encoded in Punycode', input: 'xn--zn7c.com', output: null, }, { comment: 'Label longer than 63 code points', input: 'x01234567890123456789012345678901234567890123456789012345678901x', output: 'x01234567890123456789012345678901234567890123456789012345678901x', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901†', output: 'xn--x01234567890123456789012345678901234567890123456789012345678901-6963b', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', output: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901x.β', output: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', }, { comment: 'Domain excluding TLD longer than 253 code points', input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x', }, { input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', }, { input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', }, ]; core-js-3.33.2/tests/wpt-url-resources/urltestdata.js000066400000000000000000004106771451776221300226510ustar00rootroot00000000000000// Copyright © web-platform-tests contributors // Originally from https://github.com/web-platform-tests/wpt // Available under the 3-Clause BSD License https://github.com/web-platform-tests/wpt/blob/master/LICENSE.md /* eslint-disable no-script-url -- required for testing */ export default [ '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js', { input: 'http://example\t.\norg', base: 'http://example.org/foo/bar', href: 'http://example.org/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://user:pass@foo:21/bar;par?b#c', base: 'http://example.org/foo/bar', href: 'http://user:pass@foo:21/bar;par?b#c', origin: 'http://foo:21', protocol: 'http:', username: 'user', password: 'pass', host: 'foo:21', hostname: 'foo', port: '21', pathname: '/bar;par', search: '?b', hash: '#c', }, { input: 'https://test:@test', base: 'about:blank', href: 'https://test@test/', origin: 'https://test', protocol: 'https:', username: 'test', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://:@test', base: 'about:blank', href: 'https://test/', origin: 'https://test', protocol: 'https:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://test:@test/x', base: 'about:blank', href: 'non-special://test@test/x', origin: 'null', protocol: 'non-special:', username: 'test', password: '', host: 'test', hostname: 'test', port: '', pathname: '/x', search: '', hash: '', }, { input: 'non-special://:@test/x', base: 'about:blank', href: 'non-special://test/x', origin: 'null', protocol: 'non-special:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/x', search: '', hash: '', }, { input: 'http:foo.com', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/foo.com', search: '', hash: '', }, { input: '\t :foo.com \n', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com', search: '', hash: '', }, { input: ' foo.com ', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/foo.com', search: '', hash: '', }, { input: 'a:\t foo.com', base: 'http://example.org/foo/bar', href: 'a: foo.com', origin: 'null', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: ' foo.com', search: '', hash: '', }, { input: 'http://f:21/ b ? d # e ', base: 'http://example.org/foo/bar', href: 'http://f:21/%20b%20?%20d%20#%20e', origin: 'http://f:21', protocol: 'http:', username: '', password: '', host: 'f:21', hostname: 'f', port: '21', pathname: '/%20b%20', search: '?%20d%20', hash: '#%20e', }, { input: 'lolscheme:x x#x x', base: 'about:blank', href: 'lolscheme:x x#x%20x', protocol: 'lolscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'x x', search: '', hash: '#x%20x', }, { input: 'http://f:/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:0/c', base: 'http://example.org/foo/bar', href: 'http://f:0/c', origin: 'http://f:0', protocol: 'http:', username: '', password: '', host: 'f:0', hostname: 'f', port: '0', pathname: '/c', search: '', hash: '', }, { input: 'http://f:00000000000000/c', base: 'http://example.org/foo/bar', href: 'http://f:0/c', origin: 'http://f:0', protocol: 'http:', username: '', password: '', host: 'f:0', hostname: 'f', port: '0', pathname: '/c', search: '', hash: '', }, { input: 'http://f:00000000000000000000080/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:b/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f: /c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f:\n/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:fifty-two/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f:999999/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'non-special://f:999999/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f: 21 / b ? d # e ', base: 'http://example.org/foo/bar', failure: true, }, { input: '', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: ' \t', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: ':foo.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com/', search: '', hash: '', }, { input: ':foo.com\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com/', search: '', hash: '', }, { input: ':', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:', search: '', hash: '', }, { input: ':a', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:a', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:a', search: '', hash: '', }, { input: ':/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:/', search: '', hash: '', }, { input: ':\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:/', search: '', hash: '', }, { input: ':#', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:#', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:', search: '', hash: '', }, { input: '#', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: '#/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#/', }, { input: '#\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#\\', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#\\', }, { input: '#;?', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#;?', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#;?', }, { input: '?', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar?', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: '/', base: 'http://example.org/foo/bar', href: 'http://example.org/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/', search: '', hash: '', }, { input: ':23', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:23', search: '', hash: '', }, { input: '/:23', base: 'http://example.org/foo/bar', href: 'http://example.org/:23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/:23', search: '', hash: '', }, { input: '::', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/::', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/::', search: '', hash: '', }, { input: '::23', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/::23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/::23', search: '', hash: '', }, { input: 'foo://', base: 'http://example.org/foo/bar', href: 'foo://', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: 'http://a:b@c:29/d', base: 'http://example.org/foo/bar', href: 'http://a:b@c:29/d', origin: 'http://c:29', protocol: 'http:', username: 'a', password: 'b', host: 'c:29', hostname: 'c', port: '29', pathname: '/d', search: '', hash: '', }, { input: 'http::@c:29', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:@c:29', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:@c:29', search: '', hash: '', }, { input: 'http://&a:foo(b]c@d:2/', base: 'http://example.org/foo/bar', href: 'http://&a:foo(b%5Dc@d:2/', origin: 'http://d:2', protocol: 'http:', username: '&a', password: 'foo(b%5Dc', host: 'd:2', hostname: 'd', port: '2', pathname: '/', search: '', hash: '', }, { input: 'http://::@c@d:2', base: 'http://example.org/foo/bar', href: 'http://:%3A%40c@d:2/', origin: 'http://d:2', protocol: 'http:', username: '', password: '%3A%40c', host: 'd:2', hostname: 'd', port: '2', pathname: '/', search: '', hash: '', }, { input: 'http://foo.com:b@d/', base: 'http://example.org/foo/bar', href: 'http://foo.com:b@d/', origin: 'http://d', protocol: 'http:', username: 'foo.com', password: 'b', host: 'd', hostname: 'd', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://foo.com/\\@', base: 'http://example.org/foo/bar', href: 'http://foo.com//@', origin: 'http://foo.com', protocol: 'http:', username: '', password: '', host: 'foo.com', hostname: 'foo.com', port: '', pathname: '//@', search: '', hash: '', }, { input: 'http:\\\\foo.com\\', base: 'http://example.org/foo/bar', href: 'http://foo.com/', origin: 'http://foo.com', protocol: 'http:', username: '', password: '', host: 'foo.com', hostname: 'foo.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:\\\\a\\b:c\\d@foo.com\\', base: 'http://example.org/foo/bar', href: 'http://a/b:c/d@foo.com/', origin: 'http://a', protocol: 'http:', username: '', password: '', host: 'a', hostname: 'a', port: '', pathname: '/b:c/d@foo.com/', search: '', hash: '', }, { input: 'foo:/', base: 'http://example.org/foo/bar', href: 'foo:/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'foo:/bar.com/', base: 'http://example.org/foo/bar', href: 'foo:/bar.com/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/bar.com/', search: '', hash: '', }, { input: 'foo://///////', base: 'http://example.org/foo/bar', href: 'foo://///////', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '///////', search: '', hash: '', }, { input: 'foo://///////bar.com/', base: 'http://example.org/foo/bar', href: 'foo://///////bar.com/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '///////bar.com/', search: '', hash: '', }, { input: 'foo:////://///', base: 'http://example.org/foo/bar', href: 'foo:////://///', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//://///', search: '', hash: '', }, { input: 'c:/foo', base: 'http://example.org/foo/bar', href: 'c:/foo', origin: 'null', protocol: 'c:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/foo', search: '', hash: '', }, { input: '//foo/bar', base: 'http://example.org/foo/bar', href: 'http://foo/bar', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/bar', search: '', hash: '', }, { input: 'http://foo/path;a??e#f#g', base: 'http://example.org/foo/bar', href: 'http://foo/path;a??e#f#g', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/path;a', search: '??e', hash: '#f#g', }, { input: 'http://foo/abcd?efgh?ijkl', base: 'http://example.org/foo/bar', href: 'http://foo/abcd?efgh?ijkl', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/abcd', search: '?efgh?ijkl', hash: '', }, { input: 'http://foo/abcd#foo?bar', base: 'http://example.org/foo/bar', href: 'http://foo/abcd#foo?bar', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/abcd', search: '', hash: '#foo?bar', }, { input: '[61:24:74]:98', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/[61:24:74]:98', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/[61:24:74]:98', search: '', hash: '', }, { input: 'http:[61:27]/:foo', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/[61:27]/:foo', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/[61:27]/:foo', search: '', hash: '', }, { input: 'http://[1::2]:3:4', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1]', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1]:80', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://[2001::1]', base: 'http://example.org/foo/bar', href: 'http://[2001::1]/', origin: 'http://[2001::1]', protocol: 'http:', username: '', password: '', host: '[2001::1]', hostname: '[2001::1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[::127.0.0.1]', base: 'http://example.org/foo/bar', href: 'http://[::7f00:1]/', origin: 'http://[::7f00:1]', protocol: 'http:', username: '', password: '', host: '[::7f00:1]', hostname: '[::7f00:1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[0:0:0:0:0:0:13.1.68.3]', base: 'http://example.org/foo/bar', href: 'http://[::d01:4403]/', origin: 'http://[::d01:4403]', protocol: 'http:', username: '', password: '', host: '[::d01:4403]', hostname: '[::d01:4403]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[2001::1]:80', base: 'http://example.org/foo/bar', href: 'http://[2001::1]/', origin: 'http://[2001::1]', protocol: 'http:', username: '', password: '', host: '[2001::1]', hostname: '[2001::1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/example.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/example.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ftp:/example.com/', base: 'http://example.org/foo/bar', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:/example.com/', base: 'http://example.org/foo/bar', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:/example.com/', base: 'http://example.org/foo/bar', href: 'madeupscheme:/example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file:/example.com/', base: 'http://example.org/foo/bar', href: 'file:///example.com/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file://example:1/', base: 'about:blank', failure: true, }, { input: 'file://example:test/', base: 'about:blank', failure: true, }, { input: 'file://example%/', base: 'about:blank', failure: true, }, { input: 'file://[example]/', base: 'about:blank', failure: true, }, { input: 'ftps:/example.com/', base: 'http://example.org/foo/bar', href: 'ftps:/example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ws:/example.com/', base: 'http://example.org/foo/bar', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:/example.com/', base: 'http://example.org/foo/bar', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/example.com/', base: 'http://example.org/foo/bar', href: 'data:/example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'javascript:/example.com/', base: 'http://example.org/foo/bar', href: 'javascript:/example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'mailto:/example.com/', base: 'http://example.org/foo/bar', href: 'mailto:/example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'http:example.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/example.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/example.com/', search: '', hash: '', }, { input: 'ftp:example.com/', base: 'http://example.org/foo/bar', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:example.com/', base: 'http://example.org/foo/bar', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:example.com/', base: 'http://example.org/foo/bar', href: 'madeupscheme:example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ftps:example.com/', base: 'http://example.org/foo/bar', href: 'ftps:example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ws:example.com/', base: 'http://example.org/foo/bar', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:example.com/', base: 'http://example.org/foo/bar', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:example.com/', base: 'http://example.org/foo/bar', href: 'data:example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'javascript:example.com/', base: 'http://example.org/foo/bar', href: 'javascript:example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'mailto:example.com/', base: 'http://example.org/foo/bar', href: 'mailto:example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: '/a/b/c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/b/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/b/c', search: '', hash: '', }, { input: '/a/ /c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/%20/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/%20/c', search: '', hash: '', }, { input: '/a%2fc', base: 'http://example.org/foo/bar', href: 'http://example.org/a%2fc', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a%2fc', search: '', hash: '', }, { input: '/a/%2f/c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/%2f/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/%2f/c', search: '', hash: '', }, { input: '#β', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#%CE%B2', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#%CE%B2', }, { input: 'data:text/html,test#test', base: 'http://example.org/foo/bar', href: 'data:text/html,test#test', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'text/html,test', search: '', hash: '#test', }, { input: 'tel:1234567890', base: 'http://example.org/foo/bar', href: 'tel:1234567890', origin: 'null', protocol: 'tel:', username: '', password: '', host: '', hostname: '', port: '', pathname: '1234567890', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file.html', { input: 'file:c:\\foo\\bar.html', base: 'file:///tmp/mock/path', href: 'file:///c:/foo/bar.html', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar.html', search: '', hash: '', }, { input: ' File:c|////foo\\bar.html', base: 'file:///tmp/mock/path', href: 'file:///c:////foo/bar.html', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:////foo/bar.html', search: '', hash: '', }, { input: 'C|/foo/bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '/C|\\foo\\bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '//C|/foo/bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '//server/file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: '\\\\server\\file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: '/\\server/file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: 'file:///foo/bar.txt', base: 'file:///tmp/mock/path', href: 'file:///foo/bar.txt', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/foo/bar.txt', search: '', hash: '', }, { input: 'file:///home/me', base: 'file:///tmp/mock/path', href: 'file:///home/me', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/home/me', search: '', hash: '', }, { input: '//', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '///', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '///test', base: 'file:///tmp/mock/path', href: 'file:///test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '', hash: '', }, { input: 'file://test', base: 'file:///tmp/mock/path', href: 'file://test/', protocol: 'file:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost/', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost/test', base: 'file:///tmp/mock/path', href: 'file:///test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '', hash: '', }, { input: 'test', base: 'file:///tmp/mock/path', href: 'file:///tmp/mock/test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/tmp/mock/test', search: '', hash: '', }, { input: 'file:test', base: 'file:///tmp/mock/path', href: 'file:///tmp/mock/test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/tmp/mock/test', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js', { input: 'http://example.com/././foo', base: 'about:blank', href: 'http://example.com/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://example.com/./.foo', base: 'about:blank', href: 'http://example.com/.foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/.foo', search: '', hash: '', }, { input: 'http://example.com/foo/.', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/./', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar/..', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/..bar', base: 'about:blank', href: 'http://example.com/foo/..bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/..bar', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../ton', base: 'about:blank', href: 'http://example.com/foo/ton', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/ton', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../ton/../../a', base: 'about:blank', href: 'http://example.com/a', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/a', search: '', hash: '', }, { input: 'http://example.com/foo/../../..', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://example.com/foo/../../../ton', base: 'about:blank', href: 'http://example.com/ton', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/ton', search: '', hash: '', }, { input: 'http://example.com/foo/%2e', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/%2e%2', base: 'about:blank', href: 'http://example.com/foo/%2e%2', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/%2e%2', search: '', hash: '', }, { input: 'http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar', base: 'about:blank', href: 'http://example.com/%2e.bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%2e.bar', search: '', hash: '', }, { input: 'http://example.com////../..', base: 'about:blank', href: 'http://example.com//', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '//', search: '', hash: '', }, { input: 'http://example.com/foo/bar//../..', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar//..', base: 'about:blank', href: 'http://example.com/foo/bar/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/bar/', search: '', hash: '', }, { input: 'http://example.com/foo', base: 'about:blank', href: 'http://example.com/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://example.com/%20foo', base: 'about:blank', href: 'http://example.com/%20foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%20foo', search: '', hash: '', }, { input: 'http://example.com/foo%', base: 'about:blank', href: 'http://example.com/foo%', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%', search: '', hash: '', }, { input: 'http://example.com/foo%2', base: 'about:blank', href: 'http://example.com/foo%2', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2', search: '', hash: '', }, { input: 'http://example.com/foo%2zbar', base: 'about:blank', href: 'http://example.com/foo%2zbar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2zbar', search: '', hash: '', }, { input: 'http://example.com/foo%2©zbar', base: 'about:blank', href: 'http://example.com/foo%2%C3%82%C2%A9zbar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2%C3%82%C2%A9zbar', search: '', hash: '', }, { input: 'http://example.com/foo%41%7a', base: 'about:blank', href: 'http://example.com/foo%41%7a', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%41%7a', search: '', hash: '', }, { input: 'http://example.com/foo\t\u0091%91', base: 'about:blank', href: 'http://example.com/foo%C2%91%91', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%C2%91%91', search: '', hash: '', }, { input: 'http://example.com/foo%00%51', base: 'about:blank', href: 'http://example.com/foo%00%51', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%00%51', search: '', hash: '', }, { input: 'http://example.com/(%28:%3A%29)', base: 'about:blank', href: 'http://example.com/(%28:%3A%29)', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/(%28:%3A%29)', search: '', hash: '', }, { input: 'http://example.com/%3A%3a%3C%3c', base: 'about:blank', href: 'http://example.com/%3A%3a%3C%3c', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%3A%3a%3C%3c', search: '', hash: '', }, { input: 'http://example.com/foo\tbar', base: 'about:blank', href: 'http://example.com/foobar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foobar', search: '', hash: '', }, { input: 'http://example.com\\\\foo\\\\bar', base: 'about:blank', href: 'http://example.com//foo//bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '//foo//bar', search: '', hash: '', }, { input: 'http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd', base: 'about:blank', href: 'http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%7Ffp3%3Eju%3Dduvgw%3Dd', search: '', hash: '', }, { input: 'http://example.com/@asdf%40', base: 'about:blank', href: 'http://example.com/@asdf%40', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/@asdf%40', search: '', hash: '', }, { input: 'http://example.com/你好你好', base: 'about:blank', href: 'http://example.com/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD', search: '', hash: '', }, { input: 'http://example.com/‥/foo', base: 'about:blank', href: 'http://example.com/%E2%80%A5/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E2%80%A5/foo', search: '', hash: '', }, { input: 'http://example.com//foo', base: 'about:blank', href: 'http://example.com/%EF%BB%BF/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%EF%BB%BF/foo', search: '', hash: '', }, { input: 'http://example.com/‮/foo/‭/bar', base: 'about:blank', href: 'http://example.com/%E2%80%AE/foo/%E2%80%AD/bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E2%80%AE/foo/%E2%80%AD/bar', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js', { input: 'http://www.google.com/foo?bar=baz#', base: 'about:blank', href: 'http://www.google.com/foo?bar=baz#', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '?bar=baz', hash: '', }, { input: 'http://www.google.com/foo?bar=baz# »', base: 'about:blank', href: 'http://www.google.com/foo?bar=baz#%20%C2%BB', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '?bar=baz', hash: '#%20%C2%BB', }, { input: 'data:test# »', base: 'about:blank', href: 'data:test#%20%C2%BB', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '', hash: '#%20%C2%BB', }, { input: 'http://www.google.com', base: 'about:blank', href: 'http://www.google.com/', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://192.0x00A80001', base: 'about:blank', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://www/foo%2Ehtml', base: 'about:blank', href: 'http://www/foo%2Ehtml', origin: 'http://www', protocol: 'http:', username: '', password: '', host: 'www', hostname: 'www', port: '', pathname: '/foo%2Ehtml', search: '', hash: '', }, { input: 'http://www/foo/%2E/html', base: 'about:blank', href: 'http://www/foo/html', origin: 'http://www', protocol: 'http:', username: '', password: '', host: 'www', hostname: 'www', port: '', pathname: '/foo/html', search: '', hash: '', }, { input: 'http://user:pass@/', base: 'about:blank', failure: true, }, { input: 'http://%25DOMAIN:foobar@foodomain.com/', base: 'about:blank', href: 'http://%25DOMAIN:foobar@foodomain.com/', origin: 'http://foodomain.com', protocol: 'http:', username: '%25DOMAIN', password: 'foobar', host: 'foodomain.com', hostname: 'foodomain.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:\\\\www.google.com\\foo', base: 'about:blank', href: 'http://www.google.com/foo', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://foo:80/', base: 'about:blank', href: 'http://foo/', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://foo:81/', base: 'about:blank', href: 'http://foo:81/', origin: 'http://foo:81', protocol: 'http:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'httpa://foo:80/', base: 'about:blank', href: 'httpa://foo:80/', origin: 'null', protocol: 'httpa:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'http://foo:-80/', base: 'about:blank', failure: true, }, { input: 'https://foo:443/', base: 'about:blank', href: 'https://foo/', origin: 'https://foo', protocol: 'https:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://foo:80/', base: 'about:blank', href: 'https://foo:80/', origin: 'https://foo:80', protocol: 'https:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'ftp://foo:21/', base: 'about:blank', href: 'ftp://foo/', origin: 'ftp://foo', protocol: 'ftp:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp://foo:80/', base: 'about:blank', href: 'ftp://foo:80/', origin: 'ftp://foo:80', protocol: 'ftp:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:80/', base: 'about:blank', href: 'ws://foo/', origin: 'ws://foo', protocol: 'ws:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:81/', base: 'about:blank', href: 'ws://foo:81/', origin: 'ws://foo:81', protocol: 'ws:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:443/', base: 'about:blank', href: 'ws://foo:443/', origin: 'ws://foo:443', protocol: 'ws:', username: '', password: '', host: 'foo:443', hostname: 'foo', port: '443', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:815/', base: 'about:blank', href: 'ws://foo:815/', origin: 'ws://foo:815', protocol: 'ws:', username: '', password: '', host: 'foo:815', hostname: 'foo', port: '815', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:80/', base: 'about:blank', href: 'wss://foo:80/', origin: 'wss://foo:80', protocol: 'wss:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:81/', base: 'about:blank', href: 'wss://foo:81/', origin: 'wss://foo:81', protocol: 'wss:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:443/', base: 'about:blank', href: 'wss://foo/', origin: 'wss://foo', protocol: 'wss:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:815/', base: 'about:blank', href: 'wss://foo:815/', origin: 'wss://foo:815', protocol: 'wss:', username: '', password: '', host: 'foo:815', hostname: 'foo', port: '815', pathname: '/', search: '', hash: '', }, { input: 'http:/example.com/', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp:/example.com/', base: 'about:blank', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:/example.com/', base: 'about:blank', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:/example.com/', base: 'about:blank', href: 'madeupscheme:/example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file:/example.com/', base: 'about:blank', href: 'file:///example.com/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ftps:/example.com/', base: 'about:blank', href: 'ftps:/example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ws:/example.com/', base: 'about:blank', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:/example.com/', base: 'about:blank', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/example.com/', base: 'about:blank', href: 'data:/example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'javascript:/example.com/', base: 'about:blank', href: 'javascript:/example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'mailto:/example.com/', base: 'about:blank', href: 'mailto:/example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'http:example.com/', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp:example.com/', base: 'about:blank', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:example.com/', base: 'about:blank', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:example.com/', base: 'about:blank', href: 'madeupscheme:example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ftps:example.com/', base: 'about:blank', href: 'ftps:example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ws:example.com/', base: 'about:blank', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:example.com/', base: 'about:blank', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:example.com/', base: 'about:blank', href: 'data:example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'javascript:example.com/', base: 'about:blank', href: 'javascript:example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'mailto:example.com/', base: 'about:blank', href: 'mailto:example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/segments-userinfo-vs-host.html', { input: 'http:@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://@pple.com', base: 'about:blank', href: 'http://pple.com/', origin: 'http://pple.com', protocol: 'http:', username: '', password: '', host: 'pple.com', hostname: 'pple.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http::b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/:b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://:b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://user@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://@/www.example.com', base: 'about:blank', failure: true, }, { input: 'https:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http::@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://www.@pple.com', base: 'about:blank', href: 'http://www.@pple.com/', origin: 'http://pple.com', protocol: 'http:', username: 'www.', password: '', host: 'pple.com', hostname: 'pple.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http://@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http://:@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, '# Others', { input: '/', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: '/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '.', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: '..', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: './test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '../test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '../aaa/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/aaa/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/aaa/test.txt', search: '', hash: '', }, { input: '../../test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '中/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/%E4%B8%AD/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/%E4%B8%AD/test.txt', search: '', hash: '', }, { input: 'http://www.example2.com', base: 'http://www.example.com/test', href: 'http://www.example2.com/', origin: 'http://www.example2.com', protocol: 'http:', username: '', password: '', host: 'www.example2.com', hostname: 'www.example2.com', port: '', pathname: '/', search: '', hash: '', }, { input: '//www.example2.com', base: 'http://www.example.com/test', href: 'http://www.example2.com/', origin: 'http://www.example2.com', protocol: 'http:', username: '', password: '', host: 'www.example2.com', hostname: 'www.example2.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:...', base: 'http://www.example.com/test', href: 'file:///...', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/...', search: '', hash: '', }, { input: 'file:..', base: 'http://www.example.com/test', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:a', base: 'http://www.example.com/test', href: 'file:///a', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/a', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html', 'Basic canonicalization, uppercase should be converted to lowercase', { input: 'http://ExAmPlE.CoM', base: 'http://other.com/', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://example example.com', base: 'http://other.com/', failure: true, }, { input: 'http://Goo%20 goo%7C|.com', base: 'http://other.com/', failure: true, }, { input: 'http://[]', base: 'http://other.com/', failure: true, }, { input: 'http://[:]', base: 'http://other.com/', failure: true, }, 'U+3000 is mapped to U+0020 (space) which is disallowed', { input: 'http://GOO\u00A0\u3000goo.com', base: 'http://other.com/', failure: true, }, 'Other types of space (no-break, zero-width, zero-width-no-break) are name-prepped away to nothing. U+200B, U+2060, and U+FEFF, are ignored', { input: 'http://GOO\u200B\u2060\uFEFFgoo.com', base: 'http://other.com/', href: 'http://googoo.com/', origin: 'http://googoo.com', protocol: 'http:', username: '', password: '', host: 'googoo.com', hostname: 'googoo.com', port: '', pathname: '/', search: '', hash: '', }, 'Leading and trailing C0 control or space', { input: '\u0000\u001B\u0004\u0012 http://example.com/\u001F \u000D ', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, 'Ideographic full stop (full-width period for Chinese, etc.) should be treated as a dot. U+3002 is mapped to U+002E (dot)', { input: 'http://www.foo。bar.com', base: 'http://other.com/', href: 'http://www.foo.bar.com/', origin: 'http://www.foo.bar.com', protocol: 'http:', username: '', password: '', host: 'www.foo.bar.com', hostname: 'www.foo.bar.com', port: '', pathname: '/', search: '', hash: '', }, 'Invalid unicode characters should fail... U+FDD0 is disallowed; %ef%b7%90 is U+FDD0', { input: 'http://\uFDD0zyx.com', base: 'http://other.com/', failure: true, }, 'This is the same as previous but escaped', { input: 'http://%ef%b7%90zyx.com', base: 'http://other.com/', failure: true, }, 'U+FFFD', { input: 'https://\uFFFD', base: 'about:blank', failure: true, }, { input: 'https://%EF%BF%BD', base: 'about:blank', failure: true, }, { input: 'https://x/\uFFFD?\uFFFD#\uFFFD', base: 'about:blank', href: 'https://x/%EF%BF%BD?%EF%BF%BD#%EF%BF%BD', origin: 'https://x', protocol: 'https:', username: '', password: '', host: 'x', hostname: 'x', port: '', pathname: '/%EF%BF%BD', search: '?%EF%BF%BD', hash: '#%EF%BF%BD', }, "Test name prepping, fullwidth input should be converted to ASCII and NOT IDN-ized. This is 'Go' in fullwidth UTF-8/UTF-16.", { input: 'http://Go.com', base: 'http://other.com/', href: 'http://go.com/', origin: 'http://go.com', protocol: 'http:', username: '', password: '', host: 'go.com', hostname: 'go.com', port: '', pathname: '/', search: '', hash: '', }, 'URL spec forbids the following. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257', { input: 'http://%41.com', base: 'http://other.com/', failure: true, }, { input: 'http://%ef%bc%85%ef%bc%94%ef%bc%91.com', base: 'http://other.com/', failure: true, }, '...%00 in fullwidth should fail (also as escaped UTF-8 input)', { input: 'http://%00.com', base: 'http://other.com/', failure: true, }, { input: 'http://%ef%bc%85%ef%bc%90%ef%bc%90.com', base: 'http://other.com/', failure: true, }, 'Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN', { input: 'http://你好你好', base: 'http://other.com/', href: 'http://xn--6qqa088eba/', origin: 'http://xn--6qqa088eba', protocol: 'http:', username: '', password: '', host: 'xn--6qqa088eba', hostname: 'xn--6qqa088eba', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://faß.ExAmPlE/', base: 'about:blank', href: 'https://xn--fa-hia.example/', origin: 'https://xn--fa-hia.example', protocol: 'https:', username: '', password: '', host: 'xn--fa-hia.example', hostname: 'xn--fa-hia.example', port: '', pathname: '/', search: '', hash: '', }, { input: 'sc://faß.ExAmPlE/', base: 'about:blank', href: 'sc://fa%C3%9F.ExAmPlE/', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'fa%C3%9F.ExAmPlE', hostname: 'fa%C3%9F.ExAmPlE', port: '', pathname: '/', search: '', hash: '', }, 'Invalid escaped characters should fail and the percents should be escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191', { input: 'http://%zz%66%a.com', base: 'http://other.com/', failure: true, }, 'If we get an invalid character that has been escaped.', { input: 'http://%25', base: 'http://other.com/', failure: true, }, { input: 'http://hello%00', base: 'http://other.com/', failure: true, }, 'Escaped numbers should be treated like IP addresses if they are.', /* { input: 'http://%30%78%63%30%2e%30%32%35%30.01', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://%30%78%63%30%2e%30%32%35%30.01%2e', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, */ { input: 'http://192.168.0.257', base: 'http://other.com/', failure: true, }, 'Invalid escaping in hosts causes failure', { input: 'http://%3g%78%63%30%2e%30%32%35%30%2E.01', base: 'http://other.com/', failure: true, }, 'A space in a host causes failure', { input: 'http://192.168.0.1 hello', base: 'http://other.com/', failure: true, }, { input: 'https://x x:12', base: 'about:blank', failure: true, }, 'Fullwidth and escaped UTF-8 fullwidth should still be treated as IP', { input: 'http://0Xc0.0250.01', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, 'Domains with empty labels', { input: 'http://./', base: 'about:blank', href: 'http://./', origin: 'http://.', protocol: 'http:', username: '', password: '', host: '.', hostname: '.', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://../', base: 'about:blank', href: 'http://../', origin: 'http://..', protocol: 'http:', username: '', password: '', host: '..', hostname: '..', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0..0x300/', base: 'about:blank', href: 'http://0..0x300/', origin: 'http://0..0x300', protocol: 'http:', username: '', password: '', host: '0..0x300', hostname: '0..0x300', port: '', pathname: '/', search: '', hash: '', }, 'Broken IPv6', { input: 'http://[www.google.com]/', base: 'about:blank', failure: true, }, { input: 'http://[google.com]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.3.4x]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.3.]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.]', base: 'http://other.com/', failure: true, }, 'Misc Unicode', { input: 'http://foo:💩@example.com/bar', base: 'http://other.com/', href: 'http://foo:%F0%9F%92%A9@example.com/bar', origin: 'http://example.com', protocol: 'http:', username: 'foo', password: '%F0%9F%92%A9', host: 'example.com', hostname: 'example.com', port: '', pathname: '/bar', search: '', hash: '', }, '# resolving a fragment against any scheme succeeds', { input: '#', base: 'test:test', href: 'test:test#', origin: 'null', protocol: 'test:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '', hash: '', }, { input: '#x', base: 'mailto:x@x.com', href: 'mailto:x@x.com#x', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'x@x.com', search: '', hash: '#x', }, { input: '#x', base: 'data:,', href: 'data:,#x', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: ',', search: '', hash: '#x', }, { input: '#x', base: 'about:blank', href: 'about:blank#x', origin: 'null', protocol: 'about:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'blank', search: '', hash: '#x', }, { input: '#', base: 'test:test?test', href: 'test:test?test#', origin: 'null', protocol: 'test:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '?test', hash: '', }, '# multiple @ in authority state', { input: 'https://@test@test@example:800/', base: 'http://doesnotmatter/', href: 'https://%40test%40test@example:800/', origin: 'https://example:800', protocol: 'https:', username: '%40test%40test', password: '', host: 'example:800', hostname: 'example', port: '800', pathname: '/', search: '', hash: '', }, { input: 'https://@@@example', base: 'http://doesnotmatter/', href: 'https://%40%40@example/', origin: 'https://example', protocol: 'https:', username: '%40%40', password: '', host: 'example', hostname: 'example', port: '', pathname: '/', search: '', hash: '', }, 'non-az-09 characters', { input: 'http://`{}:`{}@h/`{}?`{}', base: 'http://doesnotmatter/', href: 'http://%60%7B%7D:%60%7B%7D@h/%60%7B%7D?`{}', origin: 'http://h', protocol: 'http:', username: '%60%7B%7D', password: '%60%7B%7D', host: 'h', hostname: 'h', port: '', pathname: '/%60%7B%7D', search: '?`{}', hash: '', }, "byte is ' and url is special", { input: "http://host/?'", base: 'about:blank', href: 'http://host/?%27', origin: 'http://host', protocol: 'http:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/', search: '?%27', hash: '', }, { input: "notspecial://host/?'", base: 'about:blank', href: "notspecial://host/?'", origin: 'null', protocol: 'notspecial:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/', search: "?'", hash: '', }, '# Credentials in base', { input: '/some/path', base: 'http://user@example.org/smth', href: 'http://user@example.org/some/path', origin: 'http://example.org', protocol: 'http:', username: 'user', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/some/path', search: '', hash: '', }, { input: '', base: 'http://user:pass@example.org:21/smth', href: 'http://user:pass@example.org:21/smth', origin: 'http://example.org:21', protocol: 'http:', username: 'user', password: 'pass', host: 'example.org:21', hostname: 'example.org', port: '21', pathname: '/smth', search: '', hash: '', }, { input: '/some/path', base: 'http://user:pass@example.org:21/smth', href: 'http://user:pass@example.org:21/some/path', origin: 'http://example.org:21', protocol: 'http:', username: 'user', password: 'pass', host: 'example.org:21', hostname: 'example.org', port: '21', pathname: '/some/path', search: '', hash: '', }, '# a set of tests designed by zcorpan for relative URLs with unknown schemes', { input: 'i', base: 'sc:sd', failure: true, }, { input: 'i', base: 'sc:sd/sd', failure: true, }, { input: 'i', base: 'sc:/pa/pa', href: 'sc:/pa/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/i', search: '', hash: '', }, { input: 'i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: 'i', base: 'sc:///pa/pa', href: 'sc:///pa/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/i', search: '', hash: '', }, { input: '../i', base: 'sc:sd', failure: true, }, { input: '../i', base: 'sc:sd/sd', failure: true, }, { input: '../i', base: 'sc:/pa/pa', href: 'sc:/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '../i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: '../i', base: 'sc:///pa/pa', href: 'sc:///i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc:sd', failure: true, }, { input: '/i', base: 'sc:sd/sd', failure: true, }, { input: '/i', base: 'sc:/pa/pa', href: 'sc:/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc:///pa/pa', href: 'sc:///i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '?i', base: 'sc:sd', failure: true, }, { input: '?i', base: 'sc:sd/sd', failure: true, }, { input: '?i', base: 'sc:/pa/pa', href: 'sc:/pa/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '?i', hash: '', }, { input: '?i', base: 'sc://ho/pa', href: 'sc://ho/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/pa', search: '?i', hash: '', }, { input: '?i', base: 'sc:///pa/pa', href: 'sc:///pa/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '?i', hash: '', }, { input: '#i', base: 'sc:sd', href: 'sc:sd#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'sd', search: '', hash: '#i', }, { input: '#i', base: 'sc:sd/sd', href: 'sc:sd/sd#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'sd/sd', search: '', hash: '#i', }, { input: '#i', base: 'sc:/pa/pa', href: 'sc:/pa/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '', hash: '#i', }, { input: '#i', base: 'sc://ho/pa', href: 'sc://ho/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/pa', search: '', hash: '#i', }, { input: '#i', base: 'sc:///pa/pa', href: 'sc:///pa/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '', hash: '#i', }, '# make sure that relative URL logic works on known typically non-relative schemes too', { input: 'about:/../', base: 'about:blank', href: 'about:/', origin: 'null', protocol: 'about:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/../', base: 'about:blank', href: 'data:/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'javascript:/../', base: 'about:blank', href: 'javascript:/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'mailto:/../', base: 'about:blank', href: 'mailto:/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# unknown schemes and their hosts', { input: 'sc://ñ.test/', base: 'about:blank', href: 'sc://%C3%B1.test/', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1.test', hostname: '%C3%B1.test', port: '', pathname: '/', search: '', hash: '', }, { input: "sc://\u001F!\"$&'()*+,-.;<=>^_`{|}~/", base: 'about:blank', href: "sc://%1F!\"$&'()*+,-.;<=>^_`{|}~/", origin: 'null', protocol: 'sc:', username: '', password: '', host: "%1F!\"$&'()*+,-.;<=>^_`{|}~", hostname: "%1F!\"$&'()*+,-.;<=>^_`{|}~", port: '', pathname: '/', search: '', hash: '', }, { input: 'sc://\u0000/', base: 'about:blank', failure: true, }, { input: 'sc:// /', base: 'about:blank', failure: true, }, /* { input: 'sc://%/', base: 'about:blank', href: 'sc://%/', protocol: 'sc:', username: '', password: '', host: '%', hostname: '%', port: '', pathname: '/', search: '', hash: '', }, */ { input: 'sc://@/', base: 'about:blank', failure: true, }, { input: 'sc://tes@s:t@/', base: 'about:blank', failure: true, }, { input: 'sc://:/', base: 'about:blank', failure: true, }, { input: 'sc://:12/', base: 'about:blank', failure: true, }, { input: 'sc://[/', base: 'about:blank', failure: true, }, { input: 'sc://\\/', base: 'about:blank', failure: true, }, { input: 'sc://]/', base: 'about:blank', failure: true, }, { input: 'x', base: 'sc://ñ', href: 'sc://%C3%B1/x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '/x', search: '', hash: '', }, '# unknown schemes and backslashes', { input: 'sc:\\../', base: 'about:blank', href: 'sc:\\../', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '\\../', search: '', hash: '', }, '# unknown scheme with path looking like a password', { input: 'sc::a@example.net', base: 'about:blank', href: 'sc::a@example.net', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: ':a@example.net', search: '', hash: '', }, '# unknown scheme with bogus percent-encoding', { input: 'wow:%NBD', base: 'about:blank', href: 'wow:%NBD', origin: 'null', protocol: 'wow:', username: '', password: '', host: '', hostname: '', port: '', pathname: '%NBD', search: '', hash: '', }, { input: 'wow:%1G', base: 'about:blank', href: 'wow:%1G', origin: 'null', protocol: 'wow:', username: '', password: '', host: '', hostname: '', port: '', pathname: '%1G', search: '', hash: '', }, '# Hosts and percent-encoding', { input: 'ftp://example.com%80/', base: 'about:blank', failure: true, }, { input: 'ftp://example.com%A0/', base: 'about:blank', failure: true, }, { input: 'https://example.com%80/', base: 'about:blank', failure: true, }, { input: 'https://example.com%A0/', base: 'about:blank', failure: true, }, /* { input: 'ftp://%e2%98%83', base: 'about:blank', href: 'ftp://xn--n3h/', origin: 'ftp://xn--n3h', protocol: 'ftp:', username: '', password: '', host: 'xn--n3h', hostname: 'xn--n3h', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://%e2%98%83', base: 'about:blank', href: 'https://xn--n3h/', origin: 'https://xn--n3h', protocol: 'https:', username: '', password: '', host: 'xn--n3h', hostname: 'xn--n3h', port: '', pathname: '/', search: '', hash: '', }, */ '# tests from jsdom/whatwg-url designed for code coverage', { input: 'http://127.0.0.1:10100/relative_import.html', base: 'about:blank', href: 'http://127.0.0.1:10100/relative_import.html', origin: 'http://127.0.0.1:10100', protocol: 'http:', username: '', password: '', host: '127.0.0.1:10100', hostname: '127.0.0.1', port: '10100', pathname: '/relative_import.html', search: '', hash: '', }, { input: 'http://facebook.com/?foo=%7B%22abc%22', base: 'about:blank', href: 'http://facebook.com/?foo=%7B%22abc%22', origin: 'http://facebook.com', protocol: 'http:', username: '', password: '', host: 'facebook.com', hostname: 'facebook.com', port: '', pathname: '/', search: '?foo=%7B%22abc%22', hash: '', }, { input: 'https://localhost:3000/jqueryui@1.2.3', base: 'about:blank', href: 'https://localhost:3000/jqueryui@1.2.3', origin: 'https://localhost:3000', protocol: 'https:', username: '', password: '', host: 'localhost:3000', hostname: 'localhost', port: '3000', pathname: '/jqueryui@1.2.3', search: '', hash: '', }, '# tab/LF/CR', { input: 'h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg', base: 'about:blank', href: 'http://host:9000/path?query#frag', origin: 'http://host:9000', protocol: 'http:', username: '', password: '', host: 'host:9000', hostname: 'host', port: '9000', pathname: '/path', search: '?query', hash: '#frag', }, '# Stringification of URL.searchParams', { input: '?a=b&c=d', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar?a=b&c=d', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '?a=b&c=d', searchParams: 'a=b&c=d', hash: '', }, { input: '??a=b&c=d', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar??a=b&c=d', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '??a=b&c=d', searchParams: '%3Fa=b&c=d', hash: '', }, '# Scheme only', { input: 'http:', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', searchParams: '', hash: '', }, { input: 'http:', base: 'https://example.org/foo/bar', failure: true, }, { input: 'sc:', base: 'https://example.org/foo/bar', href: 'sc:', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', searchParams: '', hash: '', }, '# Percent encoding of fragments', { input: 'http://foo.bar/baz?qux#foo\bbar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%08bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%08bar', }, { input: 'http://foo.bar/baz?qux#foo"bar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%22bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%22bar', }, { input: 'http://foo.bar/baz?qux#foobar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%3Ebar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%3Ebar', }, { input: 'http://foo.bar/baz?qux#foo`bar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%60bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%60bar', }, '# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)', { input: 'http://192.168.257', base: 'http://other.com/', href: 'http://192.168.1.1/', origin: 'http://192.168.1.1', protocol: 'http:', username: '', password: '', host: '192.168.1.1', hostname: '192.168.1.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://192.168.257.com', base: 'http://other.com/', href: 'http://192.168.257.com/', origin: 'http://192.168.257.com', protocol: 'http:', username: '', password: '', host: '192.168.257.com', hostname: '192.168.257.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://256', base: 'http://other.com/', href: 'http://0.0.1.0/', origin: 'http://0.0.1.0', protocol: 'http:', username: '', password: '', host: '0.0.1.0', hostname: '0.0.1.0', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://256.com', base: 'http://other.com/', href: 'http://256.com/', origin: 'http://256.com', protocol: 'http:', username: '', password: '', host: '256.com', hostname: '256.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://999999999', base: 'http://other.com/', href: 'http://59.154.201.255/', origin: 'http://59.154.201.255', protocol: 'http:', username: '', password: '', host: '59.154.201.255', hostname: '59.154.201.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://999999999.com', base: 'http://other.com/', href: 'http://999999999.com/', origin: 'http://999999999.com', protocol: 'http:', username: '', password: '', host: '999999999.com', hostname: '999999999.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://10000000000', base: 'http://other.com/', failure: true, }, { input: 'http://10000000000.com', base: 'http://other.com/', href: 'http://10000000000.com/', origin: 'http://10000000000.com', protocol: 'http:', username: '', password: '', host: '10000000000.com', hostname: '10000000000.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://4294967295', base: 'http://other.com/', href: 'http://255.255.255.255/', origin: 'http://255.255.255.255', protocol: 'http:', username: '', password: '', host: '255.255.255.255', hostname: '255.255.255.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://4294967296', base: 'http://other.com/', failure: true, }, { input: 'http://0xffffffff', base: 'http://other.com/', href: 'http://255.255.255.255/', origin: 'http://255.255.255.255', protocol: 'http:', username: '', password: '', host: '255.255.255.255', hostname: '255.255.255.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0xffffffff1', base: 'http://other.com/', failure: true, }, { input: 'http://256.256.256.256', base: 'http://other.com/', failure: true, }, { input: 'http://256.256.256.256.256', base: 'http://other.com/', href: 'http://256.256.256.256.256/', origin: 'http://256.256.256.256.256', protocol: 'http:', username: '', password: '', host: '256.256.256.256.256', hostname: '256.256.256.256.256', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://0x.0x.0', base: 'about:blank', href: 'https://0.0.0.0/', origin: 'https://0.0.0.0', protocol: 'https:', username: '', password: '', host: '0.0.0.0', hostname: '0.0.0.0', port: '', pathname: '/', search: '', hash: '', }, 'More IPv4 parsing (via https://github.com/jsdom/whatwg-url/issues/92)', { input: 'https://0x100000000/test', base: 'about:blank', failure: true, }, { input: 'https://256.0.0.1/test', base: 'about:blank', failure: true, }, "# file URLs containing percent-encoded Windows drive letters (shouldn't work)", { input: 'file:///C%3A/', base: 'about:blank', href: 'file:///C%3A/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C%3A/', search: '', hash: '', }, { input: 'file:///C%7C/', base: 'about:blank', href: 'file:///C%7C/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C%7C/', search: '', hash: '', }, '# file URLs relative to other file URLs (via https://github.com/jsdom/whatwg-url/pull/60)', { input: 'pix/submit.gif', base: 'file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html', href: 'file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif', search: '', hash: '', }, { input: '..', base: 'file:///C:/', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: '..', base: 'file:///', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# More file URL tests by zcorpan and annevk', { input: '/', base: 'file:///C:/a/b', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: '//d:', base: 'file:///C:/a/b', href: 'file:///d:', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/d:', search: '', hash: '', }, { input: '//d:/..', base: 'file:///C:/a/b', href: 'file:///d:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/d:/', search: '', hash: '', }, { input: '..', base: 'file:///ab:/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '..', base: 'file:///1:/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '', base: 'file:///test?test#test', href: 'file:///test?test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '', }, { input: 'file:', base: 'file:///test?test#test', href: 'file:///test?test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '', }, { input: '?x', base: 'file:///test?test#test', href: 'file:///test?x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?x', hash: '', }, { input: 'file:?x', base: 'file:///test?test#test', href: 'file:///test?x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?x', hash: '', }, { input: '#x', base: 'file:///test?test#test', href: 'file:///test?test#x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '#x', }, { input: 'file:#x', base: 'file:///test?test#test', href: 'file:///test?test#x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '#x', }, '# File URLs and many (back)slashes', { input: 'file:\\\\//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\\\\\', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\\\\\?fox', base: 'about:blank', href: 'file:///?fox', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '?fox', hash: '', }, { input: 'file:\\\\\\\\#guppy', base: 'about:blank', href: 'file:///#guppy', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '#guppy', }, { input: 'file://spider///', base: 'about:blank', href: 'file://spider/', protocol: 'file:', username: '', password: '', host: 'spider', hostname: 'spider', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\localhost//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:///localhost//cat', base: 'about:blank', href: 'file:///localhost//cat', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/localhost//cat', search: '', hash: '', }, { input: 'file://\\/localhost//cat', base: 'about:blank', href: 'file:///localhost//cat', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/localhost//cat', search: '', hash: '', }, { input: 'file://localhost//a//../..//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '/////mouse', base: 'file:///elephant', href: 'file:///mouse', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/mouse', search: '', hash: '', }, { input: '\\//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '\\/localhost//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '//localhost//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '/..//localhost//pig', base: 'file://lion/', href: 'file://lion/localhost//pig', protocol: 'file:', username: '', password: '', host: 'lion', hostname: 'lion', port: '', pathname: '/localhost//pig', search: '', hash: '', }, { input: 'file://', base: 'file://ape/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# File URLs with non-empty hosts', { input: '/rooibos', base: 'file://tea/', href: 'file://tea/rooibos', protocol: 'file:', username: '', password: '', host: 'tea', hostname: 'tea', port: '', pathname: '/rooibos', search: '', hash: '', }, { input: '/?chai', base: 'file://tea/', href: 'file://tea/?chai', protocol: 'file:', username: '', password: '', host: 'tea', hostname: 'tea', port: '', pathname: '/', search: '?chai', hash: '', }, "# Windows drive letter handling with the 'file:' base URL", { input: 'C|', base: 'file://host/dir/file', href: 'file:///C:', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|#', base: 'file://host/dir/file', href: 'file:///C:#', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|?', base: 'file://host/dir/file', href: 'file:///C:?', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|/', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C|\n/', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C|\\', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C', base: 'file://host/dir/file', href: 'file://host/dir/C', protocol: 'file:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/dir/C', search: '', hash: '', }, { input: 'C|a', base: 'file://host/dir/file', href: 'file://host/dir/C|a', protocol: 'file:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/dir/C|a', search: '', hash: '', }, '# Windows drive letter quirk in the file slash state', { input: '/c:/foo/bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: '/c|/foo/bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: 'file:\\c:\\foo\\bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: '/c:/foo/bar', base: 'file://host/path', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, '# Windows drive letter quirk with not empty host', { input: 'file://example.net/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://1.2.3.4/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://[1::8]/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, '# Windows drive letter quirk (no host)', { input: 'file:/C|/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://C|/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, '# file URLs without base URL by Rimas Misevičius', { input: 'file:', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:?q=v', base: 'about:blank', href: 'file:///?q=v', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '?q=v', hash: '', }, { input: 'file:#frag', base: 'about:blank', href: 'file:///#frag', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '#frag', }, '# IPv6 tests', { input: 'http://[1:0::]', base: 'http://example.net/', href: 'http://[1::]/', origin: 'http://[1::]', protocol: 'http:', username: '', password: '', host: '[1::]', hostname: '[1::]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[0:1:2:3:4:5:6:7:8]', base: 'http://example.net/', failure: true, }, { input: 'https://[0::0::0]', base: 'about:blank', failure: true, }, { input: 'https://[0:.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:0:]', base: 'about:blank', failure: true, }, { input: 'https://[0:1:2:3:4:5:6:7.0.0.0.1]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.00.0.0.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.290.0.0.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.23.23]', base: 'about:blank', failure: true, }, '# Empty host', { input: 'http://?', base: 'about:blank', failure: true, }, { input: 'http://#', base: 'about:blank', failure: true, }, 'Port overflow (2^32 + 81)', { input: 'http://f:4294967377/c', base: 'http://example.org/', failure: true, }, 'Port overflow (2^64 + 81)', { input: 'http://f:18446744073709551697/c', base: 'http://example.org/', failure: true, }, 'Port overflow (2^128 + 81)', { input: 'http://f:340282366920938463463374607431768211537/c', base: 'http://example.org/', failure: true, }, '# Non-special-URL path tests', { input: 'sc://ñ', base: 'about:blank', href: 'sc://%C3%B1', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '', }, { input: 'sc://ñ?x', base: 'about:blank', href: 'sc://%C3%B1?x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '?x', hash: '', }, { input: 'sc://ñ#x', base: 'about:blank', href: 'sc://%C3%B1#x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '#x', }, { input: '#x', base: 'sc://ñ', href: 'sc://%C3%B1#x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '#x', }, { input: '?x', base: 'sc://ñ', href: 'sc://%C3%B1?x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '?x', hash: '', }, { input: 'sc://?', base: 'about:blank', href: 'sc://?', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: 'sc://#', base: 'about:blank', href: 'sc://#', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: '///', base: 'sc://x/', href: 'sc:///', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '////', base: 'sc://x/', href: 'sc:////', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//', search: '', hash: '', }, { input: '////x/', base: 'sc://x/', href: 'sc:////x/', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//x/', search: '', hash: '', }, { input: 'tftp://foobar.com/someconfig;mode=netascii', base: 'about:blank', href: 'tftp://foobar.com/someconfig;mode=netascii', origin: 'null', protocol: 'tftp:', username: '', password: '', host: 'foobar.com', hostname: 'foobar.com', port: '', pathname: '/someconfig;mode=netascii', search: '', hash: '', }, { input: 'telnet://user:pass@foobar.com:23/', base: 'about:blank', href: 'telnet://user:pass@foobar.com:23/', origin: 'null', protocol: 'telnet:', username: 'user', password: 'pass', host: 'foobar.com:23', hostname: 'foobar.com', port: '23', pathname: '/', search: '', hash: '', }, { input: 'ut2004://10.10.10.10:7777/Index.ut2', base: 'about:blank', href: 'ut2004://10.10.10.10:7777/Index.ut2', origin: 'null', protocol: 'ut2004:', username: '', password: '', host: '10.10.10.10:7777', hostname: '10.10.10.10', port: '7777', pathname: '/Index.ut2', search: '', hash: '', }, { input: 'redis://foo:bar@somehost:6379/0?baz=bam&qux=baz', base: 'about:blank', href: 'redis://foo:bar@somehost:6379/0?baz=bam&qux=baz', origin: 'null', protocol: 'redis:', username: 'foo', password: 'bar', host: 'somehost:6379', hostname: 'somehost', port: '6379', pathname: '/0', search: '?baz=bam&qux=baz', hash: '', }, { input: 'rsync://foo@host:911/sup', base: 'about:blank', href: 'rsync://foo@host:911/sup', origin: 'null', protocol: 'rsync:', username: 'foo', password: '', host: 'host:911', hostname: 'host', port: '911', pathname: '/sup', search: '', hash: '', }, { input: 'git://github.com/foo/bar.git', base: 'about:blank', href: 'git://github.com/foo/bar.git', origin: 'null', protocol: 'git:', username: '', password: '', host: 'github.com', hostname: 'github.com', port: '', pathname: '/foo/bar.git', search: '', hash: '', }, { input: 'irc://myserver.com:6999/channel?passwd', base: 'about:blank', href: 'irc://myserver.com:6999/channel?passwd', origin: 'null', protocol: 'irc:', username: '', password: '', host: 'myserver.com:6999', hostname: 'myserver.com', port: '6999', pathname: '/channel', search: '?passwd', hash: '', }, { input: 'dns://fw.example.org:9999/foo.bar.org?type=TXT', base: 'about:blank', href: 'dns://fw.example.org:9999/foo.bar.org?type=TXT', origin: 'null', protocol: 'dns:', username: '', password: '', host: 'fw.example.org:9999', hostname: 'fw.example.org', port: '9999', pathname: '/foo.bar.org', search: '?type=TXT', hash: '', }, { input: 'ldap://localhost:389/ou=People,o=JNDITutorial', base: 'about:blank', href: 'ldap://localhost:389/ou=People,o=JNDITutorial', origin: 'null', protocol: 'ldap:', username: '', password: '', host: 'localhost:389', hostname: 'localhost', port: '389', pathname: '/ou=People,o=JNDITutorial', search: '', hash: '', }, { input: 'git+https://github.com/foo/bar', base: 'about:blank', href: 'git+https://github.com/foo/bar', origin: 'null', protocol: 'git+https:', username: '', password: '', host: 'github.com', hostname: 'github.com', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: 'urn:ietf:rfc:2648', base: 'about:blank', href: 'urn:ietf:rfc:2648', origin: 'null', protocol: 'urn:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'ietf:rfc:2648', search: '', hash: '', }, { input: 'tag:joe@example.org,2001:foo/bar', base: 'about:blank', href: 'tag:joe@example.org,2001:foo/bar', origin: 'null', protocol: 'tag:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'joe@example.org,2001:foo/bar', search: '', hash: '', }, '# percent encoded hosts in non-special-URLs', { input: 'non-special://%E2%80%A0/', base: 'about:blank', href: 'non-special://%E2%80%A0/', protocol: 'non-special:', username: '', password: '', host: '%E2%80%A0', hostname: '%E2%80%A0', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://H%4fSt/path', base: 'about:blank', href: 'non-special://H%4fSt/path', protocol: 'non-special:', username: '', password: '', host: 'H%4fSt', hostname: 'H%4fSt', port: '', pathname: '/path', search: '', hash: '', }, '# IPv6 in non-special-URLs', { input: 'non-special://[1:2:0:0:5:0:0:0]/', base: 'about:blank', href: 'non-special://[1:2:0:0:5::]/', protocol: 'non-special:', username: '', password: '', host: '[1:2:0:0:5::]', hostname: '[1:2:0:0:5::]', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://[1:2:0:0:0:0:0:3]/', base: 'about:blank', href: 'non-special://[1:2::3]/', protocol: 'non-special:', username: '', password: '', host: '[1:2::3]', hostname: '[1:2::3]', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://[1:2::3]:80/', base: 'about:blank', href: 'non-special://[1:2::3]:80/', protocol: 'non-special:', username: '', password: '', host: '[1:2::3]:80', hostname: '[1:2::3]', port: '80', pathname: '/', search: '', hash: '', }, { input: 'non-special://[:80/', base: 'about:blank', failure: true, }, { input: 'blob:https://example.com:443/', base: 'about:blank', href: 'blob:https://example.com:443/', protocol: 'blob:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'https://example.com:443/', search: '', hash: '', }, { input: 'blob:d3958f5c-0777-0845-9dcf-2cb28783acaf', base: 'about:blank', href: 'blob:d3958f5c-0777-0845-9dcf-2cb28783acaf', protocol: 'blob:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'd3958f5c-0777-0845-9dcf-2cb28783acaf', search: '', hash: '', }, 'Invalid IPv4 radix digits', { input: 'http://0177.0.0.0189', base: 'about:blank', href: 'http://0177.0.0.0189/', protocol: 'http:', username: '', password: '', host: '0177.0.0.0189', hostname: '0177.0.0.0189', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0x7f.0.0.0x7g', base: 'about:blank', href: 'http://0x7f.0.0.0x7g/', protocol: 'http:', username: '', password: '', host: '0x7f.0.0.0x7g', hostname: '0x7f.0.0.0x7g', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0X7F.0.0.0X7G', base: 'about:blank', href: 'http://0x7f.0.0.0x7g/', protocol: 'http:', username: '', password: '', host: '0x7f.0.0.0x7g', hostname: '0x7f.0.0.0x7g', port: '', pathname: '/', search: '', hash: '', }, 'Invalid IPv4 portion of IPv6 address', { input: 'http://[::127.0.0.0.1]', base: 'about:blank', failure: true, }, 'Uncompressed IPv6 addresses with 0', { input: 'http://[0:1:0:1:0:1:0:1]', base: 'about:blank', href: 'http://[0:1:0:1:0:1:0:1]/', protocol: 'http:', username: '', password: '', host: '[0:1:0:1:0:1:0:1]', hostname: '[0:1:0:1:0:1:0:1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[1:0:1:0:1:0:1:0]', base: 'about:blank', href: 'http://[1:0:1:0:1:0:1:0]/', protocol: 'http:', username: '', password: '', host: '[1:0:1:0:1:0:1:0]', hostname: '[1:0:1:0:1:0:1:0]', port: '', pathname: '/', search: '', hash: '', }, 'Percent-encoded query and fragment', { input: 'http://example.org/test?\u0022', base: 'about:blank', href: 'http://example.org/test?%22', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%22', hash: '', }, { input: 'http://example.org/test?\u0023', base: 'about:blank', href: 'http://example.org/test?#', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '', hash: '', }, { input: 'http://example.org/test?\u003C', base: 'about:blank', href: 'http://example.org/test?%3C', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%3C', hash: '', }, { input: 'http://example.org/test?\u003E', base: 'about:blank', href: 'http://example.org/test?%3E', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%3E', hash: '', }, { input: 'http://example.org/test?\u2323', base: 'about:blank', href: 'http://example.org/test?%E2%8C%A3', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%E2%8C%A3', hash: '', }, { input: 'http://example.org/test?%23%23', base: 'about:blank', href: 'http://example.org/test?%23%23', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%23%23', hash: '', }, /* { input: 'http://example.org/test?%GH', base: 'about:blank', href: 'http://example.org/test?%GH', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%GH', hash: '', }, */ { input: 'http://example.org/test?a#%EF', base: 'about:blank', href: 'http://example.org/test?a#%EF', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#%EF', }, { input: 'http://example.org/test?a#%GH', base: 'about:blank', href: 'http://example.org/test?a#%GH', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#%GH', }, 'URLs that require a non-about:blank base. (Also serve as invalid base tests.)', { input: 'a', base: 'about:blank', failure: true, }, { input: 'a/', base: 'about:blank', failure: true, }, { input: 'a//', base: 'about:blank', failure: true, }, "Bases that don't fail to parse but fail to be bases", { input: 'test-a-colon.html', base: 'a:', failure: true, }, { input: 'test-a-colon-b.html', base: 'a:b', failure: true, }, 'Other base URL tests, that must succeed', { input: 'test-a-colon-slash.html', base: 'a:/', href: 'a:/test-a-colon-slash.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash.html', search: '', hash: '', }, { input: 'test-a-colon-slash-slash.html', base: 'a://', href: 'a:///test-a-colon-slash-slash.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash-slash.html', search: '', hash: '', }, { input: 'test-a-colon-slash-b.html', base: 'a:/b', href: 'a:/test-a-colon-slash-b.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash-b.html', search: '', hash: '', }, { input: 'test-a-colon-slash-slash-b.html', base: 'a://b', href: 'a://b/test-a-colon-slash-slash-b.html', protocol: 'a:', username: '', password: '', host: 'b', hostname: 'b', port: '', pathname: '/test-a-colon-slash-slash-b.html', search: '', hash: '', }, 'Null code point in fragment', { input: 'http://example.org/test?a#b\u0000c', base: 'about:blank', href: 'http://example.org/test?a#bc', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#bc', }, ];