Prism · Core
$get
Walks into a value along a list of path segments: keys, indexes, or expressions that evaluate to one. With fallback a missing path gives the fallback; without it the config refuses with E_MISSING_PATH.
{
catalog: {
A1: { title: 'Apple', stock: 12 },
B1: { title: 'Banana', stock: 0 },
},
selected: 'B1',
}{
title: {
$get: {
from: { $ref: '$.catalog' },
path: [{ $ref: '$.selected' }, 'title'],
},
},
shelf: {
$get: {
from: { $ref: '$.catalog' },
path: [{ $ref: '$.selected' }, 'shelf'],
fallback: { $const: 'unknown' },
},
},
}{ title: 'Banana', shelf: 'unknown' }Runs in this page on the installed package. The input and the expected output are defined by the example.