Skip to content

searchValueAll

Subhajit Sahu edited this page Dec 8, 2022 · 12 revisions

Find keys with a given value.

Similar: searchValue, searchValueAll.
Similar: find, search, searchValue.


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

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

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

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


References

Clone this wiki locally