Skip to content

Commit 3348b1a

Browse files
committed
move Promise.try to stage 2
1 parent 7ec37c1 commit 3348b1a

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Changelog
22
##### Unreleased
3+
- [`Promise.try` proposal](https://github.com/tc39/proposal-promise-try) has been resurrected and [moved to stage 2](https://github.com/tc39/proposal-promise-try/issues/15)
34
- Fixed regression in `Set#intersection` feature detection
45
- Fixed a missed check in `Array#{ indexOf, lastIndexOf, includes }`, [#1325](https://github.com/zloirock/core-js/issues/1325), thanks [**@minseok-choe**](https://github.com/minseok-choe)
56
- Fixed a missed check in `Array#{ reduce, reduceRight }`, [#1327](https://github.com/zloirock/core-js/issues/1327), thanks [**@minseok-choe**](https://github.com/minseok-choe)

README.md

+25-24
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
169169
- [`Array.isTemplateObject`](#arrayistemplateobject)
170170
- [`String.dedent`](#stringdedent)
171171
- [`RegExp` escaping](#regexp-escaping)
172+
- [`Promise.try`](#promisetry)
172173
- [`Symbol` predicates](#symbol-predicates)
173174
- [`Uint8Array` to / from base64 and hex](#uint8array-to-from-base64-and-hex)
174175
- [Stage 1 proposals](#stage-1-proposals)
@@ -178,7 +179,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
178179
- [`compositeKey` and `compositeSymbol`](#compositekey-and-compositesymbol)
179180
- [`Array` filtering](#array-filtering)
180181
- [`Array` deduplication](#array-deduplication)
181-
- [`Promise.try`](#promisetry)
182182
- [`DataView` get / set `Uint8Clamped` methods](#dataview-get-set-iint8clamped-methods)
183183
- [`Number.fromString`](#numberfromstring)
184184
- [`Math` extensions](#math-extensions)
@@ -2680,6 +2680,30 @@ console.log(RegExp.escape('10$')); // => '\\x310\\$'
26802680
console.log(RegExp.escape('abcdefg_123456')); // => 'abcdefg_123456'
26812681
console.log(RegExp.escape('(){}[]|,.?*+-^$=<>\\/#&!%:;@~\'"`')); // => '\\(\\)\\{\\}\\[\\]\\|\\,\\.\\?\\*\\+\\-\\^\\$\\=\\<\\>\\\\\\/\\#\\&\\!\\%\\:\\;\\@\\~\\\'\\"\\`'
26822682
```
2683+
2684+
##### [`Promise.try`](https://github.com/tc39/proposal-promise-try)
2685+
Module [`esnext.promise.try`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.promise.try.js)
2686+
```js
2687+
class Promise {
2688+
static try(callbackfn: Function): Promise;
2689+
}
2690+
```
2691+
[*CommonJS entry points:*](#commonjs-api)
2692+
```js
2693+
core-js/proposals/promise-try
2694+
core-js(-pure)/full/promise/try
2695+
```
2696+
[*Examples*](https://goo.gl/k5GGRo):
2697+
```js
2698+
Promise.try(() => 42).then(it => console.log(`Promise, resolved as ${it}`));
2699+
2700+
Promise.try(() => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
2701+
2702+
Promise.try(async () => 42).then(it => console.log(`Promise, resolved as ${it}`));
2703+
2704+
Promise.try(async () => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
2705+
```
2706+
26832707
##### [`Symbol` predicates](https://github.com/tc39/proposal-symbol-predicates)[⬆](#index)
26842708
Modules [`esnext.symbol.is-registered-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-registered-symbol.js), [`esnext.symbol.is-well-known-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-well-known-symbol.js).
26852709
```js
@@ -2952,29 +2976,6 @@ core-js/full/typed-array/unique-by
29522976
].uniqueBy(it => it.uid); // => [{ id: 1, uid: 10000 }, { id: 3, uid: 10001 }]
29532977
```
29542978

2955-
##### [`Promise.try`](https://github.com/tc39/proposal-promise-try)
2956-
Module [`esnext.promise.try`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.promise.try.js)
2957-
```js
2958-
class Promise {
2959-
static try(callbackfn: Function): Promise;
2960-
}
2961-
```
2962-
[*CommonJS entry points:*](#commonjs-api)
2963-
```js
2964-
core-js/proposals/promise-try
2965-
core-js(-pure)/full/promise/try
2966-
```
2967-
[*Examples*](https://goo.gl/k5GGRo):
2968-
```js
2969-
Promise.try(() => 42).then(it => console.log(`Promise, resolved as ${it}`));
2970-
2971-
Promise.try(() => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
2972-
2973-
Promise.try(async () => 42).then(it => console.log(`Promise, resolved as ${it}`));
2974-
2975-
Promise.try(async () => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`));
2976-
```
2977-
29782979
##### [`DataView` get / set `Uint8Clamped` methods](https://github.com/tc39/proposal-dataview-get-set-uint8clamped)[⬆](#index)
29792980
Modules [`esnext.data-view.get-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-uint8-clamped.js) and [`esnext.data-view.set-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-uint8-clamped.js)
29802981
```js

packages/core-js/stage/1.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ require('../proposals/number-from-string');
1414
require('../proposals/object-iteration');
1515
require('../proposals/observable');
1616
require('../proposals/pattern-matching');
17-
require('../proposals/promise-try');
1817
require('../proposals/seeded-random');
1918
require('../proposals/string-code-points');
2019
require('../proposals/string-cooked');

packages/core-js/stage/2.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require('../proposals/array-is-template-object');
66
require('../proposals/async-iterator-helpers');
77
require('../proposals/iterator-range');
88
require('../proposals/map-upsert-stage-2');
9+
require('../proposals/promise-try');
910
require('../proposals/regexp-escaping');
1011
require('../proposals/string-dedent');
1112
require('../proposals/symbol-predicates-v2');

0 commit comments

Comments
 (0)