Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

promise.allsettled

es-shims6mMIT1.0.7TypeScript support: definitely-typed

ES Proposal spec-compliant shim for Promise.allSettled

Promise, promises, allsettled, settled, fulfilled, resolved, rejected, promise.allsettled, shim, polyfill, es-shim, API

readme

promise.allsettled Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

ES Proposal spec-compliant shim for Promise.allSettled. Invoke its "shim" method to shim Promise.allSettled if it is unavailable or noncompliant. Note: a global Promise must already exist: the es6-shim is recommended.

This package implements the es-shim API interface. It works in an ES3-supported environment that has Promise available globally, and complies with the proposed spec.

Most common usage:

var assert = require('assert');
var allSettled = require('promise.allsettled');

var resolved = Promise.resolve(42);
var rejected = Promise.reject(-1);

allSettled([resolved, rejected]).then(function (results) {
    assert.deepEqual(results, [
        { status: 'fulfilled', value: 42 },
        { status: 'rejected', reason: -1 }
    ]);
});

allSettled.shim(); // will be a no-op if not needed

Promise.allSettled([resolved, rejected]).then(function (results) {
    assert.deepEqual(results, [
        { status: 'fulfilled', value: 42 },
        { status: 'rejected', reason: -1 }
    ]);
});

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.7 - 2023-09-03

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic c9d57a1
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, es6-shim, tape 68f2785

v1.0.6 - 2022-11-07

Commits

  • [actions] reuse common workflows b9d78d9
  • [meta] use npmignore to autogenerate an npmignore file 4507529
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, safe-publish-latest, tape 6e2c01c
  • [actions] update codecov uploader 2a24151
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, functions-have-names, tape cfa4e59
  • [Deps] update array.prototype.map, define-properties, es-abstract, get-intrinsic c841f03
  • [actions] update rebase action to use reusable workflow 9f663ac

v1.0.5 - 2021-10-03

Commits

  • [actions] use node/install instead of node/run; use codecov action 7d77553
  • [actions] partial revert of 7d77553474ee8370a2fabdceaf07c86e89a989df; fix promise-shimmed tests 760421a
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, auto-changelog, tape 95ed131
  • [Deps] update array.prototype.map, es-abstract 2cb2b26
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape e0d6e23
  • [readme] add github actions/codecov badges 3796b86
  • [actions] update workflows 170c0a9
  • [Deps] update es-abstract, get-intrinsic a148f57
  • [meta] use prepublishOnly script for npm 7+ b09d1ee

v1.0.4 - 2021-01-20

Commits

  • [Fix] properly call-bind Promise.all and Promise.reject 1f90b0e

v1.0.3 - 2021-01-20

Commits

  • [Tests] migrate tests to Github Actions a066121
  • [meta] use auto-changelog 7b27067
  • [meta] do not publish github action workflow files aae74fd
  • [Tests] run nyc on all tests; use tape runner; add implementation tests fbd8198
  • [Deps] update array.prototype.map, es-abstract; add call-bind 424f760
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, call-bind, functions-have-names, tape 47c5df1
  • [actions] add "Allow Edits" workflow d931b6c
  • [Refactor] use es-abstract’s callBind instead of function-bind directly 09c25e8
  • [Dev Deps] update eslint, @ljharb/eslint-config, functions-have-names, tape; add aud 03aedb0
  • [Deps] update array.prototype.map, es-abstract, iterate-value f28e1aa
  • [Tests] test in older nodes that 3e873f7 now supports 5feffee
  • [actions] switch Automatic Rebase workflow to pull_request_target event b30a268
  • [meta] only run aud on prod deps bf97e5f
  • [Deps] update es-abstract 6a6ae55
  • [Deps] update iterate-value 13507f3

v1.0.2 - 2019-12-13

Commits

  • [Tests] use shared travis-ci configs 3a5a379
  • [meta] move repo to es-shims org 240a87c
  • [Fix] no longer require Array.from; works in older envs 3e873f7
  • [actions] add automatic rebasing / merge commit blocking 4ab52ef
  • [Tests] skip "undefined receiver" test 9612591
  • [Refactor] use split-up es-abstract (44% bundle size decrease) ed49521
  • [Dev Deps] update eslint, @ljharb/eslint-config, functions-have-names, safe-publish-latest 7f97708
  • [Tests] temporarily comment out failing test in node 12+ 275507f
  • [meta] add funding field 96b75aa
  • [Tests] suppress unhandled rejection warnings 8ee2263
  • [Tests] use functions-have-names 43ed9ca
  • [Dev Deps] update tape df12368

v1.0.1 - 2019-05-06

Fixed

  • [Fix] when a promise has a poisoned .then method, reject the overarching promise #1

Commits

  • [Tests] up to node v12.1, v11.15 4d76716
  • [Dev Deps] update eslint fc23682

v1.0.0 - 2019-03-27

Commits