This returns the key 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.findKey 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.findKey(samples/help/bunnies.tsv, (entry) => entry.fur === 'Short')"
1
because 1 is the index of the first matching entry.
To get the value of the first matching entry, see the related Tree.find.