truncate
truncate(
text,maxLength,suffix):string
Defined in: utils/format.ts:38
Truncate text to a maximum length, adding suffix if truncated.
Parameters
Section titled “Parameters”string
Text to truncate
maxLength
Section titled “maxLength”number
Maximum length including suffix
suffix
Section titled “suffix”string = "..."
Suffix to append when truncated (default: ”…”)
Returns
Section titled “Returns”string
Truncated text
Example
Section titled “Example”truncate("Hello, World!", 10); // "Hello, ..."truncate("Short", 10); // "Short"truncate("Custom", 6, "…"); // "Custo…"