Skip to main content

Home > @jsplumb/util > getWithFunction

getWithFunction() function#

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

Signature:

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

Parameters#

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

Returns:

T

The entry for which the predicate returned true, null if not found.