Files
documenso/packages/lib/utils/render-custom-email-template.ts
2023-09-22 12:42:06 +00:00

13 lines
271 B
TypeScript

export const renderCustomEmailTemplate = <T extends Record<string, string>>(
template: string,
variables: T,
): string => {
return template.replace(/\{(\S+)\}/g, (_, key) => {
if (key in variables) {
return variables[key];
}
return key;
});
};