Bump to v4.7.0.

This commit is contained in:
John-David Dalton
2016-03-26 00:00:36 -07:00
parent a83b4ebd53
commit ce0b51888c
394 changed files with 1789 additions and 841 deletions

View File

@@ -1,7 +1,6 @@
import repeat from './repeat';
import baseRepeat from './_baseRepeat';
import stringSize from './_stringSize';
import stringToArray from './_stringToArray';
import toInteger from './toInteger';
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
@@ -23,25 +22,21 @@ var nativeCeil = Math.ceil;
* is truncated if the number of characters exceeds `length`.
*
* @private
* @param {string} string The string to create padding for.
* @param {number} [length=0] The padding length.
* @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
function createPadding(string, length, chars) {
length = toInteger(length);
var strLength = stringSize(string);
if (!length || strLength >= length) {
return '';
}
var padLength = length - strLength;
function createPadding(length, chars) {
chars = chars === undefined ? ' ' : (chars + '');
var result = repeat(chars, nativeCeil(padLength / stringSize(chars)));
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return reHasComplexSymbol.test(chars)
? stringToArray(result).slice(0, padLength).join('')
: result.slice(0, padLength);
? stringToArray(result).slice(0, length).join('')
: result.slice(0, length);
}
export default createPadding;