renderPathTemplate()function

renderPathTemplate(template: AbsolutePath, values: TemplateValues, caller: AnyCaller = renderPathTemplate): AbsolutePath
ParamType
templateAbsolutePath
The path-shaped template including placeholders, e.g. /users/{name}. required
valuesTemplateValues
An object containing values (functions are called, everything else converted to string), or a function or string to use for all placeholders. required
callerAnyCaller
Function to attribute a thrown error to (defaults to renderPathTemplate itself). Defaults to renderPathTemplate
Return
AbsolutePath
The rendered path, e.g. /users/Dave.
Throws
RequiredError
If a placeholder in the template string is not specified in values.

Render a path-shaped template. Behaviourally identical to renderTemplate() — substitution doesn't need separator awareness — but provided as a sibling to matchPathTemplate() so callers can pair them.

Examples

renderPathTemplate("/users/{name}", { name: "Dave" }) // "/users/Dave"