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.
{ numbers: [1, 2, 3, 4, 5] }{
$map: {
over: { $ref: '$.numbers' },
as: 'n',
body: { $mul: [{ $var: 'n' }, { $const: 2 }] },
},
}[2, 4, 6, 8, 10]
Runs in this page on the installed package. The input and the expected output are defined by the example.