Skip to content

findAll

Subhajit Sahu edited this page Jun 12, 2020 · 15 revisions

Finds values of entries passing a test. 🏃 📼 📦 🌔 📒

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

object.findAll(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: 4};
object.findAll(x, v => v % 2 === 0);
// [ 2, 4 ]       ^           ^

object.findAll(x, v => v % 8 === 0);
// []

references

Clone this wiki locally