From 23ca6c5e10d3c213d3fcab51d2d4c2f73d526858 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 17 Mar 2015 15:28:59 -0700 Subject: [PATCH] Rename `createPad` to `createPadding` and cleanup docs of pad methods. --- lodash.src.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 34ef5a801..a30344a89 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -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 _