Skip to content

Commit

Permalink
move Iterator.range proposal to Stage 2
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Mar 23, 2023
1 parent 096cb45 commit ea36fe1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
## Changelog
##### Unreleased
- [`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)
- `(Async)DisposableStack.prototype.move` marks the original stack as disposed, [#1226](https://github.com/zloirock/core-js/issues/1226)
- 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
Expand Down
48 changes: 24 additions & 24 deletions README.md
Expand Up @@ -161,6 +161,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [Well-formed unicode strings](#well-formed-unicode-strings)
- [Stage 2 proposals](#stage-2-proposals)
- [`AsyncIterator` helpers](#asynciterator-helpers)
- [`Iterator.range`](#iteratorrange)
- [`Map.prototype.emplace`](#mapprototypeemplace)
- [`Array.isTemplateObject`](#arrayistemplateobject)
- [`String.dedent`](#stringdedent)
Expand All @@ -175,7 +176,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`Array` filtering](#array-filtering)
- [`Array` deduplication](#array-deduplication)
- [Getting last item from `Array`](#getting-last-item-from-array)
- [`Iterator.range`](#iteratorrange)
- [`Number.fromString`](#numberfromstring)
- [`Math` extensions](#math-extensions)
- [`Math.signbit`](#mathsignbit)
Expand Down Expand Up @@ -2473,6 +2473,29 @@ 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
Expand Down Expand Up @@ -2852,29 +2875,6 @@ array.lastItem = 4;

array; // => [1, 2, 4]
```
##### [`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
}
```
##### [`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
Expand Down
1 change: 0 additions & 1 deletion packages/core-js/stage/1.js
Expand Up @@ -5,7 +5,6 @@ require('../proposals/array-last');
require('../proposals/array-unique');
require('../proposals/collection-methods');
require('../proposals/collection-of-from');
require('../proposals/iterator-range');
require('../proposals/keys-composition');
require('../proposals/math-extensions');
require('../proposals/math-signbit');
Expand Down
1 change: 1 addition & 0 deletions packages/core-js/stage/2.js
Expand Up @@ -4,6 +4,7 @@ require('../proposals/array-is-template-object');
require('../proposals/async-explicit-resource-management');
require('../proposals/async-iterator-helpers');
require('../proposals/decorator-metadata');
require('../proposals/iterator-range');
require('../proposals/map-upsert-stage-2');
require('../proposals/string-dedent');
require('../proposals/symbol-predicates');
Expand Down

0 comments on commit ea36fe1

Please sign in to comment.