UNPKG

routing-controllers

Version:

Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.

24 lines 726 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runInSequence = runInSequence; /** * Runs given callback that returns promise for each item in the given collection in order. * Operations executed after each other, right after previous promise being resolved. */ function runInSequence(collection, callback) { const results = []; return collection .reduce((promise, item) => { return promise .then(() => { return callback(item); }) .then(result => { results.push(result); }); }, Promise.resolve()) .then(() => { return results; }); } //# sourceMappingURL=runInSequence.js.map