Skip to main content
Version: Next

where

Removes list elements based on a predicate.

where(xs:list, capture:field, predicate:bool) -> list

Description

The where function removes all elements of a list for which a predicate evaluates to false.

xs: list

A list of values.

capture: field

The name of each list element in each predicate.

predicate: bool

The predicate evaluated for each list element.

Examples

Remove all list elements smaller than 3

from {
  xs: [1, 2, 3, 4, 5]
}
xs = xs.where(x, x >= 3)
{xs: [3, 4, 5]}

See Also

map