Returns true if some element of the list matches the condition. It stops the iterations after the first match.
Functions
CountBy
countBy(Array<T>, (T) → Boolean): Number
Counts the matching elements using a matchingFunction(T)
Transform
1
2
3
4
%dw 2.0
output application/json
---
[1, 2, 3] countBy (($ mod 2) == 0)
Output
1
1
Every
every(Array<T>, (T) → Boolean): Boolean
Returns true if every element of the list matches the condition. It stops the iterations after the first negative evaluation.
Private_every
private_every(Array<T>, (T) → Boolean): Boolean
Some
some(Array<T>, (T) → Boolean): Boolean
SumBy
sumBy(Array<T>, (T) → Number): Number
Adds the values returned by the right hand side function
Transform
1
2
3
4
5
%dw 2.0
output application/json
---
sumBy([ { a: 1 }, { a: 2 }, { a: 3 } ], (item) -> item.a)
// same as [ { a: 1 }, { a: 2 }, { a: 3 } ] sumBy $.a
Output
1
6