Skip to content

searchAll

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

Find all keys of entries passing a test.

Similar: search, searchAll.
Similar: find, search, searchValue.


function searchAll(x, ft)
// x:  an object
// ft: test function (v, k, x)
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3, d: -2};
object.searchAll(x, v => v === 2);
// → [ 'b' ]     ^

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


References

Clone this wiki locally