Function some

  • Tests if some element in the input iterable satisfies the given predicate. Returns a Promise resolving to true if at least one element in the input iterable passes the predicate check.

    Returns

    A function that accepts an input iterable and returns a Promise resolving to true if at least one element passes the predicate check, otherwise false.

    Example

    const input = asyncIterableOf([1, 2, 3, 4, 5]);
    const isEven = (value: number) => value % 2 === 0;
    const hasEvenNumber = some(isEven)(input);

    (async () => {
    console.log(await hasEvenNumber); // Logs true
    })();

    Type Parameters

    • T

      The type of elements in the input iterable.

    Parameters

    Returns ((input: AnyIterable<T>) => Promise<boolean>)

Generated using TypeDoc