Skip to content

AI-native design editor. Open-source Figma alternative.

306 B
Raw Blame
/** A catalog string with each `{name}` replaced by its value, as every locale writes them. */
export function fill(template: string, values: Record<string, string | number>): string {
  return template.replace(/\{(\w+)\}/g, (match, name: string) =>
    name in values ? String(values[name]) : match
  )
}