npm.io
1.1.1 • Published 11 years ago

fn-stack

Licence
MIT
Version
1.1.1
Deps
2
Vulns
0
Weekly
0
Stars
1
DeprecatedThis package is deprecated

fn-stack

Use generic middleware in your JavaScript applications (similar to stack by creationix).

Installation

Via npm:
$ npm install fn-stack

Via git:

$ git clone git@github.com:sbruchmann/fn-stack.git
$ cd fn-stack/
$ npm install

Usage

"use strict";

var FNStack = require("fn-stack");
var stack = new FNStack();

stack.push(function log(value, next) {
    process.nextTick(function() {
        console.log(value); // => "Hello, world!"
        next(null);
    });
});

stack.run(["Hello, world!"], function onDone(err) {
    if (err) {
        throw err;
    }

    console.log("Done.");
});