Optional
chars?: numberMax number of chars (ellipses included) (default 300), unless the character limit is so low that the first word doesn't fit, in which case the character limit is ignored. The first word will be returned instead.
Optional
ellipses?: booleanWhether trailing ellipses are added (default true) if we have to cut at a word that is not the end of a sentence. They are not added if we cut at a line, regardless of how that line ended.
Optional
lines?: numberMax number of lines (default 5).
Given some text, a max number of lines, characters, or both, removes duplicate newlines, normalizes them to
\n
, trims start/end, then trims the text according to the limits, adding trailing ellipses to the end (as necessary).