Const
Returns the single element from the source iterable that satisfies the optional predicate.
Curried version of _single.
Element type produced by the source iterable.
Predicate receiving each element and its index; the matching element must be unique.
The sole element accepted by pred, or the only element in the sequence when pred is omitted.
pred
Error Thrown when the sequence contains no matching elements or more than one match.
Error Rethrows any error thrown by pred.
const value = _single([1, 2, 3], (item) => item > 2);console.log(value); // 3 Copy
const value = _single([1, 2, 3], (item) => item > 2);console.log(value); // 3
or using the curried version:
const value = pipeInto( [1, 2, 3], single((item) => item > 2));console.log(value); // 3 Copy
const value = pipeInto( [1, 2, 3], single((item) => item > 2));console.log(value); // 3
Returns the single element from the source iterable that satisfies the optional predicate.
Curried version of _single.