Last active
April 19, 2017 10:08
-
-
Save aprilandjan/aed42a64aa5da4d23aa8747fc2e3b4b8 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
function requireAll(requireContext) { | |
var result = {} | |
requireContext.keys().forEach(path => { | |
var name = path.replace(/^.*(\\|\/|\:)/, '').split('.')[0] | |
result[name] = requireContext(path) | |
}) | |
return result | |
} | |
var modules = requireAll(require.context("./api", false, /^\.\/.*\.js$/)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment