Skip to content
Subhajit Sahu edited this page Jun 13, 2020 · 17 revisions

Finds value of an entry passing a test. 🏃 📼 📦 🌔 📒

Alternatives: find, findAll.
Similar: find, search, searchValue.

map.find(x, fn, [ths]);
// x:   a map
// fn:  test function (v, k, x)
// ths: this argument
const map = require('extra-map');

var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4]]);
map.find(x, v => v % 2 === 0);
// 2                             ^

map.find(x, v => v % 8 === 0);
// undefined

references

Clone this wiki locally