Prism · Arrays

$map

Transforms each element of an array. The element is bound to the variable named by as, and body is evaluated once for each.

The source
{ numbers: [1, 2, 3, 4, 5] }
The config
{
  $map: {
    over: { $ref: '$.numbers' },
    as: 'n',
    body: { $mul: [{ $var: 'n' }, { $const: 2 }] },
  },
}
What comes out
[2, 4, 6, 8, 10]
Output matches the expected value

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