If the string is longer than the given maximum length, chop off characters from the end.
By default, this machine will reduce the string to a maximum of 30 characters, including a 3-character ellipses ("...") added to the end. An additional default behavior of this machine (which can be disabled by disabling the `pretty` option) is to omit trailing spaces and punctuation, and also avoid chopping words in half.
var Strings = require('machinepack-strings');
// If the string is longer than the given maximum length, chop off characters from the end.
string: 'Christian van der Henst',
The string to truncate.
'Christian van der Henst'
The maximum number of characters (including the "...")
The substring to append to our string indicating characters were omitted.
Whether or not to attempt to make the truncated string look more natural.
An unexpected error occurred.