Skip to content

Commit

Permalink
move Array.fromAsync proposal to stage 2
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 15, 2021
1 parent b4826af commit 95a1749
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- `%TypedArray%.prototype.toSpliced`
- `%TypedArray%.prototype.with`
- Added `Iterator.prototype.toAsync` method from [the iterator helpers stage 2 proposal](https://github.com/tc39/proposal-iterator-helpers)
- [`Array.fromAsync` proposal](https://github.com/tc39/proposal-array-from-async) moved to stage 2
- Added [`String.cooked` stage 1 proposal](https://github.com/tc39/proposal-string-cooked):
- `String.cooked`
- Added [`Function.prototype.unThis` stage 0 proposal](https://github.com/js-choi/proposal-function-un-this)
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ Promise.resolve(32).then(x => console.log(x)); // => 32
- [ECMAScript proposals](#ecmascript-proposals)
- [Stage 4 proposals](#stage-4-proposals)
- [Stage 3 proposals](#stage-3-proposals)
- [`Array` grouping](#array-grouping)
- [`Array` find from last](#array-find-from-last)
- [Stage 2 proposals](#stage-2-proposals)
- [`Iterator` helpers](#iterator-helpers)
- [New `Set` methods](#new-set-methods)
- [`Map.prototype.emplace`](#mapprototypeemplace)
- [`Array` grouping](#array-grouping)
- [Change `Array` by copy](#change-array-by-copy)
- [`Array.fromAsync`](#arrayfromasync)
- [`Array.isTemplateObject`](#arrayistemplateobject)
- [`Symbol.{ asyncDispose, dispose }` for `using` statement](#symbol-asyncdispose-dispose--for-using-statement)
- [`Symbol.metadata` for decorators proposal](#symbolmetadata-for-decorators-proposal)
Expand All @@ -112,7 +113,6 @@ Promise.resolve(32).then(x => console.log(x)); // => 32
- [New collections methods](#new-collections-methods)
- [`.of` and `.from` methods on collection constructors](#of-and-from-methods-on-collection-constructors)
- [`compositeKey` and `compositeSymbol`](#compositekey-and-compositesymbol)
- [`Array.fromAsync`](#arrayfromasync)
- [`Array` filtering](#array-filtering)
- [`Array` deduplication](#array-deduplication)
- [Getting last item from `Array`](#getting-last-item-from-array)
Expand Down Expand Up @@ -2205,6 +2205,22 @@ const correctionNeeded = [1, 1, 3];
correctionNeeded.with(1, 2); // => [1, 2, 3]
correctionNeeded; // => [1, 1, 3]
````
##### [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async)[⬆](#index)
Modules [`esnext.array.from-async`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.from-async.js).
```js
class Array {
static fromAsync(asyncItems: AsyncIterable | Iterable | ArrayLike, mapfn?: (value: any, index: number) => any, thisArg?: any): Array;
}
```
[*CommonJS entry points:*](#commonjs-api)
```js
core-js/proposals/array-from-async
core-js(-pure)/features/array/from-async
```
[*Example*](https://goo.gl/Jt7SsD):
```js
await Array.fromAsync((async function * (){ yield * [1, 2, 3] })(), i => i * i); // => [1, 4, 9]
```
##### [`Array.isTemplateObject`](https://github.com/tc39/proposal-array-is-template-object)[⬆](#index)
Module [`esnext.array.is-template-object`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.is-template-object.js)
```js
Expand Down Expand Up @@ -2422,22 +2438,6 @@ console.log(compositeSymbol(1, a) === compositeSymbol(1, a)); // => true
console.log(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); // => true
console.log(compositeSymbol(a, a) === compositeSymbol(a, a)); // => true
```
##### [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async)[⬆](#index)
Modules [`esnext.array.from-async`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.from-async.js).
```js
class Array {
static fromAsync(asyncItems: AsyncIterable | Iterable | ArrayLike, mapfn?: (value: any, index: number) => any, thisArg?: any): Array;
}
```
[*CommonJS entry points:*](#commonjs-api)
```js
core-js/proposals/array-from-async
core-js(-pure)/features/array/from-async
```
[*Example*](https://goo.gl/Jt7SsD):
```js
await Array.fromAsync((async function * (){ yield * [1, 2, 3] })(), i => i * i); // => [1, 4, 9]
```
##### [Array filtering](https://github.com/tc39/proposal-array-filtering)[⬆](#index)
Modules [`esnext.array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.filter-reject.js) and [`esnext.typed-array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.typed-array.filter-reject.js).
```js
Expand Down
1 change: 0 additions & 1 deletion packages/core-js/stage/1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require('../proposals/array-filtering');
require('../proposals/array-from-async');
require('../proposals/array-last');
require('../proposals/array-unique');
require('../proposals/collection-methods');
Expand Down
1 change: 1 addition & 0 deletions packages/core-js/stage/2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('../proposals/array-from-async');
require('../proposals/array-is-template-object');
require('../proposals/change-array-by-copy');
require('../proposals/decorators');
Expand Down

0 comments on commit 95a1749

Please sign in to comment.