Permalink
Browse files

Minor: rename some internal helper functions.

  • Loading branch information...
1 parent ba4d55c commit 05c797d108ee7438c31fcb6a968f9810bbfaffa9 @aseemk committed Jun 25, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 index.js
View
@@ -3,8 +3,8 @@ module.exports = express = require('express');
// wraps the streamline-style handler (req, res, _) to the style express
// requires (req, res, next). note that error handlers have an extra argument,
// and express examines the route function's length to determine this!
-function wrapHandler(handler) {
- function makeCallback(next) {
+function wrap(handler) {
+ function callback(next) {
return function (err) {
if (err) return next(err);
// otherwise, if successful, don't call next
@@ -13,11 +13,11 @@ function wrapHandler(handler) {
if (handler.length >= 4) {
return function (err, req, res, next) {
- handler(err, req, res, makeCallback(next));
+ handler(err, req, res, callback(next));
}
} else {
return function (req, res, next) {
- handler(req, res, makeCallback(next));
+ handler(req, res, callback(next));
}
}
}
@@ -31,7 +31,7 @@ function patch(verb) {
app[verb] = function () {
// wrap the handler function, which is the last argument:
var last = arguments.length - 1;
- arguments[last] = wrapHandler(arguments[last]);
+ arguments[last] = wrap(arguments[last]);
// then call the original verb with this wrapped handler:
origAppVerb.apply(this, arguments);
};

0 comments on commit 05c797d

Please sign in to comment.