truncate
truncate(
text
,maxLength
):string
Truncates the given text to at most maxLength
characters,
adding ”…” if the text was longer.
Parameters
Section titled “Parameters”string
the string to truncate
maxLength
Section titled “maxLength”number
the maximum allowed length (including the ellipsis)
Returns
Section titled “Returns”string
the original text if it’s within the limit, otherwise a truncated version ending with ”…”