- All Implemented Interfaces:
- Function
public class FilterFunction
extends FunctionBase
implements Function
From http://docs.jsonata.org/higher-order-functions#filter
Signature: $filter(array, function)
Returns an array containing only the values in the array parameter that
satisfy the function predicate (i.e. function returns Boolean true when
passed the value).
The function that is supplied as the second parameter must have the following
signature:
function(value [, index [, array]])
Each value in the input array is passed in as the first parameter in the
supplied function. The index (position) of that value in the input array is
passed in as the second parameter, if specified. The whole input array is
passed in as the third parameter, if specified.
Example The following expression returns all the products whose price is
higher than average:
$filter(Account.Order.Product, function($v, $i, $a) { $v.Price >
$average($a.Price) })