How to filter a list using lodash if the filter function is asynchronous
lodash may not be the best tool for this job. I recommend you use async
.
https://github.com/caolan/async#filter
Example: fs.exists
is an asynchronous function which checks for the existence of a file then calls a callback.
async.filter(['file1','file2','file3'], fs.exists, function(results){
// results now equals an array of the existing files
});