• This function mirrors the padStart function from the JavaScript Standard String object. It handles Unicode code points instead of UTF-16 character codes.

    Pads this string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of this string.

    Parameters

    • string: string

      String to add padding too

    • targetLength: number

      The length of the resulting string once the starting string has been padded. If value is less than or equal to length(string), then string is returned as is.

    • padString: string = ' '

      The string to pad the current string with. If padString is too long to stay within the targetLength, it will be truncated from the end. Default is " "

    Returns string

    String with of specified targetLength with padString applied from the start