Skip to content

Commit

Permalink
move iterator sequencing proposal to stage 3
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 3, 2024
1 parent 5e3e093 commit b991d91
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 44 deletions.
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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<IterableObject>): Iterator<any>;
}
```
[*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
Expand Down Expand Up @@ -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<IterableObject>): Iterator<any>;
}
```
[*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)
Expand Down
20 changes: 20 additions & 0 deletions packages/core-js/actual/iterator/concat.js
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions packages/core-js/actual/iterator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
20 changes: 2 additions & 18 deletions packages/core-js/full/iterator/concat.js
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion packages/core-js/full/iterator/index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/stage/2.7.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var parent = require('./3');

require('../proposals/iterator-sequencing');
// empty

module.exports = parent;
1 change: 1 addition & 0 deletions packages/core-js/stage/3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tests/entries/unit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-pure/esnext.iterator.concat.js
Original file line number Diff line number Diff line change
@@ -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 => {
Expand Down

0 comments on commit b991d91

Please sign in to comment.