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