lodash._baseflatten
Advanced tools
Comparing version 3.1.3 to 3.1.4
46
index.js
/** | ||
* lodash 3.1.3 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.4 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
@@ -24,3 +24,3 @@ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
/** | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
@@ -31,2 +31,21 @@ */ | ||
/** | ||
* Appends the elements of `values` to `array`. | ||
* | ||
* @private | ||
* @param {Array} array The array to modify. | ||
* @param {Array} values The values to append. | ||
* @returns {Array} Returns `array`. | ||
*/ | ||
function arrayPush(array, values) { | ||
var index = -1, | ||
length = values.length, | ||
offset = array.length; | ||
while (++index < length) { | ||
array[offset + index] = values[index]; | ||
} | ||
return array; | ||
} | ||
/** | ||
* The base implementation of `_.flatten` with added support for restricting | ||
@@ -39,9 +58,10 @@ * flattening and specifying the start index. | ||
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects. | ||
* @param {Array} [result=[]] The initial result value. | ||
* @returns {Array} Returns the new flattened array. | ||
*/ | ||
function baseFlatten(array, isDeep, isStrict) { | ||
function baseFlatten(array, isDeep, isStrict, result) { | ||
result || (result = []); | ||
var index = -1, | ||
length = array.length, | ||
resIndex = -1, | ||
result = []; | ||
length = array.length; | ||
@@ -54,12 +74,8 @@ while (++index < length) { | ||
// Recursively flatten arrays (susceptible to call stack limits). | ||
value = baseFlatten(value, isDeep, isStrict); | ||
baseFlatten(value, isDeep, isStrict, result); | ||
} else { | ||
arrayPush(result, value); | ||
} | ||
var valIndex = -1, | ||
valLength = value.length; | ||
while (++valIndex < valLength) { | ||
result[++resIndex] = value[valIndex]; | ||
} | ||
} else if (!isStrict) { | ||
result[++resIndex] = value; | ||
result[result.length] = value; | ||
} | ||
@@ -109,3 +125,3 @@ } | ||
* | ||
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). | ||
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
* | ||
@@ -112,0 +128,0 @@ * @private |
{ | ||
"name": "lodash._baseflatten", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"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.3 | ||
# lodash._baseflatten v3.1.4 | ||
@@ -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.3-npm-packages/lodash._baseflatten) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.4-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
6522
119