feat: generator updates

This commit is contained in:
2023-11-07 17:14:58 +01:00
parent 9ef77ab3ed
commit 8a421cb2fb
51 changed files with 1385 additions and 1241 deletions

View File

@@ -0,0 +1,15 @@
/**
* Render a template
* @template T
* @param template {T} The template to render (must be stringify-able)
* @param substitutions {[string, string][]} the substitutions
* @returns {T}
*/
export function renderTemplate(template, substitutions) {
return JSON.parse(
substitutions.reduce(
(template, [search, replace]) => template.replaceAll(search, replace),
JSON.stringify(template),
),
);
}