TemplateProcessor
object TemplateProcessor
Utility object for injecting dynamic values into templates.
For example, given the following template and input context
Template:
Hello, {{user.name}}. Context:
{
"user": {
"name": "Bill"
}
}Content copied to clipboard
The processed template would output
Hello, Bill.
In cases where the value may not be available in the context, a fallback string can be provided to be used instead. So given the following template and input context:
Template:
Hello, {{user.name || beloved user}}. Context:
{
"user": {
"age": 42
}
}Content copied to clipboard
The processed template would output
Hello, beloved user.