Truncates string if it's longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to "...".
[string]
(string): string to truncate[options={}]
(Object): object containing options[options.length=30]
(number): Max length of truncated string[options.omission='...']
(string): string to indicate omitted text[options.separator]
(RegExp|string): the pattern to end truncation
(string): returns truncated string
const result = strings.truncate('This sentence starts with', 'This');
console.log(result);
> true
*