@yookue/ts-lang-utils
    Preparing search index...

    Function abbreviate

    • Returns a string that abbreviates the given text using placeholder

      Parameters

      • Optionaltext: null | string

        the text to inspect

      • width: number = -1

        the max width of the expected string

      • placeholder: string = '...'

        the placeholder to append

      Returns undefined | null | string

      a string that abbreviates the given text using placeholder

      David Hsing

      abbreviate('foobar', -1);    // 'foobar'
      abbreviate('foobar', 0); // ''
      abbreviate('foobar', 5); // 'fo...'
      abbreviate('foobar', 6); // 'foobar'
      abbreviate('foobar', 10); // 'foobar'