Const
Returns the first element in the source iterable that satisfies the predicate or undefined if none do.
undefined
Curried version of _firstOrDefault.
Element type produced by the source iterable.
Predicate receiving the current value and index; defaults to a function that accepts every value.
The first matching element, or undefined when the predicate never returns true.
const value = _firstOrDefault([10, 20, 30]);console.log(value); // 10 Copy
const value = _firstOrDefault([10, 20, 30]);console.log(value); // 10
or using the curried version:
const value = pipeInto( [1, 2, 3], firstOrDefault((n, i) => n > 5 || i > 5));console.log(value); // undefined Copy
const value = pipeInto( [1, 2, 3], firstOrDefault((n, i) => n > 5 || i > 5));console.log(value); // undefined
Returns the first element in the source iterable that satisfies the predicate or
undefinedif none do.Curried version of _firstOrDefault.