Function diHas

  • Check that Dependency Injection friendly function was overriden

    Should be called within diInit callback

    Type Parameters

    • T extends Function

    Parameters

    • dep: T

    Returns boolean

    const fun = di(x => x + 1)
    diSet(fun, x => x + 2)
    diHas(fun) // true

    DiNotInitializedError if called outside of diInit callback

  • Check that dependency was registered by string literal in Dependency Injection container

    Should be called within diInit callback

    Parameters

    • dep: string

    Returns boolean

    const user: User = {login: 'root', roles: ['admin']}
    diSet('user', user)
    diHas('user') // true

    DiNotInitializedError if called outside of diInit callback