Returns the first matching value. If the value is not found return def, and if def is not defined throw NotFound.
def
NotFound
The iterable to find against.
A value or a matcher function.
Optional
The default value to return if no value has been found.
// Returns 2it.filter([1, 2, 3], x => x == 2) Copy
// Returns 2it.filter([1, 2, 3], x => x == 2)
// Returns 2it.filter([1, 2, 3], 2) Copy
// Returns 2it.filter([1, 2, 3], 2)
// Returns 10it.filter([1, 2, 3], -1, 10) Copy
// Returns 10it.filter([1, 2, 3], -1, 10)
// Throws NotFoundit.filter([1, 2, 3], -1) Copy
// Throws NotFoundit.filter([1, 2, 3], -1)
NotFound - No value has been found and def is not defined.
Returns the first matching value. If the value is not found return
def
, and ifdef
is not defined throwNotFound
.