all
Returns true if ALL elements satisfy the predicate. Returns true for empty arrays (vacuously true).
array(required): the array to testpredicate(required): lambda(element) -> boolean
bash
echo '{"items": [{"price": 10}, {"price": 25}, {"price": 5}]}' \
| utlx -e 'all($input.items, (item) -> item.price > 0)'
# trueutlx
{
allPositive: all($input.items, (item) -> item.price > 0),
allExpensive: all($input.items, (item) -> item.price > 20)
}
// Output: {"allPositive": true, "allExpensive": false}