
Security News
NIST Officially Stops Enriching Most CVEs as Vulnerability Volume Skyrockets
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.
easy-dependency-loader
Advanced tools
A simple way to manage your dependencies and use require with no problems with relative paths. It is very useful to complex project structures and when it is needed to change some file from it's place.
EDL requires Node.js v4+ to run.
$ npm install --save easy-dependency-loader
Make sure you have a dependencies list in the following format:
{
...
"dependency1": "path/to/dependency1",
"dependency2": "path/to/dependency2",
"dependency3": "path/to/dependency3",
...
}
It can be described in a JSON file or in a object. The EDL works exactly in the same way of require, so, every load that works with require also works with EDL.
EDL.setDependencies(dependencies); //As an object descriptor
EDL.setDependencies('./path/to/dependencies.json'); //Path to dependencies file
var myDependencies = require('./path/to/dependencies.json');
EDL.setDependencies(myDependencies); //Using an JSON module with require
Then, you just need to call the name of module using the load() method. Is no necessary to use the relative path.
var Module = EDL.load('moduleName');
Module.doSomething();
var EDL = require('easy-dependency-loader');
//Passing a JSON path
EDL.setDependencies('./path/to/jsonfile/dependencies.json');
//Passing a JSON module with require
var myDependencies = require('./configs/confgis.json');
EDL.setDependencies(myDependencies);
//Passing an object
EDL.setDependencies({
"Dog": "./models/Dog.js",
"Falcon": "./models/birds/Falcon.js",
"Chicken": "./models/birds/Chicken.js",
"Worm": "./models/birds/insects/Worm.js"
});
//Finally, you can call the module in other place of project
var EDL = require('easy-dependency-loader')
var Dog = EDL.load('Dog');
var Worm = EDL.load('Worm');
Dog.bark();
Worm.crawl();
Pull requests are welcome!
In general, problems with using this module maybe are problems with require, such wrong relative path or file type. But if not, you can open an issue and make a pull request!
MIT
FAQs
A simple way to manage your dependencies and use "require" with no problems with relative paths. It is very useful to complex project structures and when it is needed to change some file from it's place.
We found that easy-dependency-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.