function Chain(options) {
    assert.optionalObject(options, 'options');
    options = options || {};
    assert.optionalBool(options.onceNext, 'options.onceNext');
    assert.optionalBool(options.strictNext, 'options.strictNext');

    this.onceNext = !!options.onceNext;
    this.strictNext = !!options.strictNext;

    // strictNext next enforces onceNext
    if (this.strictNext) {
        this.onceNext = true;
    }

    this._stack = [];
    this._once = this.strictNext === false ? once : once.strict;
}
Create a new middleware chain

@public
@class Chain
@param {Object} [options] - options
@param {Boolean} [options.onceNext=false] - Prevents calling next multiple
 times
@param {Boolean} [options.strictNext=false] - Throws error when next() is
 called more than once, enables onceNext option
@example
var chain = new Chain();
chain.add(function (req, res, next) { next(); })
// chain.add(function (req, res, next) { next(new Error('Foo')); })
// chain.add(function (req, res, next) { next(false); })

http.createServer((req, res) => {
   chain.run(req, res, function done(err) {
      res.end(err ? err.message : 'hello world');
   });
})