lodash._baseflatten
Advanced tools
Comparing version 3.1.1 to 3.1.2
49
index.js
/** | ||
* lodash 3.1.1 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.2 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -35,4 +35,4 @@ * Available under MIT license <https://lodash.com/license> | ||
* @param {Array} array The array to flatten. | ||
* @param {boolean} isDeep Specify a deep flatten. | ||
* @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. | ||
* @param {boolean} [isDeep] Specify a deep flatten. | ||
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects. | ||
* @returns {Array} Returns the new flattened array. | ||
@@ -48,4 +48,4 @@ */ | ||
var value = array[index]; | ||
if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { | ||
if (isObjectLike(value) && isArrayLike(value) && | ||
(isStrict || isArray(value) || isArguments(value))) { | ||
if (isDeep) { | ||
@@ -58,3 +58,2 @@ // Recursively flatten arrays (susceptible to call stack limits). | ||
result.length += valLength; | ||
while (++valIndex < valLength) { | ||
@@ -71,2 +70,38 @@ result[++resIndex] = value[valIndex]; | ||
/** | ||
* The base implementation of `_.property` without support for deep paths. | ||
* | ||
* @private | ||
* @param {string} key The key of the property to get. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function baseProperty(key) { | ||
return function(object) { | ||
return object == null ? undefined : object[key]; | ||
}; | ||
} | ||
/** | ||
* Gets the "length" property value of `object`. | ||
* | ||
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
* that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {*} Returns the "length" value. | ||
*/ | ||
var getLength = baseProperty('length'); | ||
/** | ||
* Checks if `value` is array-like. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
*/ | ||
function isArrayLike(value) { | ||
return value != null && isLength(getLength(value)); | ||
} | ||
/** | ||
* Checks if `value` is a valid array-like length. | ||
@@ -73,0 +108,0 @@ * |
{ | ||
"name": "lodash._baseflatten", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "The modern build of lodash’s internal `baseFlatten` as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash._baseflatten v3.1.1 | ||
# lodash._baseflatten v3.1.2 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseFlatten` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash._baseflatten) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash._baseflatten) 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
6187
105