@tempots/std
ellipsis() function
ellipsis
truncates s
at len maxlen
replaces the last characters with the content of symbol
.
Signature:
ellipsis: (s: string, maxlen?: number, symbol?: string) => string
Parameters
Parameter |
Type |
Description |
---|---|---|
s |
string |
The string to truncate. |
maxlen |
number |
(Optional) The maximum length of the string. |
symbol |
string |
(Optional) The symbol to replace the truncated characters with. |
Returns: string
The truncated string.
Example
ellipsis('tempo is a nice library', 9) // returns 'tempo is …'