lodash._createwrapper
Advanced tools
Comparing version 4.0.4 to 4.0.5
107
index.js
/** | ||
* lodash 4.0.4 (Custom Build) <https://lodash.com/> | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -147,16 +147,2 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
/** | ||
* Checks if `value` is a valid array-like index. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | ||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | ||
*/ | ||
function isIndex(value, length) { | ||
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; | ||
length = length == null ? MAX_SAFE_INTEGER : length; | ||
return value > -1 && value % 1 == 0 && value < length; | ||
} | ||
/** | ||
* Replaces all `placeholder` elements in `array` with an internal placeholder | ||
@@ -220,3 +206,3 @@ * and returns an array of their indexes. | ||
* @private | ||
* @param {Array|Object} args The provided arguments. | ||
* @param {Array} args The provided arguments. | ||
* @param {Array} partials The arguments to prepend to those provided. | ||
@@ -256,3 +242,3 @@ * @param {Array} holders The `partials` placeholder indexes. | ||
* @private | ||
* @param {Array|Object} args The provided arguments. | ||
* @param {Array} args The provided arguments. | ||
* @param {Array} partials The arguments to append to those provided. | ||
@@ -380,3 +366,3 @@ * @param {Array} holders The `partials` placeholder indexes. | ||
index = length, | ||
placeholder = getPlaceholder(wrapper); | ||
placeholder = getHolder(wrapper); | ||
@@ -432,4 +418,4 @@ while (index--) { | ||
var length = arguments.length, | ||
index = length, | ||
args = Array(length); | ||
args = Array(length), | ||
index = length; | ||
@@ -440,3 +426,3 @@ while (index--) { | ||
if (isCurried) { | ||
var placeholder = getPlaceholder(wrapper), | ||
var placeholder = getHolder(wrapper), | ||
holdersCount = countHolders(args, placeholder); | ||
@@ -568,2 +554,3 @@ } | ||
* 256 - `_.ary` | ||
* 512 - `_.flip` | ||
* @param {*} [thisArg] The `this` binding of `func`. | ||
@@ -634,3 +621,3 @@ * @param {Array} [partials] The arguments to be partially applied. | ||
*/ | ||
function getPlaceholder(func) { | ||
function getHolder(func) { | ||
var object = func; | ||
@@ -641,2 +628,17 @@ return object.placeholder; | ||
/** | ||
* Checks if `value` is a valid array-like index. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | ||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | ||
*/ | ||
function isIndex(value, length) { | ||
length = length == null ? MAX_SAFE_INTEGER : length; | ||
return !!length && | ||
(typeof value == 'number' || reIsUint.test(value)) && | ||
(value > -1 && value % 1 == 0 && value < length); | ||
} | ||
/** | ||
* Reorder `array` according to the specified indexes where the element at | ||
@@ -771,2 +773,37 @@ * the first index is assigned as the first element, the element at | ||
/** | ||
* Converts `value` to a finite number. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.12.0 | ||
* @category Lang | ||
* @param {*} value The value to convert. | ||
* @returns {number} Returns the converted number. | ||
* @example | ||
* | ||
* _.toFinite(3.2); | ||
* // => 3.2 | ||
* | ||
* _.toFinite(Number.MIN_VALUE); | ||
* // => 5e-324 | ||
* | ||
* _.toFinite(Infinity); | ||
* // => 1.7976931348623157e+308 | ||
* | ||
* _.toFinite('3.2'); | ||
* // => 3.2 | ||
*/ | ||
function toFinite(value) { | ||
if (!value) { | ||
return value === 0 ? value : 0; | ||
} | ||
value = toNumber(value); | ||
if (value === INFINITY || value === -INFINITY) { | ||
var sign = (value < 0 ? -1 : 1); | ||
return sign * MAX_INTEGER; | ||
} | ||
return value === value ? value : 0; | ||
} | ||
/** | ||
* Converts `value` to an integer. | ||
@@ -785,3 +822,3 @@ * | ||
* | ||
* _.toInteger(3); | ||
* _.toInteger(3.2); | ||
* // => 3 | ||
@@ -795,16 +832,10 @@ * | ||
* | ||
* _.toInteger('3'); | ||
* _.toInteger('3.2'); | ||
* // => 3 | ||
*/ | ||
function toInteger(value) { | ||
if (!value) { | ||
return value === 0 ? value : 0; | ||
} | ||
value = toNumber(value); | ||
if (value === INFINITY || value === -INFINITY) { | ||
var sign = (value < 0 ? -1 : 1); | ||
return sign * MAX_INTEGER; | ||
} | ||
var remainder = value % 1; | ||
return value === value ? (remainder ? value - remainder : value) : 0; | ||
var result = toFinite(value), | ||
remainder = result % 1; | ||
return result === result ? (remainder ? result - remainder : result) : 0; | ||
} | ||
@@ -823,4 +854,4 @@ | ||
* | ||
* _.toNumber(3); | ||
* // => 3 | ||
* _.toNumber(3.2); | ||
* // => 3.2 | ||
* | ||
@@ -833,4 +864,4 @@ * _.toNumber(Number.MIN_VALUE); | ||
* | ||
* _.toNumber('3'); | ||
* // => 3 | ||
* _.toNumber('3.2'); | ||
* // => 3.2 | ||
*/ | ||
@@ -837,0 +868,0 @@ function toNumber(value) { |
{ | ||
"name": "lodash._createwrapper", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "The internal lodash function `createWrapper` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash._createwrapper v4.0.4 | ||
# lodash._createwrapper v4.0.5 | ||
@@ -18,2 +18,2 @@ The internal [lodash](https://lodash.com/) function `createWrapper` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [package source](https://github.com/lodash/lodash/blob/4.0.4-npm-packages/lodash._createwrapper) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/4.0.5-npm-packages/lodash._createwrapper) 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
29378
801