ts-ioc-container
Version:
Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.
10 lines (9 loc) • 437 B
JavaScript
export const Is = {
nullish: (value) => value === undefined || value === null,
object: (target) => target !== null && typeof target === 'object',
instance: (target) => Object.prototype.hasOwnProperty.call(target, 'constructor'),
constructor: (target) => typeof target === 'function' && !!target.prototype,
};
export function resolveConstructor(target) {
return Is.constructor(target) ? target : target.constructor;
}