Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog
##### Unreleased
- [`Iterator` chunking proposal](https://github.com/tc39/proposal-iterator-chunking):
- Built-ins:
- `Iterator.prototype.chunks`
- `Iterator.prototype.sliding`
- `Iterator.prototype.windows`
- Moved to stage 2.7, July 2025 TC39 meeting
- Added missing dependencies to some entries of static `Iterator` methods
- Compat data improvements:
- [`Uint8Array` to / from base64 and hex proposal](https://github.com/tc39/proposal-arraybuffer-base64) features marked as [supported from V8 ~ Chromium 140](https://issues.chromium.org/issues/42204568#comment37)
Expand Down
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`Symbol.metadata` for decorators metadata proposal](#symbolmetadata-for-decorators-metadata-proposal)
- [Stage 2.7 proposals](#stage-27-proposals)
- [`Iterator` sequencing](#iterator-sequencing)
- [`Iterator` chunking](#iterator-chunking)
- [Joint iteration](#joint-iteration)
- [`Map` upsert](#map-upsert)
- [Stage 2 proposals](#stage-2-proposals)
Expand All @@ -181,7 +182,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`String.dedent`](#stringdedent)
- [`Symbol` predicates](#symbol-predicates)
- [`Symbol.customMatcher` for extractors](#symbolcustommatcher-for-extractors)
- [`Iterator` chunking](#iterator-chunking)
- [Stage 1 proposals](#stage-1-proposals)
- [`Observable`](#observable)
- [New collections methods](#new-collections-methods)
Expand Down Expand Up @@ -2767,6 +2767,34 @@ Iterator.concat([0, 1].values(), [2, 3], function * () {
}()).toArray(); // => [0, 1, 2, 3, 4, 5]
```

##### [`Iterator` chunking](https://github.com/tc39/proposal-iterator-chunking)[⬆](#index)
Modules [`esnext.iterator.chunks`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.chunks.js), [`esnext.iterator.sliding`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.sliding.js)
and [`esnext.iterator.windows`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.windows.js)
```ts
class Iterator {
chunks(chunkSize: number): Iterator<any>;
sliding(windowSize: number): Iterator<any>;
windows(windowSize: number): Iterator<any>;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/iterator-chunking
core-js(-pure)/full/iterator/chunks
core-js(-pure)/full/iterator/sliding
core-js(-pure)/full/iterator/windows
```
[*Examples*](https://tinyurl.com/24xnkcnn)
```js
const digits = () => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].values();

let chunksOf2 = Array.from(digits().chunks(2)); // [ [0, 1], [2, 3], [4, 5], [6, 7], [8, 9] ]

let slidingOf2 = Array.from(digits().sliding(2)); // [ [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9] ]

let windowsOf2 = Array.from(digits().windows(2)); // [ [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9] ]
```

##### [Joint iteration](https://github.com/tc39/proposal-joint-iteration)[⬆](#index)
Modules [esnext.iterator.zip](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.zip.js), [esnext.iterator.zip-keyed](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.zip-keyed.js)
```ts
Expand Down Expand Up @@ -3058,34 +3086,6 @@ core-js/proposals/pattern-extractors
core-js(-pure)/full/symbol/custom-matcher
```

##### [`Iterator` chunking](https://github.com/tc39/proposal-iterator-chunking)[⬆](#index)
Modules [`esnext.iterator.chunks`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.chunks.js), [`esnext.iterator.sliding`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.sliding.js)
and [`esnext.iterator.windows`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.windows.js)
```ts
class Iterator {
chunks(chunkSize: number): Iterator<any>;
sliding(windowSize: number): Iterator<any>;
windows(windowSize: number): Iterator<any>;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/iterator-chunking
core-js(-pure)/full/iterator/chunks
core-js(-pure)/full/iterator/sliding
core-js(-pure)/full/iterator/windows
```
[*Examples*](https://tinyurl.com/24xnkcnn)
```js
const digits = () => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].values();

let chunksOf2 = Array.from(digits().chunks(2)); // [ [0, 1], [2, 3], [4, 5], [6, 7], [8, 9] ]

let slidingOf2 = Array.from(digits().sliding(2)); // [ [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9] ]

let windowsOf2 = Array.from(digits().windows(2)); // [ [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9] ]
```

#### Stage 1 proposals[⬆](#index)
[*CommonJS entry points:*](#commonjs-api)
```
Expand Down
1 change: 1 addition & 0 deletions packages/core-js/stage/2.7.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
var parent = require('./3');

require('../proposals/iterator-chunking');
require('../proposals/iterator-sequencing');
require('../proposals/map-upsert-v4');

Expand Down
1 change: 0 additions & 1 deletion packages/core-js/stage/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var parent = require('./2.7');
require('../proposals/array-is-template-object');
require('../proposals/async-iterator-helpers');
require('../proposals/extractors');
require('../proposals/iterator-chunking');
require('../proposals/iterator-range');
require('../proposals/string-dedent');
require('../proposals/symbol-predicates-v2');
Expand Down
Loading