Prism · Arrays

$filter

Keeps the elements of an array for which when is truthy.

The source
{
  items: [
    { name: 'Apple', price: 1.5 },
    { name: 'Banana', price: 0.5 },
    { name: 'Carrot', price: 2 },
    { name: 'Date', price: 3 },
  ],
}
The config
{
  $filter: {
    over: { $ref: '$.items' },
    as: 'item',
    when: {
      $gte: [
        { $get: { from: { $var: 'item' }, path: ['price'] } },
        { $const: 1.5 },
      ],
    },
  },
}
What comes out
[
  { name: 'Apple', price: 1.5 },
  { name: 'Carrot', price: 2 },
  { name: 'Date', price: 3 },
]
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.