Function find

  • Finds the first value that passes a truthy value to predicate, then returns it. Only consumes the iterator's values up to the found value, then stops. So if it's not found, then the iterator is exhausted.

    Type Parameters

    • T
    • V

    Parameters

    Returns undefined | V

  • Finds the first value that passes a truthy value to predicate, then returns it. Only consumes the iterator's values up to the found value, then stops. So if it's not found, then the iterator is exhausted.

    Type Parameters

    • T
    • V

    Parameters

    • predicate: (value: T) => value is V

    Returns (arg: IteratorOrIterable<T>) => undefined | V

  • Finds the first value that passes a truthy value to predicate, then returns it. Only consumes the iterator's values up to the found value, then stops. So if it's not found, then the iterator is exhausted.

    Type Parameters

    • T

    Parameters

    Returns undefined | T

  • Finds the first value that passes a truthy value to predicate, then returns it. Only consumes the iterator's values up to the found value, then stops. So if it's not found, then the iterator is exhausted.

    Type Parameters

    • T

    Parameters

    Returns (arg: IteratorOrIterable<T>) => undefined | T