Coder Social home page Coder Social logo

busterc / promise-do-whilst Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 7 KB

:loop: Calls a function repeatedly while a condition returns true and then resolves the promise

License: ISC License

JavaScript 100.00%
promise promises promise-library promise-modules es6-promise flow-control

promise-do-whilst's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

blogfoster

promise-do-whilst's Issues

pass action result to condition

hey,

thanks for this promise helper. I just realized while using, it would be more comfortable if the result of the action function could be passed to the condition function. see #2

Thrown error is silenced when rejection is not caught

Hello!

Thank you for this great module!

However, I have some unexpected behavior with thrown errors: when I throw an error from inside of action function, it's silenced somehow when the rejection is not caught.

Here's the simplified example:

const Promise = require('bluebird');
const promiseDoWhilst = require('promise-do-whilst');


foo().then(result => console.log('Result', result));
// Error is displayed in the console.

bar().then(result => console.log('Result', result));
// Error is ignored, no output.


function foo () {
  return Promise.resolve().then(() => {
    throw new Error('Some error');
  });
}

function bar () {
  return promiseDoWhilst(() => {
    throw new Error('Some error');
  }, () => true);
}

I do prefer to see all thrown errors in the output of the Node.js application.

Thanks!

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.