Rename createPad to createPadding and cleanup docs of pad methods.

This commit is contained in:
jdalton
2015-03-17 15:28:59 -07:00
parent 1aea5bcd50
commit 23ca6c5e10

View File

@@ -3456,7 +3456,7 @@
function createPadDir(fromRight) { function createPadDir(fromRight) {
return function(string, length, chars) { return function(string, length, chars) {
string = baseToString(string); string = baseToString(string);
return string && ((fromRight ? string : '') + createPad(string, length, chars) + (fromRight ? '' : string)); return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string));
}; };
} }
@@ -3583,9 +3583,8 @@
} }
/** /**
* Creates the pad required for `string` based on the given padding length. * Creates the padding required for `string` based on the given `length`.
* The `chars` string may be truncated if the number of padding characters * The `chars` string is truncated if the number of characters exceeds `length`.
* exceeds the padding length.
* *
* @private * @private
* @param {string} string The string to create padding for. * @param {string} string The string to create padding for.
@@ -3593,7 +3592,7 @@
* @param {string} [chars=' '] The string used as padding. * @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the pad for `string`. * @returns {string} Returns the pad for `string`.
*/ */
function createPad(string, length, chars) { function createPadding(string, length, chars) {
var strLength = string.length; var strLength = string.length;
length = +length; length = +length;
@@ -10127,9 +10126,8 @@
}); });
/** /**
* Pads `string` on the left and right sides if it is shorter then the given * Pads `string` on the left and right sides if it is shorter than `length`.
* padding length. The `chars` string may be truncated if the number of padding * Padding characters are truncated if they can't be evenly divided by `length`.
* characters can't be evenly divided by the padding length.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -10161,14 +10159,13 @@
leftLength = floor(mid), leftLength = floor(mid),
rightLength = ceil(mid); rightLength = ceil(mid);
chars = createPad('', rightLength, chars); chars = createPadding('', rightLength, chars);
return chars.slice(0, leftLength) + string + chars; return chars.slice(0, leftLength) + string + chars;
} }
/** /**
* Pads `string` on the left side if it is shorter then the given padding * Pads `string` on the left side if it is shorter than `length`. Padding
* length. The `chars` string may be truncated if the number of padding * characters are truncated if they exceed `length`.
* characters exceeds the padding length.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -10191,9 +10188,8 @@
var padLeft = createPadDir(); var padLeft = createPadDir();
/** /**
* Pads `string` on the right side if it is shorter then the given padding * Pads `string` on the right side if it is shorter than `length`. Padding
* length. The `chars` string may be truncated if the number of padding * characters are truncated if they exceed `length`.
* characters exceeds the padding length.
* *
* @static * @static
* @memberOf _ * @memberOf _