I have a task, and if it's been done, already, I need to skip it, and if it hasn't, I need to perform it. The task is asynchonous. After this, I need to do the same check for another task, and possibly perform it...
if(!taskStatus.complete[x])
asyncTasks[x](function(result){
if(!taskStatus.complete[y])
asyncTasks[y](function(result){
stow(result);
});
});
if(!taskStatus.complete[y])
asyncTasks[y](function(result){
stow(result);
});
In other words, the second task needs to be performed regardless of whether or not the first gets done, but if the first is to be done, the second cannot happen until after it finishes.
My code has repeated itself quite a bit here, which is generally a very bad thing. Is it unavoidable for Node's hipness? Is Node too hip to be DRY?