- Index
- »
- axon
- »
- func:findAll
def
func:findAll
findAll(val, fn)
Find all the items in a list, dict, or grid by applying the given filter function. Also see find()
.
If working with a list, the filter should be a function that takes (val)
or (val, index)
. It should return true to keep the item.
If working with a dict, the filter should be a function that takes (val)
or (val, name)
. It should return the true to keep the name/value pair.
If working with a grid, the filter function takes (row)
or (row, index)
and returns true to keep the row. The resulting grid shares the original's grid meta and columns.
If working with a stream, the filter takes (val)
and returns true to match. See Streams.
Examples:
// find all the strings longer than 3 chars ["ape", "bat", "charlie", "dingo"].findAll(x => x.size > 3) // find even numbers [0, 1, 2, 3, 4].findAll(isEven) // find all the sites greater than 10,000ft from grid readAll(site).findAll(s => s->area > 10_000ft²)