@vdtn359/require-context
v1.0.1
Published
same as webpack require.context,and can be used everywhere.
Downloads
1
Readme
node-require-context
same as
webpack
=>require.context
Usage
npm i --save node-require-context
Example
const requireContext = require('node-require-context')
const context = requireContext('.', true, /\.js$/)
context.keys().forEach(moduleId=>{
context(moduleId)
})
API
requireContext ( directory, useSubdirectories, regExp )
directory
search dir default '.'
useSubdirectories
true
will search all child file ;false
only search current dir ; defaulttrue
regExp
RegExp match ; default
/(?:)/