Skip to content

Instantly share code, notes, and snippets.

@colthreepv
Created July 18, 2015 16:36
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 colthreepv/6f8971c9d5c25fa1e53c to your computer and use it in GitHub Desktop.
Save colthreepv/6f8971c9d5c25fa1e53c to your computer and use it in GitHub Desktop.
Recursively include files and convert paths to camelCase
// Recursively include files and convert paths to camelCase
var bulk = require('bulk-require');
exports = module.exports = bulk(__dirname, ['./!(index|_*|*.spec).js']);
Object.keys(exports).forEach(function (key) {
var camelCased = key;
camelCased = camelCased.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
if (camelCased !== key) {
exports[camelCased] = exports[key];
delete exports[key];
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment