This returns the value of the first entry in the map-like object for which the test function returns true. This is analogous to the standard JavaScript Array.prototype.find function but extended to cover objects and other types of maps.
The test function will be called with the value, key, and map of each key/value in the map. The test function should return a truthy result if the entry passes the test.
Example: if bunnies.tsv contains
breed fur color origin
American Fuzzy Lop Long Various United States
Belgian Hare Short Black, Chestnut Belgium
Meissner Lop Short Various Germany
Thrianta Short Chestnut Netherlands
then:
$ ori "Tree.find(samples/help/bunnies.tsv, (entry) => entry.fur === 'Short')"
breed: Belgian Hare
fur: Short
color: Black, Chestnut
origin: Belgium
To get the index of the first matching entry, see the related Tree.findKey. To extract all matching values, see Tree.filter and Tree.mask.