String Template
caution
This section refers to a feature that will only be available in the v0.2.0 of Meta-System
Module Info:
moduleType: "internal",
moduleName: "stringTemplate"
Description
The stringTemplate
function receives a string template and a replacers
object with the expected values for the corresponding strings inside the template
Inputs
Name | Type | Required |
---|---|---|
template | string | ✔ |
replacers | object | ✔ |
Outputs
Name | Type |
---|---|
result | string |
If a replacer is not given, string will be replaced with ""
will only be deefined if the given string cannot be converted to a number.
If a replacer that is not in the template is given it will be ignored.
Examples
Inputs | Outputs | |
---|---|---|
template | replacers | result |
"${name} is currently ${age}" | { name: "Anna", age: "30" } | "Anna is currently 30" |
"${name} is currently ${age}" | { age: "30" } | " is currently 30" |
"${name} is currently ${age}" | { name: "Anna", age: "30", height: "1.60m" } | "Anna is currently 30" |
"There is no template" | { name: "Anna", age: "30" } | "There is no template" |