javascript - Node.js concat array after async.concat() -
i have array, need recompile use of edits. of async.concat(), not working. tell me, mistake?
async.concat(dialogs, function(dialog, callback) { if (dialog['viewer']['user_profile_image'] != null) { fs.exists(im.pathtouserimage + dialog['viewer']['user_profile_image'].replace('%s', ''), function(exits) { if (exits) { dialog['viewer']['user_profile_image'] = dialog['viewer']['user_profile_image'].replace('%s', ''); } callback(dialog); }); } }, function() { console.log(arguments); }); in opinion, logical. callback invoked after first iteration. how can send data after completion of processing entire array?
thank you!
instead of callback(dialog);, want
callback(null,dialog);
because first parameter callback function error object. reason console.log(arguments) getting called after first iteration because async thinks error occurred.
Comments
Post a Comment