Skip to content

Commit

Permalink
Minor improvement to toArray
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ellis committed Oct 8, 2013
1 parent bbc6e21 commit 66f6843
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/queue-flow.js
Expand Up @@ -515,12 +515,10 @@ Q.prototype.toArray = function toArray(last) {
self.handlerCallback(struct, function() {
outArr.push(value);
});
}, function(end) {
if(typeof last === 'function') {
last(outArr);
} else {
outQueue.pushOne(outArr)[end]();
}
}, typeof(last) === 'function' ? function() {
last(outArr);
} : function(end) {
outQueue.pushOne(outArr)[end]();
});
if(!this.wasName) this.close();
return outQueue;
Expand Down

0 comments on commit 66f6843

Please sign in to comment.