findInMap

A find function that iterates through a map and runs a provided pred function on each value. Returning the found value or undefined

Arguments

Name

Type

Description

pred

Function

The pred function used for each value in the map

map

Map

The map we are to search through

Returns

Type

Description

Maybe Any

Whatever the value was that the function found, or undefined if nothing is found

Usage

findInMap(x => x > 2, Map { 'a' => 1 'b' => 2 'c' => 3 }) // => 3

Last updated