Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

iterator-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iterator-promise

Iterator over a stack of functions.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
5
-16.67%
Maintainers
1
Weekly downloads
 
Created
Source

iterator-promise NPM version Build Status

Iterator over a stack of functions.

This module is intended to be used with loader-cachebut may be used by itself or in other modules.

Install with npm

$ npm i iterator-promise --save

Usage

var iterator = require('iterator-promise');

API

iterator

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) {
    console.log(pkg);
  });

<%- related(['iterator-sync', 'iterator-async', 'iterator-streams', 'loader-cache']) %>

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.

This file was generated by verb-cli on June 12, 2015.

FAQs

Package last updated on 13 Jun 2015

Did you know?

Socket

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.

Install

Related posts