# Function truncateString

- truncateString(str, maxLength?): string | String

- Truncate a string to a specified maximum length and add an ellipsis if it exceeds that length.

  #### Parameters

  - str: String

    The string to be truncated.

  - maxLength: number = 10

    The maximum length of the truncated string, defaults to 10.

  #### Returns string | String

  The truncated string with an ellipsis if it was longer than maxLength.

  - Defined in src/utils.ts:478