renderPathTemplate()function
renderPathTemplate(template: AbsolutePath, values: TemplateValues, caller: AnyCaller = renderPathTemplate): AbsolutePath
| Param | Type | |
|---|---|---|
template | AbsolutePath | The path-shaped template including placeholders, e.g. /users/{name}. required |
values | TemplateValues | An object containing values (functions are called, everything else converted to string), or a function or string to use for all placeholders. required |
caller | AnyCaller | 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"