Function abbreviate

Given a long string, abbreviates it with ...

abbreviate(`This is something`, 7); // `This is...`

If source is under maxLength the original is returned.

  • Parameters

    • source: string
    • maxLength: number = 15

      Maximum length. Defaults to 20

    Returns string