Revert createPadding behavior for chars that coerce to empty strings.

This commit is contained in:
John-David Dalton
2016-03-29 17:08:46 -07:00
parent 4c789197f9
commit 643ce1da74
2 changed files with 65 additions and 46 deletions

View File

@@ -4628,11 +4628,10 @@
*/
function createPadding(length, chars) {
chars = chars === undefined ? ' ' : (chars + '');
chars = chars == '' ? ' ' : chars;
var charsLength = chars.length;
if (charsLength == 1) {
return baseRepeat(chars, length);
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return reHasComplexSymbol.test(chars)