lodash.padstart
Advanced tools
Comparing version 4.5.0 to 4.6.0
102
index.js
@@ -9,5 +9,2 @@ /** | ||
*/ | ||
var baseSlice = require('lodash._baseslice'), | ||
baseToString = require('lodash._basetostring'), | ||
toString = require('lodash.tostring'); | ||
@@ -69,2 +66,11 @@ /** Used as references for various `Number` constants. */ | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = freeGlobal || freeSelf || Function('return this')(); | ||
/** | ||
@@ -109,2 +115,5 @@ * Gets the number of symbols in `string`. | ||
/** Built-in value references. */ | ||
var Symbol = root.Symbol; | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
@@ -114,2 +123,6 @@ var nativeCeil = Math.ceil, | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolToString = symbolProto ? symbolProto.toString : undefined; | ||
/** | ||
@@ -144,2 +157,52 @@ * The base implementation of `_.repeat` which doesn't coerce arguments. | ||
/** | ||
* The base implementation of `_.slice` without an iteratee call guard. | ||
* | ||
* @private | ||
* @param {Array} array The array to slice. | ||
* @param {number} [start=0] The start position. | ||
* @param {number} [end=array.length] The end position. | ||
* @returns {Array} Returns the slice of `array`. | ||
*/ | ||
function baseSlice(array, start, end) { | ||
var index = -1, | ||
length = array.length; | ||
if (start < 0) { | ||
start = -start > length ? 0 : (length + start); | ||
} | ||
end = end > length ? length : end; | ||
if (end < 0) { | ||
end += length; | ||
} | ||
length = start > end ? 0 : ((end - start) >>> 0); | ||
start >>>= 0; | ||
var result = Array(length); | ||
while (++index < length) { | ||
result[index] = array[index + start]; | ||
} | ||
return result; | ||
} | ||
/** | ||
* The base implementation of `_.toString` which doesn't convert nullish | ||
* values to empty strings. | ||
* | ||
* @private | ||
* @param {*} value The value to process. | ||
* @returns {string} Returns the string. | ||
*/ | ||
function baseToString(value) { | ||
// Exit early for strings to avoid a performance hit in some environments. | ||
if (typeof value == 'string') { | ||
return value; | ||
} | ||
if (isSymbol(value)) { | ||
return symbolToString ? symbolToString.call(value) : ''; | ||
} | ||
var result = (value + ''); | ||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
} | ||
/** | ||
* Casts `array` to a slice if it's needed. | ||
@@ -189,4 +252,3 @@ * | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | ||
* @example | ||
@@ -274,4 +336,3 @@ * | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`. | ||
* @example | ||
@@ -328,3 +389,3 @@ * | ||
* | ||
* **Note:** This function is loosely based on | ||
* **Note:** This method is loosely based on | ||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). | ||
@@ -404,2 +465,27 @@ * | ||
/** | ||
* Converts `value` to a string. An empty string is returned for `null` | ||
* and `undefined` values. The sign of `-0` is preserved. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to process. | ||
* @returns {string} Returns the string. | ||
* @example | ||
* | ||
* _.toString(null); | ||
* // => '' | ||
* | ||
* _.toString(-0); | ||
* // => '-0' | ||
* | ||
* _.toString([1, 2, 3]); | ||
* // => '1,2,3' | ||
*/ | ||
function toString(value) { | ||
return value == null ? '' : baseToString(value); | ||
} | ||
/** | ||
* Pads `string` on the left side if it's shorter than `length`. Padding | ||
@@ -406,0 +492,0 @@ * characters are truncated if they exceed `length`. |
{ | ||
"name": "lodash.padstart", | ||
"version": "4.5.0", | ||
"version": "4.6.0", | ||
"description": "The lodash method `_.padStart` exported as a module.", | ||
@@ -16,8 +16,3 @@ "homepage": "https://lodash.com/", | ||
"repository": "lodash/lodash", | ||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, | ||
"dependencies": { | ||
"lodash._baseslice": "~4.0.0", | ||
"lodash._basetostring": "~4.12.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.padstart v4.5.0 | ||
# lodash.padstart v4.6.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.5.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.6.0-npm-packages/lodash.padstart) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16840
0
471
- Removedlodash._baseslice@~4.0.0
- Removedlodash._basetostring@~4.12.0
- Removedlodash.tostring@^4.0.0
- Removedlodash._baseslice@4.0.0(transitive)
- Removedlodash._basetostring@4.12.0(transitive)
- Removedlodash.tostring@4.1.4(transitive)