find index async
Updated on August 22, 2024Source codeTests
createFindIndexAsync is a pipe that asynchronously transforms an array to the index of the first one of its items to match a condition, or -1 if a matching item can't be found.
Create find index async
Call createFindIndexAsync with these parameters to create your findIndex function:
Parameter
Type
Required
Description
predicateFunction
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.