---
title: 'Promise.allSettled() Pt.2 - it''s partly settled!'
date: 2019-04-26
excerpt: 'This is a follow-up to my first post on the upcoming Promise.allSettled() function, coming soon to a node application near you. '
tags: [npm, javascript, dev, react]
canonical: https://mikebifulco.com/posts/promise-all-settled-pt-2-its-partly-settled
---
# Promise.allSettled() Pt.2 - it's partly settled!

This is a follow-up to my [first post](https://mikebifulco.com/posts/solve-all-your-problems-with-promise-allsettled) on the upcoming `Promise.allSettled()` function, coming soon to a node application near you.

Earlier today I was greeted by a [Pull Request](https://github.com/mbifulco/blog/pull/14) on my first post from GitHub user `@j-f1`.

![Screenshot of a github pull request on my last blog post](https://res.cloudinary.com/mikebifulco-com/image/upload/q_auto:eco,f_auto/v1/posts/promise-all-settled-pt-2-its-partly-settled/pr)

*PR on my last post, showing how to use Promise.allSettled() now!*

It turns out there *is* a handy way to add `Promise.allSettled()` to your apps *right now!* 🎉.  It's fiendishly simple to use, too.

## **The core-js npm package**

That's right - [core-js](https://github.com/zloirock/core-js).  From their `README.md`, it is exactly what it sounds like:

> It is a polyfill of the JavaScript standard library, which supports:
>
> - The latest ECMAScript standard.
> - ECMAScript standard library proposals.
> - Some WHATWG / W3C standards (cross-platform or closely related ECMAScript).
>
> It is maximally modular: you can easily choose to load only the features you will be using.
> It can be used without polluting the global namespace.
> It is [tightly integrated with `babel`: this allows many optimizations of `core-js` import.](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#Babel)

[Looking further down in the readme](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#Babel), there's a list of supported features in the polyfill:

> [Promise.allSettled](https://github.com/tc39/proposal-promise-allSettled) stage 2 proposal

Well hot damn! That'll do it!

## **How to use core-js**

As `@j-f1` indicated, in any project that uses `babel` as a transpiler, all you need to do is add core-js to your project, and include it at your app's entry point:

First, add the dependency to your project

```bash
    > yarn add core-js
```

Then, at your app's entry point (usually something like `index.js`, or `app.js` in the root of your project):

```js
import 'core-js';
```

or, if you want to include *just* the `Promise.allSettled()` polyfill, and nothing else, use:

```js
import 'core-js/proposals/promise-all-settled';
```

That's it! 🍻

## More from mikebifulco.com

- [What it's like to migrate a high-traffic website from Gatsby to Next.js](https://mikebifulco.com/posts/migrate-gatsby-to-nextjs-apisyouwonthate-com)
- [How to run dependabot locally on your projects](https://mikebifulco.com/posts/run-dependabot-locally)
- [Some things I learned from live coding on Twitch](https://mikebifulco.com/posts/twitch-streaming-software-development-lessons)

---

Written by Mike Bifulco. Originally published at https://mikebifulco.com/posts/promise-all-settled-pt-2-its-partly-settled
