Skip to content

robhicks/es2015-Promise.allSettled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

es2015-Promise.allSettled

What This Is

This is a ponyfill for Promise.allSettled.

It works like you would expect. It is safe so if Promise.allSettled ever gets added to JavaScript, it shouldn't break, of course assuming the one added supports the same way of handling promise resolution and rejection.

Promise.allSettled(promises)
.then((results) => {
    results.forEach(function (result) {
        if (result.state === "fulfilled") {
          let value = result.value;
        } else {
          let reason = result.reason;
        }
    });
});

Installation

NodeJS

npm i es2015-promise.allsettled -S

Bower

bower install es2015-promise.allsettled -S

Usage

NodeJS

require('es2015-promise.allsettled');

es2015

import 'es2015-promise.allsettled'

About

es2015 Promise.allSettled Ponyfill

Resources

Stars

Watchers

Forks

Packages

No packages published