mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v3.10.0.
This commit is contained in:
@@ -2,12 +2,10 @@ import baseToString from '../internal/baseToString';
|
||||
import createPadding from '../internal/createPadding';
|
||||
import root from '../internal/root';
|
||||
|
||||
/** Native method references. */
|
||||
var ceil = Math.ceil,
|
||||
floor = Math.floor;
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeIsFinite = root.isFinite;
|
||||
var nativeCeil = Math.ceil,
|
||||
nativeFloor = Math.floor,
|
||||
nativeIsFinite = root.isFinite;
|
||||
|
||||
/**
|
||||
* Pads `string` on the left and right sides if it's shorter than `length`.
|
||||
@@ -40,8 +38,8 @@ function pad(string, length, chars) {
|
||||
return string;
|
||||
}
|
||||
var mid = (length - strLength) / 2,
|
||||
leftLength = floor(mid),
|
||||
rightLength = ceil(mid);
|
||||
leftLength = nativeFloor(mid),
|
||||
rightLength = nativeCeil(mid);
|
||||
|
||||
chars = createPadding('', rightLength, chars);
|
||||
return chars.slice(0, leftLength) + string + chars;
|
||||
|
||||
Reference in New Issue
Block a user