diff --git a/README.md b/README.md index d1742f9c0cf0..f8ee2741fcbd 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) - [New `Set` methods](#new-set-methods) - [Stage 3 proposals](#stage-3-proposals) - [`Array.fromAsync`](#arrayfromasync) + - [`Iterator` sequencing](#iterator-sequencing) - [`JSON.parse` source text access](#jsonparse-source-text-access) - [`Float16` methods](#float16-methods) - [`Uint8Array` to / from base64 and hex](#uint8array-to--from-base64-and-hex) @@ -168,7 +169,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) - [`Math.sumPrecise`](#mathsumprecise) - [`Symbol.metadata` for decorators metadata proposal](#symbolmetadata-for-decorators-metadata-proposal) - [Stage 2.7 proposals](#stage-27-proposals) - - [`Iterator` sequencing](#iterator-sequencing) - [Stage 2 proposals](#stage-2-proposals) - [`AsyncIterator` helpers](#asynciterator-helpers) - [`Iterator.range`](#iteratorrange) @@ -2421,6 +2421,26 @@ core-js(-pure)/actual|full/array/from-async await Array.fromAsync((async function * () { yield * [1, 2, 3]; })(), i => i * i); // => [1, 4, 9] ``` +##### [`Iterator` sequencing](https://github.com/tc39/proposal-iterator-sequencing)[⬆](#index) +Module [`esnext.iterator.concat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.concat.js) +```ts +class Iterator { + concat(...items: Array): Iterator; +} +``` +[*CommonJS entry points:*](#commonjs-api) +``` +core-js/proposals/iterator-sequencing +core-js(-pure)/actual|full/iterator/concat +``` +[*Example*](https://tinyurl.com/2522xjae): +```js +Iterator.concat([0, 1].values(), [2, 3], function * () { + yield 4; + yield 5; +}()).toArray(); // => [0, 1, 2, 3, 4, 5] +``` + ##### [`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). ```ts @@ -2648,25 +2668,7 @@ core-js(-pure)/actual|full/function/metadata core-js(-pure)/stage/2.7 ``` -##### [`Iterator` sequencing](https://github.com/tc39/proposal-iterator-sequencing)[⬆](#index) -Module [`esnext.iterator.concat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.concat.js) -```ts -class Iterator { - concat(...items: Array): Iterator; -} -``` -[*CommonJS entry points:*](#commonjs-api) -``` -core-js/proposals/iterator-sequencing -core-js(-pure)/full/iterator/concat -``` -[*Example*](https://tinyurl.com/2522xjae): -```js -Iterator.concat([0, 1].values(), [2, 3], function * () { - yield 4; - yield 5; -}()).toArray(); // => [0, 1, 2, 3, 4, 5] -``` +*empty* #### Stage 2 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) diff --git a/packages/core-js/actual/iterator/concat.js b/packages/core-js/actual/iterator/concat.js new file mode 100644 index 000000000000..f0979ddbd0f8 --- /dev/null +++ b/packages/core-js/actual/iterator/concat.js @@ -0,0 +1,20 @@ +'use strict'; +require('../../modules/es.array.iterator'); +require('../../modules/es.object.to-string'); +require('../../modules/es.string.iterator'); +require('../../modules/es.iterator.constructor'); +require('../../modules/es.iterator.drop'); +require('../../modules/es.iterator.every'); +require('../../modules/es.iterator.filter'); +require('../../modules/es.iterator.find'); +require('../../modules/es.iterator.flat-map'); +require('../../modules/es.iterator.for-each'); +require('../../modules/es.iterator.map'); +require('../../modules/es.iterator.reduce'); +require('../../modules/es.iterator.some'); +require('../../modules/es.iterator.take'); +require('../../modules/es.iterator.to-array'); +require('../../modules/esnext.iterator.concat'); +var path = require('../../internals/path'); + +module.exports = path.Iterator.concat; diff --git a/packages/core-js/actual/iterator/index.js b/packages/core-js/actual/iterator/index.js index 87c9bd78f13e..64b823a7866e 100644 --- a/packages/core-js/actual/iterator/index.js +++ b/packages/core-js/actual/iterator/index.js @@ -2,6 +2,7 @@ var parent = require('../../stable/iterator'); require('../../modules/es.promise'); require('../../modules/esnext.iterator.constructor'); +require('../../modules/esnext.iterator.concat'); require('../../modules/esnext.iterator.dispose'); require('../../modules/esnext.iterator.drop'); require('../../modules/esnext.iterator.every'); diff --git a/packages/core-js/full/iterator/concat.js b/packages/core-js/full/iterator/concat.js index f0979ddbd0f8..4baee318df23 100644 --- a/packages/core-js/full/iterator/concat.js +++ b/packages/core-js/full/iterator/concat.js @@ -1,20 +1,4 @@ 'use strict'; -require('../../modules/es.array.iterator'); -require('../../modules/es.object.to-string'); -require('../../modules/es.string.iterator'); -require('../../modules/es.iterator.constructor'); -require('../../modules/es.iterator.drop'); -require('../../modules/es.iterator.every'); -require('../../modules/es.iterator.filter'); -require('../../modules/es.iterator.find'); -require('../../modules/es.iterator.flat-map'); -require('../../modules/es.iterator.for-each'); -require('../../modules/es.iterator.map'); -require('../../modules/es.iterator.reduce'); -require('../../modules/es.iterator.some'); -require('../../modules/es.iterator.take'); -require('../../modules/es.iterator.to-array'); -require('../../modules/esnext.iterator.concat'); -var path = require('../../internals/path'); +var parent = require('../../actual/iterator/concat'); -module.exports = path.Iterator.concat; +module.exports = parent; diff --git a/packages/core-js/full/iterator/index.js b/packages/core-js/full/iterator/index.js index f65eb51d28f9..c6caf46dc02b 100644 --- a/packages/core-js/full/iterator/index.js +++ b/packages/core-js/full/iterator/index.js @@ -1,6 +1,5 @@ 'use strict'; var parent = require('../../actual/iterator'); -require('../../modules/esnext.iterator.concat'); require('../../modules/esnext.iterator.range'); // TODO: Remove from `core-js@4` require('../../modules/esnext.iterator.as-indexed-pairs'); diff --git a/packages/core-js/modules/esnext.iterator.concat.js b/packages/core-js/modules/esnext.iterator.concat.js index 2a528f45dbc9..380301a5d9a8 100644 --- a/packages/core-js/modules/esnext.iterator.concat.js +++ b/packages/core-js/modules/esnext.iterator.concat.js @@ -35,7 +35,7 @@ var IteratorProxy = createIteratorProxy(function () { // `Iterator.concat` method // https://github.com/tc39/proposal-iterator-sequencing -$({ target: 'Iterator', stat: true, forced: true }, { +$({ target: 'Iterator', stat: true }, { concat: function concat() { var length = arguments.length; var iterables = $Array(length); diff --git a/packages/core-js/stage/2.7.js b/packages/core-js/stage/2.7.js index 41a8257d7d2b..14b1ed327856 100644 --- a/packages/core-js/stage/2.7.js +++ b/packages/core-js/stage/2.7.js @@ -1,6 +1,6 @@ 'use strict'; var parent = require('./3'); -require('../proposals/iterator-sequencing'); +// empty module.exports = parent; diff --git a/packages/core-js/stage/3.js b/packages/core-js/stage/3.js index 0b381e2cda30..017b95b4e9a2 100644 --- a/packages/core-js/stage/3.js +++ b/packages/core-js/stage/3.js @@ -6,6 +6,7 @@ require('../proposals/array-from-async-stage-2'); require('../proposals/decorator-metadata-v2'); require('../proposals/explicit-resource-management'); require('../proposals/float16'); +require('../proposals/iterator-sequencing'); require('../proposals/json-parse-with-source'); require('../proposals/math-sum'); require('../proposals/regexp-escaping'); diff --git a/tests/entries/unit.mjs b/tests/entries/unit.mjs index e7b34b9d29d7..c3d8563876c7 100644 --- a/tests/entries/unit.mjs +++ b/tests/entries/unit.mjs @@ -695,6 +695,7 @@ for (PATH of ['core-js-pure', 'core-js']) { 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'); + ok(load(NS, 'iterator/concat')([2]).next().value === 2); load(NS, 'data-view/get-float16'); load(NS, 'data-view/set-float16'); ok(load(NS, 'function/metadata') === null); @@ -771,7 +772,6 @@ for (PATH of ['core-js-pure', 'core-js']) { 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/concat')([2]).next().value === 2); 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); diff --git a/tests/unit-pure/esnext.iterator.concat.js b/tests/unit-pure/esnext.iterator.concat.js index 0777915e27c6..3702a893a83f 100644 --- a/tests/unit-pure/esnext.iterator.concat.js +++ b/tests/unit-pure/esnext.iterator.concat.js @@ -1,7 +1,7 @@ import { createIterable, createIterator } from '../helpers/helpers.js'; -import concat from 'core-js-pure/full/iterator/concat'; -import Iterator from 'core-js-pure/full/iterator'; +import concat from 'core-js-pure/actual/iterator/concat'; +import Iterator from 'core-js-pure/actual/iterator'; import from from 'core-js-pure/es/array/from'; QUnit.test('Iterator.concat', assert => {