export type IndexOf = T extends Map ? T : T extends Array ? number : string; /** performs a truthy check on the value, and calls onTrue when the condition is true,and onFalse when it's not */ export declare function when(value: T, onTrue: (value: NonNullable) => void, onFalse?: () => void): void; export interface IterableWithLinq extends Iterable { linq: IterableWithLinq; any(predicate?: (each: T) => boolean): boolean; all(predicate: (each: T) => boolean): boolean; bifurcate(predicate: (each: T) => boolean): Array>; concat(more: Iterable): IterableWithLinq; distinct(selector?: (each: T) => any): IterableWithLinq; duplicates(selector?: (each: T) => any): IterableWithLinq; first(predicate?: (each: T) => boolean): T | undefined; selectNonNullable(selector: (each: T) => V): IterableWithLinq>; select(selector: (each: T) => V): IterableWithLinq; selectAsync(selector: (each: T) => V): AsyncGenerator; selectMany(selector: (each: T) => Iterable): IterableWithLinq; where(predicate: (each: T) => boolean): IterableWithLinq; forEach(action: (each: T) => void): void; aggregate(accumulator: (current: T | A, next: T) => A, seed?: T | A, resultAction?: (result?: T | A) => A | R): T | A | R | undefined; toArray(): Array; toObject(selector: (each: T) => [V, U]): Record; results(): Promise; toRecord(keySelector: (each: T) => string, selector: (each: T) => TValue): Record; toMap(keySelector: (each: T) => TKey, selector: (each: T) => TValue): Map; groupBy(keySelector: (each: T) => TKey, selector: (each: T) => TValue): Map>; /** * Gets or sets the length of the iterable. This is a number one higher than the highest element defined in an array. */ count(): number; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; } export declare function keys(source: Map | null | undefined): Iterable; export declare function keys>(source: Record | null | undefined): Iterable; export declare function keys>(source: Array | null | undefined): Iterable; export declare function keys(source: any | undefined | null): Iterable; /** returns an IterableWithLinq<> for keys in the collection */ declare function _keys(source: Map | null | undefined): IterableWithLinq; declare function _keys>(source: Record | null | undefined): IterableWithLinq; declare function _keys>(source: Array | null | undefined): IterableWithLinq; declare function _keys(source: any | undefined | null): IterableWithLinq; export declare function values | Record | Map)>(source: (Iterable | Array | Record | Map | Set) | null | undefined): Iterable; export declare const linq: { values: typeof _values; entries: typeof _entries; keys: typeof _keys; find: typeof _find; startsWith: typeof _startsWith; join: typeof _join; }; /** returns an IterableWithLinq<> for values in the collection * * @note - null/undefined/empty values are considered 'empty' */ declare function _values(source: (Array | Record | Map | Set | Iterable) | null | undefined): IterableWithLinq; export declare function entries | Record | Map | undefined | null)>(source: TSrc & (Array | Record | Map) | null | undefined): Iterable<[IndexOf, T]>; /** returns an IterableWithLinq<{key,value}> for the source */ declare function _entries | Record | Map | undefined | null)>(source: TSrc & (Array | Record | Map) | null | undefined): IterableWithLinq<[IndexOf, T]>; /** returns the first value where the key equals the match value (case-insensitive) */ declare function _find | Record | Map | undefined | null)>(source: TSrc & (Array | Record | Map) | null | undefined, match: string): T | undefined; /** returns the first value where the key starts with the match value (case-insensitive) */ declare function _startsWith | Record | Map | undefined | null)>(source: TSrc & (Array | Record | Map) | null | undefined, match: string): T | undefined; declare function _join(source: (Array | Record | Map | Set | Iterable) | null | undefined, delimiter: string): string; export declare function length(source?: string | Iterable | Record | Array | Map | Set): number; /** A Map of Key: Array */ export declare class ManyMap extends Map> { /** * Push the value into the array at key * @param key the unique key in the map * @param value the value to push to the collection at 'key' */ push(key: K, value: V): void; } export declare function countWhere(from: Iterable, predicate: (each: T) => Promise): Promise; export declare function countWhere(from: Iterable, predicate: (each: T) => boolean): number; export {}; //# sourceMappingURL=linq.d.ts.map