【发布时间】:2014-06-28 06:58:22
【问题描述】:
我有一个名为 recipesArray 的对象数组。
recipesArray = [ [{name = "the recipe name", url = "http://recipeurl.com"},
{name = "the other neame", url = "http://adifferenturl.com"},
{name = "another recipe", url = "http://anotherurl.com"}],
[{name = "the recipe name", url = "http://recipeurl.com"},
{name = "the other neame", url = "http://adifferenturl.com"},
{name = "another recipe", url = "http://anotherurl.com"}],
[{name = "the recipe name", url = "http://recipeurl.com"},
{name = "the other neame", url = "http://adifferenturl.com"},
{name = "another recipe", url = "http://anotherurl.com"}] ]
我想跳出这个嵌套的 async.each 循环,但继续主 async.each 循环。
// main async.each
async.each(recipes, function(subArray, callback1) {
// nested async.each
async.each(subArray, function(theCurrentRecipe, callback2) {
checkHREFS(theCurrentRecipe, function(thisRecipe) {
if ('i have a conditional here') {
// break out of this nested async.each,
// but continue the main async.each.
} else {
// continue
}
callback2();
});
}, callback1);
}, function(err) {
if (err) {
return console.error(err);
// success, all recipes iterated
});
【问题讨论】:
标签: javascript node.js loops asynchronous async.js