@mdzzohrabi/container
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    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' })

    Install

    npm i @mdzzohrabi/container

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    30.3 kB

    Total Files

    7

    Last publish

    Collaborators

    • mdzzohrabi