|
1 | 1 | interface String { |
2 | 2 | /** |
3 | | - * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. |
4 | | - * The padding is applied from the start (left) of the current string. |
| 3 | + * Pads the current string with a given string (repeated and/or truncated, if needed) so that the resulting string has a given length. |
| 4 | + * The padding is applied from the start of the current string. |
5 | 5 | * |
6 | | - * @param maxLength The length of the resulting string once the current string has been padded. |
7 | | - * If this parameter is smaller than the current string's length, the current string will be returned as it is. |
| 6 | + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) |
8 | 7 | * |
9 | | - * @param fillString The string to pad the current string with. |
10 | | - * If this string is too long, it will be truncated and the left-most part will be applied. |
11 | | - * The default value for this parameter is " " (U+0020). |
| 8 | + * @param targetLength The length of the resulting string once the current `str` has been padded. |
| 9 | + * If the value is less than or equal to `str.length`, then `str` is returned as-is. |
| 10 | + * |
| 11 | + * @param padString The string to pad the current `str` with. |
| 12 | + * If `padString` is too long to stay within `targetLength`, it will be truncated from the end. |
| 13 | + * The default value is the space character (U+0020). |
12 | 14 | */ |
13 | | - padStart(maxLength: number, fillString?: string): string; |
| 15 | + padStart(targetLength: number, padString?: string): string; |
14 | 16 |
|
15 | 17 | /** |
16 | | - * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. |
17 | | - * The padding is applied from the end (right) of the current string. |
| 18 | + * Pads the current string with a given string (repeated and/or truncated, if needed) so that the resulting string has a given length. |
| 19 | + * The padding is applied from the end of the current string. |
| 20 | + * |
| 21 | + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) |
18 | 22 | * |
19 | | - * @param maxLength The length of the resulting string once the current string has been padded. |
20 | | - * If this parameter is smaller than the current string's length, the current string will be returned as it is. |
| 23 | + * @param targetLength The length of the resulting string once the current `str` has been padded. |
| 24 | + * If the value is less than or equal to `str.length`, then `str` is returned as-is. |
21 | 25 | * |
22 | | - * @param fillString The string to pad the current string with. |
23 | | - * If this string is too long, it will be truncated and the left-most part will be applied. |
24 | | - * The default value for this parameter is " " (U+0020). |
| 26 | + * @param padString The string to pad the current `str` with. |
| 27 | + * If `padString` is too long to stay within `targetLength`, it will be truncated from the end. |
| 28 | + * The default value is the space character (U+0020). |
25 | 29 | */ |
26 | | - padEnd(maxLength: number, fillString?: string): string; |
| 30 | + padEnd(targetLength: number, padString?: string): string; |
27 | 31 | } |
0 commit comments