1.8.0 • Published 4 years ago

async-modules-loader v1.8.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

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

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install async-modules-loader

Usage

Simple Usage (simple usage to run the loadmodules function)

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);

Configuration Options

  • name: name of the package
  • options: Configures the npm packages:

    • url - name of the npm package
    • default - set to true for automatically importing the default value
    • moduleName - set a dynamic name for the variable to import to. Should follow the basic rules of naming a variable.

License

MIT License

Author

Sayan Mohsin (iamsayanmohsin@gmail.com)

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago