
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
dependency-injector
Advanced tools
JavaScript dependency injection
npm install dependency-injector
var DI = require('dependency-injector')
var di = new DI()
di.register({ foo: 2 })
var functionWithDependency = di.inject(function (foo) {
return foo
})
functionWithDependency == 2 // true
register(name, fn) | register(dependencies)Registers your dependencies with the current instance of DI.
register('foo', 2)
register({ foo: 2 })
getParameterNames(fn)Utility function to retrieve parameter names from a function.
getParameterNames(function (foo, bar, baz) { }) // == ['foo', 'bar', 'baz']
inject(fn, additionalDependencies)Creates a function that is loaded with the dependencies. You may pass in additional dependencies at this point.
inject(function (foo + bar) { return foo + bar }, { bar: 3 })
clone()Clones the current set of dependencies into its own object.
var anotherInstance = clone()
FAQs
Dependency Injection via function arguments
The npm package dependency-injector receives a total of 139 weekly downloads. As such, dependency-injector popularity was classified as not popular.
We found that dependency-injector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.