promise-one-at-a-time

1.0.1 • Public • Published

Build Status npm version

promise-one-at-a-time

Run promise-creating functions one at a time.

Install

npm install promise-one-at-a-time --save

Use

Pass in an array of functions that return promises. They will be ran one at a time and the last value will be returned.

var oneAtATime = require("promise-one-at-a-time");
 
var fns = [
  function(){
    return new Promise(function(resolve){
      resolve();
    });
  },
  function(){
    return new Promise(function(resolve){
      resolve("works");
    });
  }
];
 
oneAtATime(fns).then(function(val){
  // val === "works"
});

License

BSD 2 Clause

Readme

Keywords

Package Sidebar

Install

npm i promise-one-at-a-time

Weekly Downloads

129

Version

1.0.1

License

BSD-2-Clause

Last publish

Collaborators

  • matthewp