Created
July 18, 2015 16:36
-
-
Save colthreepv/6f8971c9d5c25fa1e53c to your computer and use it in GitHub Desktop.
Recursively include files and convert paths to camelCase
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
// 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