find async
Updated on August 22, 2024Source codeTests
createFindAsync
is a pipe that asynchronously transforms an array to the first one of its items to match a condition or undefined
if a matching item can't be found.
Create find
Call createFindAsync
with these parameters to create your find
function:
Parameter
Type
Required
Description
predicate
Function
yes
A function that returns a Promise
that resolves to a boolean indicating whether or not an item is the item you're trying to find.
predicate
receives an item (any data type) and the item's index (number) as parameters.