mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-27 23:56:59 +00:00
6 lines
209 B
TypeScript
6 lines
209 B
TypeScript
export function applyTemplate(tpl: string, values: Record<string, unknown>) {
|
|
return tpl.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, key: string) =>
|
|
Object.hasOwn(values, key) ? String(values[key]) : '',
|
|
);
|
|
}
|