@mdzzohrabi/container

Dependency Injection Container

Stats

StarsIssuesVersionUpdatedCreatedSize
@mdzzohrabi/container
1.0.14 years ago4 years agoMinified + gzip package size for @mdzzohrabi/container in KB

Readme

Container

Usage

Simple usage :

let container = new Container
container.setParams({
    dbName: 'myDB'
})

container.set('connection', ($dbName) => {
    return $dbName;
})

container.get('connection'); // return "myDb"

Advanced :

let container = new Container({
    // Log service
    log: ($env) => {
        if ($env === 'dev') return (...params) => console.log(...params);
        return () => void;
    },
    // Database connection
    db: function dbConnection(log, $dbHost) {
        log(`Initialize connection`)
    }
}, { env: 'dev', dbHost: 'localhost' })

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.