Permalink
Browse files

More code style improvements

  • Loading branch information...
1 parent 42f4765 commit 6335dd9194f6b9f974050cf7ec459fcb7276ae6e @bnoguchi committed Feb 29, 2012
Showing with 9 additions and 15 deletions.
  1. +2 −5 lib/routeTriggeredSequence.js
  2. +7 −10 lib/stepSequence.js
@@ -7,11 +7,8 @@ var RouteTriggeredSequence = module.exports = function RouteTriggeredSequence (n
RouteTriggeredSequence.prototype.__proto__ = StepSequence.prototype;
RouteTriggeredSequence.prototype.routeHandler = function () {
- // Create a shallow clone, so that
- // seq.values are different per
- // HTTP request
+ // Create a shallow clone, so that seq.values are different per HTTP request
var seq = this.materialize();
- // Kicks off a sequence of steps based on
- // a route.
+ // Kicks off a sequence of steps based on a route
seq.start.apply(seq, arguments); // BOOM!
};
View
@@ -47,16 +47,11 @@ var materializedMethods = {
return priorStepPromise;
}
- /**
- * Used for exposing the leading promise
- * of a step promise chain to the incoming
- * args (e.g., [req, res] pair from the
- * route handler)
- */
+ // Used for exposing the leading promise of a step promise chain to the
+ // incoming args (e.g., [req, res] pair from the route handler)
, _transposeArgs: function (args) {
- var firstStep = this.steps[0]
- , seq = this;
- firstStep.accepts.forEach( function (paramName, i) {
+ var seq = this;
+ this.steps[0].accepts.forEach( function (paramName, i) {
// Map the incoming arguments to the named parameters
// that the first step is expected to accept.
seq.values[paramName] = args[i];
@@ -109,7 +104,9 @@ StepSequence.prototype = {
});
if (i > 0 && missingParams.length)
- throw new Error('At step, ' + step.name + ', you are trying to access the parameters: ' + missingParams.join(', ') + ' . However, only the following parameters have been promised from prior steps thus far: ' + paramsToDate.join(', '));
+ throw new Error('At step, ' + step.name + ', you are trying to access the parameters: ' +
+ missingParams.join(', ') + ' . However, only the following parameters have been ' +
+ 'promised from prior steps thus far: ' + paramsToDate.join(', '));
paramsToDate = paramsToDate.concat(step.promises);

0 comments on commit 6335dd9

Please sign in to comment.