Function someSync

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

    Returns

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

    Example

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

    console.log(hasEvenNumber); // Logs true

    Remarks

    Available as some when imported from peter-piper/sync.

    Type Parameters

    • T

      The type of elements in the input sync iterable.

    Parameters

    • predicate: ArrayLikePredicate<T>

      A predicate function to test the elements in the input sync iterable.

    Returns ((input: Iterable<T>) => boolean)

      • (input: Iterable<T>): boolean
      • Parameters

        • input: Iterable<T>

        Returns boolean

Generated using TypeDoc