mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
41
react-app/node_modules/lodash/internal/baseFlatten.js
generated
vendored
Normal file
41
react-app/node_modules/lodash/internal/baseFlatten.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var arrayPush = require('./arrayPush'),
|
||||
isArguments = require('../lang/isArguments'),
|
||||
isArray = require('../lang/isArray'),
|
||||
isArrayLike = require('./isArrayLike'),
|
||||
isObjectLike = require('./isObjectLike');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.flatten` with added support for restricting
|
||||
* flattening and specifying the start index.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isDeep] Specify a deep flatten.
|
||||
* @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, result) {
|
||||
result || (result = []);
|
||||
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (isObjectLike(value) && isArrayLike(value) &&
|
||||
(isStrict || isArray(value) || isArguments(value))) {
|
||||
if (isDeep) {
|
||||
// Recursively flatten arrays (susceptible to call stack limits).
|
||||
baseFlatten(value, isDeep, isStrict, result);
|
||||
} else {
|
||||
arrayPush(result, value);
|
||||
}
|
||||
} else if (!isStrict) {
|
||||
result[result.length] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseFlatten;
|
Reference in New Issue
Block a user