Prism · Strings

$fill

Fills a counted phrase with its own slots: a value of the form { phrase, slots } becomes the phrase with each {slot} replaced. A value of any other form passes through unchanged.

The source
{
  progress: { phrase: '{n} of {total}', slots: { n: 1, total: 12 } },
  plain: 'done',
}
The config
{
  filled: { $fill: { $ref: '$.progress' } },
  untouched: { $fill: { $ref: '$.plain' } },
}
What comes out
{ filled: '1 of 12', untouched: 'done' }
Output matches the expected value

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