Use functions as generic middleware.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
CHANGELOG.md
LICENSE.md
README.md
index.js
package.json
test.js

README.md

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.use(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.");
});