lodash.padstart
Advanced tools
Comparing version
30
index.js
/** | ||
* lodash 4.3.0 (Custom Build) <https://lodash.com/> | ||
* lodash 4.4.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -9,3 +9,4 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
*/ | ||
var toString = require('lodash.tostring'); | ||
var baseSlice = require('lodash._baseslice'), | ||
toString = require('lodash.tostring'); | ||
@@ -100,3 +101,4 @@ /** Used as references for various `Number` constants. */ | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -139,2 +141,17 @@ */ | ||
/** | ||
* Casts `array` to a slice if it's needed. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {number} start The start position. | ||
* @param {number} [end=array.length] The end position. | ||
* @returns {Array} Returns the cast slice. | ||
*/ | ||
function castSlice(array, start, end) { | ||
var length = array.length; | ||
end = end === undefined ? length : end; | ||
return (!start && end >= length) ? array : baseSlice(array, start, end); | ||
} | ||
/** | ||
* Creates the padding for `string` based on `length`. The `chars` string | ||
@@ -157,3 +174,3 @@ * is truncated if the number of characters exceeds `length`. | ||
return reHasComplexSymbol.test(chars) | ||
? stringToArray(result).slice(0, length).join('') | ||
? castSlice(stringToArray(result), 0, length).join('') | ||
: result.slice(0, length); | ||
@@ -189,4 +206,5 @@ } | ||
/** | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
@@ -193,0 +211,0 @@ * @static |
{ | ||
"name": "lodash.padstart", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "The lodash method `_.padStart` exported as a module.", | ||
@@ -18,4 +18,5 @@ "homepage": "https://lodash.com/", | ||
"dependencies": { | ||
"lodash._baseslice": "~4.0.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.padstart v4.3.0 | ||
# lodash.padstart v4.4.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.padStart` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#padStart) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.padstart) for more details. | ||
See the [documentation](https://lodash.com/docs#padStart) or [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash.padstart) for more details. |
14121
4.37%367
4.86%2
100%+ Added
+ Added