Skip to content

Instantly share code, notes, and snippets.

@tylerpaige
Created January 3, 2019 19:07
Show Gist options
  • Save tylerpaige/f4653ab0f4f54c9dd5724a921f30cec6 to your computer and use it in GitHub Desktop.
Save tylerpaige/f4653ab0f4f54c9dd5724a921f30cec6 to your computer and use it in GitHub Desktop.
const path = require('path')
const getAllFiles = (dir, ext = '.js') => {
return readDir(dir).then(children => {
return children
.filter(fileName => {
const fileExtension = path.extname(fileName);
return fileExtension.includes(ext);
})
.map(fileName => path.resolve(dir, fileName));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment