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..
import { context, provide, resolve, resolveAll, using } from 'di-helper';
const { context, provide, resolve, resolveAll, using } = require('di-helper');
import { Context } from 'di-helper';
const { Context } = require('di-helper');
API
See API documentation.