Skip to content

searchValueAll

Subhajit Sahu edited this page Dec 28, 2022 · 14 revisions

Find keys with given value.

Alternatives: searchValue, searchValueAll.
Similar: search, searchValue.


function searchValueAll(x, v, fc, fm)
// x:  ilists
// v:  search value
// fc: compare function (a, b)
// fm: map function (v, k, x)
const xilists = require('extra-ilists');

var x = [['a', 'b', 'c', 'd', 'e'], [1, -2, 3, 2, 5]];
[...xilists.searchValueAll(x, 2)];
// → [ 'd' ]                                ^

[...xilists.searchValueAll(x, 2, (a, b) => Math.abs(a) - Math.abs(b))];
// → [ 'b', 'd' ]      ^                    ^

[...xilists.searchValueAll(x, 2, null, v => Math.abs(v))];
// → [ 'b', 'd' ]      ^                    ^


References

Clone this wiki locally