Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
dicontainer
Advanced tools
#dicontainer
Tiny dependency container
###Basic Usage
####Setup
var Container = require('dicontainer');
var appContainer = new Container(logFunction /* optional */);
####Registration
container.register(name, factory /* or service/provider */);
function MathService(other) {}
MathService.prototype.add = function (a,b) { return a+b; };
MathService.$inject = ['OtherService'];
appContainer.register('MathService', MathService); // Dependencies are read from $inject property
// --- or ----
function MathService(other) {}
MathService.prototype.add = function (a,b) { return a+b; };
appContainer.register('MathService', MathService, ['OtherService']); // Dependencies are specified as array
// --- or ----
function MathService(other) {}
MathService.prototype.add = function (a,b) { return a+b; };
appContainer.register('MathService', ['OtherService', MathService]); // Dependencies and service are specified as array
####Resolution
var instance = container.resolve(name);
var MathService = appContainer.resolve('MathService');
MathService.add(1,2);
####Mixin
Service instances are attached to this.services
var Calculator = React.createClass({
mixins: [appContainer.Mixin('MathService', 'OtherService')]
render: function () {
this.services.MathService.add()
}
});
####Building & testing
npm run build // lint, test & compile dist
npm test // test in terminal
npm run test-local // run test in browser
FAQs
Simple dependency container
The npm package dicontainer receives a total of 0 weekly downloads. As such, dicontainer popularity was classified as not popular.
We found that dicontainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.