@alanscodelog/utils
    Preparing search index...

    Function snippet

    • Given some text, a max number of lines, characters, or both, removes duplicate newlines, normalizes them to \n, trims start/end, then trims the text according to the limits, adding trailing ellipses to the end (as necessary).

      Parameters

      • text: string
      • __namedParameters: { chars?: number; ellipses?: boolean; lines?: number } = {}
        • Optionalchars?: number

          Max number of chars (ellipses included) (default 300), unless the character limit is so low that the first word doesn't fit, in which case the character limit is ignored. The first word will be returned instead.

        • Optionalellipses?: boolean

          Whether trailing ellipses are added (default true) if we have to cut at a word that is not the end of a sentence. They are not added if we cut at a line, regardless of how that line ended.

        • Optionallines?: number

          Max number of lines (default 5).

      Returns string