I've created the following method to aid me in finding an item and updating another object attribute with certain value like this:
mergeAinBbyAttr: function(a, b, attr, val, cb) {
async.forEach(a, function(itemA, cb) {
async.forEach(b, function(itemB, cb) {
if (itemA[attr] == itemB[attr]) {
itemB[val] = itemA[val];
}
cb(null, itemB);
},
function(e, result) {
cb(e, result);
});
},
function(e, result) {
cb(e, result);
});
}
The problem is that I get:
TypeError: cb is not a function
in the last cb(e, result);
. I have to admit I am a bit brain dead an the answer must be dead simple.
Thanks!
via Galgomedia
No comments:
Post a Comment