di-helper
v3.0.2
Published
A concise JavaScript dependency injector
Downloads
3
Readme
di-helper
A concise JavaScript dependency injector
import { provide } from 'di-helper';
provide('logger').as(console.log);
// ...
import { using } from 'di-helper';
const greet = using((['logger'], (log, name) => {
log(`Hello ${name}!`);
});
greet('world');
Usage
Install
di-heper
is built into UMD package, which supports both ESM, CommonJS, etc..
// Default instance and its methods
import { context, provide, resolve, resolveAll, using } from 'di-helper';
const { context, provide, resolve, resolveAll, using } = require('di-helper');
// Context class
import { Context } from 'di-helper';
const { Context } = require('di-helper');
API
See API documentation.