promise-one-at-a-time
v1.0.1 Promise
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
npm i promise-one-at-a-time
Metadata
- BSD-2-Clause
- Whatever
- Matthew Phillips
- released 10/20/2015