Skip to main content

Home > @jsplumb/util > findWithFunction

findWithFunction() function#

Search each entry in the given array for an entry for which the function f returns true. This is a stand-in replacement for the findIndex method which is available on Array in modern browsers, but not IE11.

Signature:

export declare function findWithFunction<T>(a: ArrayLike<T>, f: (_a: T) => boolean): number;

Parameters#

ParameterTypeDescription
aArrayLike<T>Array to search
f(_a: T) => booleanPredicate to use to test each entry

Returns:

number

The index of the entry for which the predicate returned true, -1 if not found.