Prism · Arrays
$slice
A stretch of an array or of a string, from start up to but not including end. start defaults to 0 and end to the length.
{ letters: ['a', 'b', 'c', 'd', 'e'], word: 'transform' }{
middle: {
$slice: { from: { $ref: '$.letters' }, start: 1, end: 4 },
},
prefix: {
$slice: { from: { $ref: '$.word' }, start: 0, end: 5 },
},
}{ middle: ['b', 'c', 'd'], prefix: 'trans' }Runs in this page on the installed package. The input and the expected output are defined by the example.