• This function mirrors the padEnd 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 end 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 targetLength, it will be truncated. Default is " "

    Returns string

    String with appropriate padding at the end