From d1d6e026faac20dcb261b712d8fee0b88a38450e Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Fri, 12 Mar 2021 14:40:45 +0700 Subject: [PATCH] move `Array` find from last proposal to the stage 2 https://github.com/babel/proposals/issues/71#issuecomment-795916535 --- CHANGELOG.md | 2 +- README.md | 52 ++++++++++++++++++------------------- packages/core-js/stage/1.js | 1 - packages/core-js/stage/2.js | 1 + 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac5fa920cf5d..a659b9e5c783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Changelog ##### Unreleased -- Nothing +- [`Array` find from last proposal](https://github.com/tc39/proposal-array-find-from-last) moved to the stage 1, [March TC39 meeting](https://github.com/babel/proposals/issues/71#issuecomment-795916535) ##### 3.9.1 - 2021.03.01 - Added a workaround for Chrome 38-40 bug which does not allow to inherit symbols (incl. well-known) from DOM collections prototypes to instances, [#37](https://github.com/zloirock/core-js/issues/37) diff --git a/README.md b/README.md index 7c9c7f5d3c4f..a7a01230a37f 100644 --- a/README.md +++ b/README.md @@ -2005,6 +2005,32 @@ map.emplace('b', { update: it => it ** 2, insert: () => 3}); // => 3 console.log(map); // => Map { 'a': 4, 'b': 3 } ``` +##### [Array find from last](https://github.com/tc39/proposal-array-find-from-last)[⬆](#index) +Modules [`esnext.array.find-last`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.array.find-last.js), [`esnext.array.find-last-index`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.array.find-last-index.js), [`esnext.typed-array.find-last`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.typed-array.find-last.js) and [`esnext.typed-array.find-last-index`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.typed-array.find-last-index.js). +```js +class Array { + findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any; + findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint; +} + +class %TypedArray% { + findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any; + findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint; +} +``` +[*CommonJS entry points:*](#commonjs-api) +``` +core-js/proposals/array-find-from-last +core-js(-pure)/features(/virtual)/array/find-last +core-js(-pure)/features(/virtual)/array/find-last-index +core-js/features/typed-array/find-last +core-js/features/typed-array/find-last-index +``` +[*Examples*](http://es6.zloirock.ru/#log(%5B1%2C%202%2C%203%2C%204%5D.findLast(it%20%3D%3E%20it%20%25%202))%3B%20%20%20%20%20%20%2F%2F%20%3D%3E%203%0Alog(%5B1%2C%202%2C%203%2C%204%5D.findLastIndex(it%20%3D%3E%20it%20%25%202))%3B%20%2F%2F%20%3D%3E%202): +```js +[1, 2, 3, 4].findLast(it => it % 2); // => 3 +[1, 2, 3, 4].findLastIndex(it => it % 2); // => 2 +```` #### Stage 1 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) @@ -2436,32 +2462,6 @@ core-js/features/typed-array/unique-by { id: 3, uid: 10001 } ].uniqueBy(it => it.id); // => [{ id: 1, uid: 10000 }, { id: 3, uid: 10001 }] ``` -##### [Array find from last](https://github.com/tc39/proposal-array-find-from-last)[⬆](#index) -Modules [`esnext.array.find-last`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.array.find-last.js), [`esnext.array.find-last-index`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.array.find-last-index.js), [`esnext.typed-array.find-last`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.typed-array.find-last.js) and [`esnext.typed-array.find-last-index`](https://github.com/zloirock/core-js/blob/v3.9.1/packages/core-js/modules/esnext.typed-array.find-last-index.js). -```js -class Array { - findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any; - findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint; -} - -class %TypedArray% { - findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any; - findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint; -} -``` -[*CommonJS entry points:*](#commonjs-api) -``` -core-js/proposals/array-find-from-last -core-js(-pure)/features(/virtual)/array/find-last -core-js(-pure)/features(/virtual)/array/find-last-index -core-js/features/typed-array/find-last -core-js/features/typed-array/find-last-index -``` -[*Examples*](http://es6.zloirock.ru/#log(%5B1%2C%202%2C%203%2C%204%5D.findLast(it%20%3D%3E%20it%20%25%202))%3B%20%20%20%20%20%20%2F%2F%20%3D%3E%203%0Alog(%5B1%2C%202%2C%203%2C%204%5D.findLastIndex(it%20%3D%3E%20it%20%25%202))%3B%20%2F%2F%20%3D%3E%202): -```js -[1, 2, 3, 4].findLast(it => it % 2); // => 3 -[1, 2, 3, 4].findLastIndex(it => it % 2); // => 2 -```` #### Stage 0 proposals[⬆](#index) [*CommonJS entry points:*](#commonjs-api) diff --git a/packages/core-js/stage/1.js b/packages/core-js/stage/1.js index 13e008813b72..af1220a5e4dc 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-find-from-last'); 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 ce3af1a44244..66f40facac12 100644 --- a/packages/core-js/stage/2.js +++ b/packages/core-js/stage/2.js @@ -1,3 +1,4 @@ +require('../proposals/array-find-from-last'); require('../proposals/array-is-template-object'); require('../proposals/iterator-helpers'); require('../proposals/map-upsert');