Ghost/core/server/utils/sequence.js

14 lines
287 B
JavaScript
Raw Normal View History

var Promise = require('bluebird');
function sequence(tasks) {
return Promise.reduce(tasks, function (results, task) {
return task().then(function (result) {
results.push(result);
return results;
});
}, []);
}
module.exports = sequence;