Not the first time I accidentally type the following:

```js
const allTheThings = await [pa, pb, pc];
```

I am assuming that JS will implicitly realize that'd be a `Promise.all([pa,
pb, pc])` call but nope.

Then I also realize it'd be cool to have other shortcuts too that play nice
with arrays such:

```js
Array.prototype.all = function all() { return Promise.all(this); };
Array.prototype.race = function race() { return Promise.race(this); };

// with the lovely addiction of ...
Array.prototype.any = function any() { return Promise.any(this); };

// with Promise.any being (sorry it was a tweet)
Promise.any = $ => new Promise((D,E,A,L) => {
  z = [];
  _ = $.map(($, i) => Promise.resolve($)
        .then(D, O => { z[i] = O; --_ || E(z) })
  ).length
});
```

So that ...
```js
const allTheThings = await [pa, pb, pc].all();
```

Yay? Nay? Silly? no-way?

I thought it was worth it to point this out.

Best Regards
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to