Skip to content

Commit

Permalink
Put the if-else in the inOut helper function in the 'definition' port…
Browse files Browse the repository at this point in the history
…ion of the function rather than the inner loop
  • Loading branch information
David Ellis committed Oct 8, 2013
1 parent 564c6d5 commit 51274c5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/queue-flow.js
Expand Up @@ -289,17 +289,21 @@ Q.prototype.waitSync = makeSync(Q.prototype.wait);
// `inOut` is a helper function used by several of the Q prototype methods that
// take an input queue and produce an output queue.
var inOut = function inOut(outQueue, setter, callback) {
this.setHandlers(function(self, value, struct) {
if(isAsync(callback, 2)) {
if(isAsync(callback, 2)) {
this.setHandlers(function(self, value, struct) {
callback(value, function(result) {
self.handlerCallback(struct, setter.bind(this, value, result));
});
} else {
}, function(end) {
outQueue[end]();
});
} else {
this.setHandlers(function(self, value, struct) {
self.handlerCallback(struct, setter.bind(this, value, callback(value)));
}
}, function(end) {
outQueue[end]();
});
}, function(end) {
outQueue[end]();
});
}
return outQueue;
};

Expand Down

0 comments on commit 51274c5

Please sign in to comment.