Last active
November 28, 2016 22:44
-
-
Save birjj/9c22fe757eea3ef594e243c681f60539 to your computer and use it in GitHub Desktop.
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
const readdirp = require('readdirp'); | |
let filtered = {}; | |
let added = {}; | |
function filter(entry){ | |
filtered[entry.fullPath] = true; | |
return true; | |
} | |
readdirp({ | |
root: '.', | |
entryType: 'all', | |
fileFilter: filter, | |
directoryFilter: filter, | |
depth: 0, | |
lstat: true | |
}).on('data', (entry)=>{ | |
added[entry.fullPath] = true; | |
}).on('end', ()=>{ | |
var allGood = true; | |
for (var k in added) { | |
if (!filtered.hasOwnProperty(k)) { | |
console.log('Added file without filtering it:',k); | |
allGood = false; | |
} | |
} | |
if (allGood) { | |
console.log('Everything\'s good (',Object.keys(added).length,':',Object.keys(filtered).length,')'); | |
} | |
}); |
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
Everything's good ( 192 : 192 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment