diff --git a/CHANGELOG.md b/CHANGELOG.md index 35f1202f646e..3890d289afc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 94f885cce3da..c80d65a0368e 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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) @@ -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 @@ -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 diff --git a/packages/core-js/stage/1.js b/packages/core-js/stage/1.js index 1102feae68da..b81019f897cc 100644 --- a/packages/core-js/stage/1.js +++ b/packages/core-js/stage/1.js @@ -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'); diff --git a/packages/core-js/stage/2.js b/packages/core-js/stage/2.js index 838b1168bcae..f4e9a03ee1c7 100644 --- a/packages/core-js/stage/2.js +++ b/packages/core-js/stage/2.js @@ -1,3 +1,4 @@ +require('../proposals/array-from-async'); require('../proposals/array-is-template-object'); require('../proposals/change-array-by-copy'); require('../proposals/decorators');