async-modules-loader is a node.js package for loading npm modules asynchronously with a single function, All you have to give is a single array.
npm install async-modules-loader
async-modules-loader is a node.js package for loading npm modules asynchronously with a single function, All you have to give is a single array.
Follow me (@sayanmohsin) on Twitter!
Follow me (@sayanmohsin) on github!
* Installation
* Usage
* Simple Usage
* Configuration Options
* License
* Author
This is a Node.js module available through the
npm registry. Installation is done using thenpm install command:
``sh`
$ npm install async-modules-loader
`javascript
var aml = require('async-modules-loader');
var aml_options = [{
name: 'passport',
options: {
url: 'passport',
default: true,
moduleName: 'passport'
}
}, {
name: 'cors',
options: {
url: 'cors',
default: false,
moduleName: 'cors'
}
}]
aml.loadModules(aml_options).then(importedModules => {
console.log(importedModules)
}).catch(err => {
console.log(err)
})
// or with async/await
var importedModules = await aml.loadModules(aml_options);
`
* name: name of the packageoptions
* : Configures the npm packages:url
- - name of the npm packagedefault
- - set to true for automatically importing the default valuemoduleName` - set a dynamic name for the variable to import to. Should follow the basic rules of naming a variable.
-
Sayan Mohsin (iamsayanmohsin@gmail.com)
[npm-url]: https://www.npmjs.com/package/async-modules-loader