Skip to content

Commit

Permalink
move Iterator.range to stage 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Apr 8, 2024
1 parent 5e703c4 commit 8c64475
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog
##### Unreleased
- [`Iterator.range`](https://github.com/tc39/proposal-iterator.range):
- Built-ins:
- `Iterator.range`
- Moved to stage 2.7, April 2024 TC39 meeting
- [`Promise.try`](https://github.com/tc39/proposal-promise-try):
- Built-ins:
- `Promise.try`
Expand Down
50 changes: 24 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [Explicit resource management](#explicit-resource-management)
- [`Symbol.metadata` for decorators metadata proposal](#symbolmetadata-for-decorators-metadata-proposal)
- [Stage 2.7 proposals](#stage-27-proposals)
- [`Iterator.range`](#iteratorrange)
- [`Promise.try`](#promisetry)
- [Stage 2 proposals](#stage-2-proposals)
- [`AsyncIterator` helpers](#asynciterator-helpers)
- [`Iterator.range`](#iteratorrange)
- [`Map.prototype.emplace`](#mapprototypeemplace)
- [`Array.isTemplateObject`](#arrayistemplateobject)
- [`String.dedent`](#stringdedent)
Expand Down Expand Up @@ -2498,6 +2498,29 @@ core-js(-pure)/actual|full/function/metadata
core-js(-pure)/stage/2.7
```

##### [`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
}
```

##### [`Promise.try`](https://github.com/tc39/proposal-promise-try)
Module [`esnext.promise.try`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.promise.try.js)
```js
Expand All @@ -2513,11 +2536,8 @@ core-js(-pure)/full/promise/try
[*Examples*](https://goo.gl/k5GGRo):
```js
Promise.try(() => 42).then(it => console.log(`Promise, resolved as ${it}`));
Promise.try(() => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
Promise.try(async () => 42).then(it => console.log(`Promise, resolved as ${it}`));
Promise.try(async () => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
```

Expand Down Expand Up @@ -2601,29 +2621,7 @@ 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
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-range');
require('../proposals/promise-try');

module.exports = parent;
1 change: 0 additions & 1 deletion packages/core-js/stage/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var parent = require('./2.7');

require('../proposals/array-is-template-object');
require('../proposals/async-iterator-helpers');
require('../proposals/iterator-range');
require('../proposals/map-upsert-stage-2');
require('../proposals/regexp-escaping');
require('../proposals/string-dedent');
Expand Down

0 comments on commit 8c64475

Please sign in to comment.