Created
February 20, 2014 14:32
-
-
Save azu/9114925 to your computer and use it in GitHub Desktop.
Promise.filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listTree = FS.listTree("../../data/", function isIndexHTML(filePath, stat) { | |
if (stat.isDirectory()) { | |
return false; | |
} | |
return path.basename(filePath) === "index.html"; | |
}).then(function (fileList) { | |
var promiseMap = Promise.filter(fileList, function (filePath) { | |
return FS.exists(path.join(path.dirname(filePath), "index.json")).then(function(result){ | |
return !result; | |
}); | |
}); | |
return Promise.all(promiseMap).then(function (res) { | |
console.log(res); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment