πŸ’Œ Tiny Improvements

Promise.allSettled() Pt.2 - it's partly settled!

This is a follow-up to my first post on the upcoming Promise.allSettled() function, coming soon to a node application near you.

This is a follow-up to my first post on the upcoming Promise.allSettled() function, coming soon to a node application near you.

Earlier today I was greeted by a Pull Request on my first post from GitHub user @j-f1.

Screenshot of a github pull request on my last blog post
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. Β From their README.md, it is exactly what it sounds like:

Looking further down in the readme, there's a list of supported features in the polyfill:

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

1
> 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):

1
import 'core-js';

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

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

That's it! 🍻

Hero
Promise.allSettled() Pt.2 - it's partly settled!

This is a follow-up to my first post on the upcoming Promise.allSettled() function, coming soon to a node application near you.

npmjavascriptdevreact
***

Related Reading

How to run dependabot locally on your projects
Article

How to run dependabot locally on your projects

Since its release, teams around the world have been using dependabot to automate the process of keeping your project's dependencies up to date. In this article, I'll show you how you can run dependabot on the command line using dependabot-core.

Some things I learned from live coding on Twitch
Article

Some things I learned from live coding on Twitch

For years I did a weekly coding livestream of my React and Python work on Twitch every week, and I'm getting back into it again. This is what sticks out to me as the most valuable learnings from those experiences.

Mike Bifulco headshot

πŸ’Œ Tiny Improvements Newsletter

Subscribe and join πŸ”₯ 1300 other builders

My weekly newsletter for product builders. It's a single, tiny idea to help you build better products.

    Once a week, straight from me to you. 😘 Unsubscribe anytime.


    Get in touch to β†’ Sponsor Tiny Improvements