npm.io
0.1.2 • Published 10 years ago

justo-injector

Licence
Version
0.1.2
Deps
0
Vulns
0
Weekly
0
Stars
1

Build Status

Dependency injector.

Proudly made with in Valencia, Spain, EU.

Functions

hasParameter()

Checks whether a function has a specified parameter:

hasParameter(name : string, fn : function) : boolean
getParameters()

Returns an array with the parameters:

getParameters(fn : function) : string[]
getParameterIndex()

Returns the parameter index:

getParameterIndex(name : string, fn : function) : number
inject()

Returns the argument array for a call:

inject(args : object, fn : function) : object[]

Example:

function fn(x, y, z) {}

args = inject({x: 1, y: 2}, fn);  //[1, 2, undefined]

Keywords