-
Notifications
You must be signed in to change notification settings - Fork 1
searchAll
Subhajit Sahu edited this page Jun 12, 2020
·
18 revisions
Finds keys of entries passing a test. 🏃 📼 📦 🌔 📒
Alternatives: search, searchAll.
Similar: search, searchValue.
object.searchAll(x, fn, [ths]);
// x: an object
// fn: test function (v, k, x)
// ths: this argument
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' ]