npm-dependency-injector

0.0.12 • Public • Published

npm-dependency-injector

Dependecy injector for pure functional npm modules.

installation

npm install --save npm-dependency-injector

usage

NOTE: node_modules/uuid-v4 is only for the example.

Require your package.json file as the first argument and your modules root function as the second argument followed by any additional arguments.

./index.js

var dependencyInjector = require('npm-dependency-injector'),
    packageJSON = require('./package.json'),
    exampleFunction = require('./exampleFunction.js');

module.exports = dependencyInjector(
    packageJSON,
    exampleFunction
);

./exampleFunction.js

module.exports = function(dependencies) {
    var uuid = dependencies['uuid-v4'];
    return uuid();
};

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.120latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.120
0.0.1110
0.0.110
0.0.10

Package Sidebar

Install

npm i npm-dependency-injector

Weekly Downloads

0

Version

0.0.12

License

ISC

Last publish

Collaborators

  • nicholastancredi