Function getTruncatedContent

Get truncated text ending with ellipsis if the text is longer than the specified length

getTruncatedContent('This is a long string', 10) // 'This is a...'
  • Parameters

    • content: undefined | null | string

      The string to truncate

    • length: number = 250

      The length of the final string

    Returns null | string

    An excerpt of the truncated text with ellipsis