getSource()function

getSource(type: Class<T>, value: unknown): T | undefined
ParamType
typeClass<T>
The class to search for an instance of. required
valueunknown
The object to start searching from. required
Return
T | undefined
The first matching source instance, or undefined if none matches.

Recurse through Sourceable objects and return the first one that is an instance of type, or undefined if no source object matches.

  • Follows the source property chain (e.g. layered providers) until a matching instance is found.

Examples

getSource(CacheProvider, provider) // CacheProvider instance or undefined