From 6cff5dd78e17be3d18b4187f426a516f2d371bf6 Mon Sep 17 00:00:00 2001 From: vamonte Date: Thu, 3 Dec 2015 23:41:25 +0100 Subject: [PATCH] Fix the ability to use a function for the option. The lookup function worked only for the first time. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a613cfa..ab8675b 100644 --- a/index.js +++ b/index.js @@ -49,8 +49,9 @@ module.exports = function (app, db) { }) } if (typeof(opts.lookup) === 'function') { + var callableLookup = opts.lookup; middleware = function (middleware, req, res, next) { - return opts.lookup(req, res, opts, function () { + return callableLookup(req, res, opts, function () { return middleware(req, res, next) }) }.bind(this, middleware)