npm install --save npm-dependency-injector
Require your package.json
file as the first
argument and your modules root function as the second argument followed
by any additional arguments.
var dependencyInjector = require('npm-dependency-injector'),
packageJSON = require('./package.json'),
exampleFunction = require('./exampleFunction.js');
module.exports = dependencyInjector(
packageJSON,
exampleFunction
);
module.exports = function(dependencies) {
var uuid = dependencies['uuid-v4'];
return uuid();
};