import { TypedArray } from './array.js'; import { AsyncService, SyncService } from './interfaces.js'; import { Factory, Class } from './types.js'; export { isPromise } from '@spinajs/util'; /** * Checks if value is constructable type. * Checks for [[Construct]] internal function in object. * * @param value - value to test */ export declare function isConstructor(value: any): value is Class; /** * * Dirty way for check if type is class type * NOTE: it will not work with transpilers that * compile js class into functions * * @param obj * @returns */ export declare function isClass(obj: any): any; export declare function isFactory(value: any): value is Factory; export declare function isObject(value: any): value is object; export declare function isAsyncService(value: any): value is AsyncService; export declare function isSyncService(value: any): value is SyncService; /** * For DI purpose we treat Map as array to inject. Difference is, that we fill map by some key * provided by mapFunc in \@Autoinject * @param value - value to check type * @returns */ export declare function isTypedArray(value: any): value is TypedArray; export declare function isMap(value: any): value is Map; export declare function uniqBy(arr: T[], comparator: (a: T, b: T) => boolean): T[]; export declare function getTypeName(type: TypedArray | Class | string | object): string; /** * Sorts items so that every item comes after the items it depends on * ( stable DFS topological sort - items with no dependencies keep input order ). * * Use it to order creation of services that reference each other by name, * eg. fs providers where temp fs wraps another configured provider. * * @param items - items to sort * @param key - returns unique identifier of an item * @param dependencies - returns identifier(s) of items given item depends on * ( string, string[], or undefined/null for none ) * * Throws ResolveException on: duplicate keys, dependency on itself, * dependency that does not exist in items, circular dependency * ( message includes cycle path, eg. 'a' -\> 'b' -\> 'a' ) */ export declare function sortByDependencies(items: T[], key: (item: T) => string, dependencies: (item: T) => string | string[] | null | undefined): T[]; //# sourceMappingURL=helpers.d.ts.map