
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
iterator-promise
Advanced tools
Iterate over a stack of functions.
This module works with loader-cache but it can also used by itself or with other modules.
Install with npm
$ npm i iterator-promise --save
var iterator = require('iterator-promise');
Iterate over a stack of promise functions passing the results of each function to the next function in the stack.
Params
stack {Array}: Array of functions to call.returns {Function}: Returns a function that will iterator over the given stack of functions.var fs = require('fs');
var iterator = require('iterator-promise');
var Promise = require('bluebird');
Promise.promisifyAll(fs);
var stack = [
Promise.method(function (fp) {
return fs.readFileAsync(fp, 'utf8');
}),
Promise.method(function (contents) {
return JSON.parse(contents);
})
];
var readJSON = iterator(stack);
readJSON('./package.json')
.then(function (pkg) {
pkg.a = 'b';
return pkg;
})
.then(function (pkg) {
pkg.c = 'd';
return pkg;
})
.then(function (pkg) {
console.log(pkg);
});
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright © 2015 Brian Woodward Released under the MIT license.
This file was generated by verb-cli on June 19, 2015.
FAQs
Iterate over a stack of functions.
We found that iterator-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.