* 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)
| 12925 | * @returns {string} Returns the padding for `string`. |
| 12926 | */ |
| 12927 | function createPadding(length, chars) { |
| 12928 | chars = chars === undefined ? ' ' : baseToString(chars); |
| 12929 | |
| 12930 | var charsLength = chars.length; |
| 12931 | if (charsLength < 2) { |
| 12932 | return charsLength ? baseRepeat(chars, length) : chars; |
| 12933 | } |
| 12934 | var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); |
| 12935 | return hasUnicode(chars) |
| 12936 | ? castSlice(stringToArray(result), 0, length).join('') |
| 12937 | : result.slice(0, length); |
| 12938 | } |
| 12939 | |
| 12940 | /** |
| 12941 | * Creates a function that wraps `func` to invoke it with the `this` binding |
no test coverage detected