UNPKG

sequency

Version:

Functional sequences for processing iterable data in JavaScript

18 lines (17 loc) 657 B
import Sequence from "./Sequence"; export declare class FirstOrNull { /** * Returns the first element of the sequence or the first element matching `predicate` if present, otherwise returns `null`. * * @param {(T) => boolean} predicate * @returns {T} */ firstOrNull<T>(this: Sequence<T>, predicate?: (item: T) => boolean): T | null; /** * Returns the first element of the sequence or the first element matching `predicate` if present, otherwise returns `null`. * * @param {(T) => boolean} predicate * @returns {T} */ find<T>(this: Sequence<T>, predicate?: (item: T) => boolean): T | null; }