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

    Function leftPad

    • Returns the left padded string with the given size and string, or original string if no padding is necessary

      Parameters

      • Optionaltext: null | string

        the source string to inspect

      • Optionalsize: number

        the size to pad to

      • Optionalpad: null | string

        the target string to fill, default is space

      Returns undefined | null | string

      the left padded string with the given size and string, or original string if no padding is necessary

      David Hsing

      leftPad(undefined, -1, null);    // undefined
      leftPad('', 3, 'z'); // 'zzz'
      leftPad('foo', 3, 'z'); // 'foo'
      leftPad('foo', 8, 'yz') = 'yzyzyfoo'