/*! * @author electricessence / https://github.com/electricessence/ * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md */ import { ActionWithIndex, PredicateWithIndex, SelectorWithIndex } from "../../FunctionTypes"; import { IEnumerator } from "./IEnumerator"; import { IEnumerable } from "./IEnumerable"; import { IEnumerableOrArray } from "../IEnumerableOrArray"; import { InfiniteValueFactory } from "./InfiniteEnumerator"; import { IIterator } from "./IIterator"; import { ForEachEnumerable } from "./ForEachEnumerable"; export declare function throwIfEndless(isEndless: false): true; export declare function throwIfEndless(isEndless: true): never; export declare function throwIfEndless(isEndless: boolean | undefined): true | never; /** * Returns the enumerator for the specified collection, enumerator, or iterator. * If the source is identified as IEnumerator it will return the source as is. * @param source * @returns {any} */ export declare function from(source: ForEachEnumerable | InfiniteValueFactory): IEnumerator; export declare function isEnumerable(instance: any): instance is IEnumerable; export declare function isEnumerableOrArrayLike(instance: any): instance is IEnumerableOrArray; export declare function isEnumerator(instance: any): instance is IEnumerator; export declare function isIterator(instance: any): instance is IIterator; /** * Flexible method for iterating any enumerable, enumerable, iterator, array, or array-like object. * @param e The enumeration to loop on. * @param action The action to take on each. * @param max Stops after max is reached. Allows for forEach to be called on infinite enumerations. * @returns the total times iterated. If the enumerable is unrecognized then -1. */ export declare function forEach(e: ForEachEnumerable, action: ActionWithIndex, max?: number): number; export declare function forEach(e: ForEachEnumerable, action: PredicateWithIndex, max?: number): number; /** * Converts any enumerable to an array. * @param source * @param max Stops after max is reached. Allows for forEach to be called on infinite enumerations. * @returns {any} */ export declare function toArray(source: ForEachEnumerable, max?: number): T[]; /** * Converts any enumerable to an array of selected values. * @param source * @param selector * @param max Stops after max is reached. Allows for forEach to be called on infinite enumerations. * @returns {TResult[]} */ export declare function map(source: ForEachEnumerable, selector: SelectorWithIndex, max?: number): TResult[];