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

    Function center

    • Returns a string that centers 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 pad

      Returns undefined | null | string

      a string that centers the given text using placeholder

      David Hsing

      center('foobar', -1);    // 'foobar'
      center('foobar', 0); // ''
      center('foobar', 3); // 'foobar'
      center('foobar', 7); // 'foobar '
      center('foobar', 10); // ' foobar '