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

Package detail

@d-fischer/promise.allsettled

es-shims5.4kMIT2.0.2TypeScript support: included

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

Build Status 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.

v2.0.2 - 2021-07-12

Commits

  • [Breaking] add native ESM support 9113ed0
  • change package.json to publish as a fork 6f0a740
  • abide to new upstream lint rules cc1f002
  • remove additional named export in favor of default 63b996b
  • fix typo af32ae4

v1.0.4 - 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
  • [Fix] properly call-bind Promise.all and Promise.reject 1f90b0e
  • [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