Skip to content

Instantly share code, notes, and snippets.

@noeljackson
Created August 14, 2019 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noeljackson/d134452406c1f2d63aa7ee81937edd75 to your computer and use it in GitHub Desktop.
Save noeljackson/d134452406c1f2d63aa7ee81937edd75 to your computer and use it in GitHub Desktop.
Push out all functions from all files in all directories
const req = require.context('.', true, /\.\/[^/]+\/[^/]+\.js$/);
req.keys().forEach(key => {
Object.keys(req(key)).forEach( component => module.exports[component] = req(key)[component]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment