credstash-cli
Version:
Node.js credstash CLI implementation
25 lines (19 loc) • 373 B
JavaScript
;
module.exports = {
mapPromise(array, fn) {
let idx = 0;
const results = [];
function doNext() {
if (idx >= array.length) {
return results;
}
return fn(array[idx])
.then((res) => {
idx += 1;
results.push(res);
})
.then(() => doNext());
}
return doNext();
},
};