Prism · Arrays
$filter
Keeps the elements of an array for which when is truthy.
{
items: [
{ name: 'Apple', price: 1.5 },
{ name: 'Banana', price: 0.5 },
{ name: 'Carrot', price: 2 },
{ name: 'Date', price: 3 },
],
}{
$filter: {
over: { $ref: '$.items' },
as: 'item',
when: {
$gte: [
{ $get: { from: { $var: 'item' }, path: ['price'] } },
{ $const: 1.5 },
],
},
},
}[
{ name: 'Apple', price: 1.5 },
{ name: 'Carrot', price: 2 },
{ name: 'Date', price: 3 },
]Runs in this page on the installed package. The input and the expected output are defined by the example.