Search code examples
handlebars.jssendgrid

Handlebar helper for truncating or replacing characters in a string


I have a Sendgrid template with a dynamically substituted value (which is a string e.g. {{myValue}}.

There is a formatDate helper (for date values), but are there any helper classes that would allow me to ensure that the string is output to a maximum number of characters, or to do any string/regex manipulation? I assume I am limited to Sendgrid's built-in helpers?


Solution

  • You are limited to SendGrid's helpers. However, since you send the data to SendGrid, I would recommend that you truncate the data before you send it.