@polargold/pg-frontend-core
    Preparing search index...

    Function truncateString

    • Truncates a string to maxLength characters, appending "...". Trims trailing whitespace left by the cut before appending the ellipsis.

      Unifies two near-identical duplicates found in the audit: luv-autoq-frontend's truncateWordByLetterCount (default limit of 50, no whitespace trim - despite the name, it cuts by character count, not word boundaries) and dspace-relaunch's getShortenedString (required desiredLength param, trims trailing whitespace). Named generically here since neither original name ("truncate word") accurately described the character-count behavior both actually have.

      Parameters

      • value: string
      • maxLength: number = 50

      Returns string