Ensure _.padLeft and _.padRight handle empty strings correctly.

This commit is contained in:
jdalton
2015-04-30 09:06:48 -07:00
parent 6cab7ceb0f
commit 2ce9e09e8b
2 changed files with 7 additions and 5 deletions

View File

@@ -3638,7 +3638,7 @@
function createPadDir(fromRight) {
return function(string, length, chars) {
string = baseToString(string);
return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string));
return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
};
}