* 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. * @returns {string}
(length, chars)
| 13014 | * @returns {string} Returns the padding for `string`. |
| 13015 | */ |
| 13016 | function createPadding(length, chars) { |
| 13017 | chars = chars === undefined ? ' ' : baseToString(chars); |
| 13018 | |
| 13019 | var charsLength = chars.length; |
| 13020 | if (charsLength < 2) { |
| 13021 | return charsLength ? baseRepeat(chars, length) : chars; |
| 13022 | } |
| 13023 | var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); |
| 13024 | return hasUnicode(chars) |
| 13025 | ? castSlice(stringToArray(result), 0, length).join('') |
| 13026 | : result.slice(0, length); |
| 13027 | } |
| 13028 | |
| 13029 | /** |
| 13030 | * Creates a function that wraps `func` to invoke it with the `this` binding |
no test coverage detected