Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

iterator-sync

doowb23MIT0.1.1

Iterate over a stack of functions.

compose, iterate, iterator, load, loader, loader-cache, read

readme

iterator-sync NPM version Build Status

Iterate 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-sync --save

Usage

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

API

iterator

Iterate over a stack of 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-sync');
var stack = [
  function (fp) { return fs.readFileSync(fp, 'utf8'); },
  function (contents) { return JSON.parse(contents); }
];
var readJSON = iterator(stack);
var pkg = readJSON('./package.json');
console.log(pkg);

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 17, 2015.