
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
tiny, powerful dependency injection container for node and browser inspired on angularJS
The installation of this package is very simple: In fact, it can be installed by just running:
$ npm install dotie # if using NodeJS
$ bower install dotie # if you want to use this package in the browser
/**
* create an new dependency into container
* @param {string} name - name of dependency
* @param {any} provider - dependence
* @returns {this}
*/
dotie.register(name, provider) /* or */ dotie.<name> = provider
/**
* find and resolve dependencies and return then
* @param {string} name - name of dependency
* @returns {any} - registered provider instance
*/
dotie.resolve(name) /* or */ dotie.<name>
// small sintax
dotie.q = () => $.Deferred() // dotie.<name> = dependence
// default sintax
dotie.register('http', function(q) {
return (...params) => {
$.ajax(...params)
.success(data => q.resolve(data))
.error(error => q.reject(error))
return q.promise()
}
})
// using angular injection style (option 1)
dotie.register('user', ['http', http => {
return {
find: code => http(`localhost:2650/api/users/${code}`)
}
}])
// angular injection style (option 2)
function controller(model) {
user.find(1)
.then(user => console.log(user))
.catch(error => console.log(error))
}
controller.$inject = [ 'user' ]
dotie.register('controller', controller) /* or */ dotie.controller = controller
FAQs
tiny, powerful dependency injection container for node and browser
We found that dotie 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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.