Permalink
Browse files

0.1.7 - forEach always passes on a result

  • Loading branch information...
1 parent 58db916 commit e60e5df18c203fef1ecb61109345965044bfd418 @tim-smart committed Sep 15, 2011
Showing with 15 additions and 2 deletions.
  1. +14 −1 index.js
  2. +1 −1 package.json
View
@@ -83,7 +83,6 @@ AsyncArray.prototype.filterSerial = function (callback) {
* @constructor
* @param {AsyncArray} array
*/
-
function Operation (array) {
this.array = array
this.steps = []
@@ -357,6 +356,20 @@ ForEach.prototype.next = function (state, i, error, data) {
Step.prototype.next.call(this, state, i, error, data)
}
+/**
+ * When the step is done
+ *
+ * @param {Error} error
+ * @param {StepState} state
+ */
+ForEach.prototype.done = function (error, state) {
+ if (0 === state.result.length) {
+ state.result = state.array
+ }
+
+ Step.prototype.done.call(this, error, state)
+}
+
// --------------------
/**
View
@@ -1,7 +1,7 @@
{ "name" : "async-array"
, "description" : "A sane control flow library"
, "keywords" : ["control", "flow", "async", "array"]
-, "version" : "0.1.6"
+, "version" : "0.1.7"
, "author" : "Tim Smart"
, "repository" :
{ "type" : "git"

0 comments on commit e60e5df

Please sign in to comment.