Giter Club home page Giter Club logo

promise.allsettled's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

promise.allsettled's Issues

version 1.0.2 breaks webpack: 'return' outside of function

Using 1.0.1 works but 1.0.2 breaks webpack build with:

Creating an optimized production build...
Failed to compile.

./node_modules/is-map/index.js
SyntaxError: /usr/app/node_modules/is-map/index.js: 'return' outside of function (12:1)

  10 | \t\treturn false;
  11 | \t};
> 12 | \treturn;
     | \t^
  13 | }
  14 | 
  15 | var $mapHas = $Map ? Map.prototype.has : null;

An in-range update of es-abstract is breaking the build 🚨

The dependency es-abstract was updated from 1.17.0-next.1 to 1.17.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

es-abstract is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Commits

The new version differs by 12 commits.

  • 91c2c22 v1.17.0
  • 96719b9 [Dev Deps] update @ljharb/eslint-config
  • c52fa59 [Fix] GetIntrinsic: IE 8 has a broken Object.getOwnPropertyDescriptor
  • fb308ec [Deps] update is-callable, string.prototype.trimleft, string.prototype.trimright
  • b84552d [Dev Deps] update tape
  • 9be0385 [Refactor] GetIntrinsic: further simplification
  • 0c7f99a [Tests] add .eslintignore
  • e2df4de [Dev Deps] update object-is
  • 158ed34 [Deps] update is-regex
  • 3567ae9 [Refactor] GetIntrinsic: remove the internal property salts, since % already handles that
  • 84c50fb [Dev Deps] update object.fromentries
  • f0b1083 [meta] remove unused Makefile and associated utils

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Throwing an error make rejected promises return empty reason

Hi, I have the following code inside a function that returns a promise:

throw new Error("couldn't resolve submission");

And then a I have as well:

const results = await promiseAllSettled(externalResponsePromises);

But whein I log the results const I got:

[{"status":"rejected","reason":{}}]

Why I'm not seeing the error described in the reason object?

An in-range update of iterate-value is breaking the build 🚨

The dependency iterate-value was updated from 1.0.0 to 1.0.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

iterate-value is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Commits

The new version differs by 4 commits.

  • 605603a v1.0.1
  • c1d9674 [meta] fix "exports" field, for node v13.0 and v13.1
  • a1b24fb [Deps] update es-get-iterator
  • 6c3b444 [Dev Deps] update eslint

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

What is the baseline requirement for use in Node v11?

So, I assumed that the "Typical Usage" example was supposed to be comprehensive, and that not all lines of it are required to use the function allSettled(). From that example, I did this:

    var pas = require('promise.allsettled');
    pas.shim();

    Promise.allSettled(listeners).then(()=> {
      res.status(200).send(JSON.stringify(this.putResults));
    }).catch( err => {
      wslog.warn(`POST request for ${this.filename} failed, at least in part: ${err}`)
      res.status(200).send(JSON.stringify(this.putResults));
    });

But I'm still getting TypeError: Promise.allSettled is not a function. Do I need to use all those lines just to patch Promise? Seems overkill... I only added promise.allsettled from NPM.

"#<Object> is not a constructor" when used with TypeScript's `allowSyntheticDefaultImports` & `esModuleInterop`

I'm hitting trouble when trying to use this library in a TypeScript & Babel project. I installed both the lib and the types as usual:

npm i promise.allsettled @types/promise.allsettled

The standard require (as described in README) is not TypeScript-friendly, which is normal:

const allSettled = require('promise.allsettled');

// allSettled is `any` at this point, @types are unused

That's why the type tests use this syntax:

import allSettled = require("promise.allsettled");

However, that's not supported by Babel 7 and transitively by all tools that depend on it. For example, our Jest tests fail with this:

SyntaxError: demo.ts: import = is not supported by @babel/plugin-transform-typescript
Please consider using import <moduleName> from '<moduleName>'; alongside Typescript's --allowSyntheticDefaultImports option.

Again, this is quite normal and the common fix is to create this tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
  }
}

and use this import syntax:

import allSettled from 'promise.allsettled';

We use this for several other modules and even with promise.allsettled, TypeScript is happy at this point and Jest test pass (the promise.allsettled code is executed correctly at runtime!).

However, it leads to this error when running the app through plain node (or via ts-node):

TypeError: #<Object> is not a constructor
    at Object.resolve (<anonymous>)
    at Object.PromiseResolve (/example/node_modules/promise.allsettled/node_modules/es-abstract/es2018.js:160:10)
    at /example/node_modules/promise.allsettled/implementation.js:26:24
    at Function.from (<anonymous>)
    at Object.allSettled (/example/node_modules/promise.allsettled/implementation.js:19:22)
    at Object.allSettled [as default] (/example/node_modules/promise.allsettled/index.js:16:9)
    at myFunction (/example/demo.ts:329:53)
    at process._tickCallback (internal/process/next_tick.js:68:7)

My theory is this: in the --esModuleInterop & allowSyntheticDefaultImports mode, TypeScript transpiles the import to this:

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const promise_allsettled_1 = __importDefault(require("promise.allsettled"));

Note how it wrapped the module into default property, so the usages look like this in the transpiled code:

await promise_allsettled_1.default(...)

And probably, promise.allsettled doesn't like this and throws the #<Object> is not a constructor error.

I didn't dive deep into how the various "binds" in this library work but if there was a way to make it more friendly to that specific TypeScript emit scenario, that would be great.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.