Jock dependencies into any function.
Example
//// mod.js module { /* ... */} //// main.js var dj = var mod = {} {} djdj// ordj var rest = 123 mod = // jock the deps // mod is called with dep1, dep2 and rest
API
var dj = require('dependency-jockey')()
Create a new dj for jocking your deps.
dj.register(name, obj)
Register a dependency obj
for the name name
.
dj.register(deps)
Register multiple dependencies. deps
is an object whose keys are the dependency names and values are the dependency object.
dj(func)
Jock the dependencies for func
. Returns a new function, that, when called, will automatically populate parameter names that have dependencies registered for them.
Beware, once dj finds a param that doesn't have a dependency registered it stops, allowing you to call the function and pass additional params, not registered with dj.