justo-injector

0.1.2 • Public • Published

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]

Package Sidebar

Install

npm i justo-injector

Weekly Downloads

2

Version

0.1.2

License

none

Last publish

Collaborators

  • justojs