dashpresshq/dashpress

View on GitHub
src/shared/lib/strings/templates.ts

Summary

Maintainability
A
0 mins
Test Coverage
B
83%
import Mustache from "mustache";

export function compileTemplateString(
  input: string,
  data: Record<string, unknown>
) {
  try {
    return Mustache.render(input, data);
  } catch (error) {
    return (error as Error).message;
  }
}