Comparing version 0.3.0 to 0.3.1
@@ -67,5 +67,7 @@ exports.forEach = forEach; | ||
output.push(result); | ||
if (err) { | ||
callback(err); | ||
} else if (i == length) { | ||
err ? callback(err) : run(); | ||
} | ||
function run() { | ||
if (i == length) { | ||
callback(null, output); | ||
@@ -80,3 +82,3 @@ } else if (i in iterable) { | ||
process.nextTick(cont); | ||
process.nextTick(run); | ||
} | ||
@@ -99,3 +101,9 @@ | ||
callback(null, false); | ||
} else if (i == length) { | ||
} else { | ||
run(); | ||
} | ||
} | ||
function run() { | ||
if (i == length) { | ||
callback(null, true); | ||
@@ -110,3 +118,3 @@ } else if (i in iterable) { | ||
process.nextTick(cont); | ||
process.nextTick(run); | ||
} | ||
@@ -129,3 +137,9 @@ | ||
callback(null, true); | ||
} else if (i == length) { | ||
} else { | ||
run(); | ||
} | ||
} | ||
function run() { | ||
if (i == length) { | ||
callback(null, false); | ||
@@ -140,3 +154,3 @@ } else if (i in iterable) { | ||
process.nextTick(cont); | ||
process.nextTick(run); | ||
} | ||
@@ -157,9 +171,8 @@ | ||
var item = iterable[i]; | ||
if (result) { | ||
output.push(item); | ||
} | ||
if (err) { | ||
callback(err); | ||
} else if (i == length) { | ||
if (result) { output.push(item); } | ||
err ? callback(err) : run(); | ||
} | ||
function run() { | ||
if (i == length) { | ||
callback(null, output); | ||
@@ -174,3 +187,3 @@ } else if (i in iterable) { | ||
} | ||
process.nextTick(cont); | ||
process.nextTick(run); | ||
} | ||
@@ -177,0 +190,0 @@ |
@@ -1,17 +0,22 @@ | ||
{ | ||
{ | ||
"name": "async-it", | ||
"description": "Generic asynchronous iterators for node.js.", | ||
"main": "index.js", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Tobie Langel <tobie.langel@gmail.com> (http://tobielangel.com)", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/tobie/async-it.git" | ||
"url": "git://github.com/tobie/async-it.git" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type" : "MIT", | ||
"url" : "http://github.com/tobie/async-it/raw/master/LICENSE" | ||
"type": "MIT", | ||
"url": "http://github.com/tobie/async-it/raw/master/LICENSE" | ||
} | ||
] | ||
], | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"engines": { | ||
"node": "*" | ||
} | ||
} |
12796
386