geninq
Version:
A JavaScript version of the Linq library for Generators
20 lines (19 loc) • 1.11 kB
TypeScript
import { Promised } from "./utils";
declare global {
interface Generator<T = unknown, TReturn = any, TNext = unknown> {
/**
* Determines whether any element of a sequence exists or satisfies a condition.
* @param predicate A function to test each element for a condition. Accepts all items if left undefined.
* @returns true if the source sequence is not empty and at least one of its elements passes the test in the specified predicate; otherwise, false.
*/
any(predicate?: (item: T) => boolean): boolean;
}
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> {
/**
* Determines whether any element of a sequence exists or satisfies a condition.
* @param predicate A function to test each element for a condition. Accepts all items if left undefined.
* @returns true if the source sequence is not empty and at least one of its elements passes the test in the specified predicate; otherwise, false.
*/
any(predicate?: (item: T) => Promised<boolean>): Promise<boolean>;
}
}