major-a
Version:
A simple and easy to implement user authentication and tracking module for Express.
15 lines (13 loc) • 370 B
JavaScript
// For combining middleware. Takes an array of functions as a parameter
const compose = module.exports = exports = function combineMiddleware(mids) {
return mids.reduce(function(a, b) {
return function(req, res, next) {
a(req, res, function(err) {
if (err) {
return next(err);
}
b(req, res, next);
});
};
});
}