matchFirst<T>(pred: Predicate<T>, src: Iterable<T>): T | undefined
Transducer composition / syntax sugar for:
example
comp(filter(pred), take(1))
Yields none or only the first value which passed the predicate check and then causes early termination. If src input is given, returns first match found (or undefined). Also see {@link (matchLast:1)}.
Transducer composition / syntax sugar for:
comp(filter(pred), take(1))
Yields none or only the first value which passed the predicate check and then causes early termination. If
src
input is given, returns first match found (orundefined
). Also see {@link (matchLast:1)}.matchFirst((x) => x >= 5, [3, 1, 4, 2, 6, 5]) // 6 transduce( comp( matchFirst((x) => x >= 5), map((x) => x * 10) ), last(), [3, 1, 4, 2, 6, 5] ) // 60