Truncate a string to a specified maximum length and add an ellipsis if it exceeds that length.
The string to be truncated.
The maximum length of the truncated string, defaults to 10.
The truncated string with an ellipsis if it was longer than maxLength.
Truncate a string to a specified maximum length and add an ellipsis if it exceeds that length.