* Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding.
(length, chars)
| 15903 | * @returns {string} Returns the padding for `string`. |
| 15904 | */ |
| 15905 | function createPadding(length, chars) { |
| 15906 | chars = chars === undefined ? ' ' : baseToString(chars); |
| 15907 | |
| 15908 | var charsLength = chars.length; |
| 15909 | if (charsLength < 2) { |
| 15910 | return charsLength ? baseRepeat(chars, length) : chars; |
| 15911 | } |
| 15912 | var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); |
| 15913 | return hasUnicode(chars) |
| 15914 | ? castSlice(stringToArray(result), 0, length).join('') |
| 15915 | : result.slice(0, length); |
| 15916 | } |
| 15917 | |
| 15918 | /** |
| 15919 | * Creates a function that wraps `func` to invoke it with the `this` binding |
no test coverage detected