vararrayPush=require('./_arrayPush'),isFlattenable=require('./_isFlattenable');/** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */functionbaseFlatten(array,depth,predicate,isStrict,result){varindex=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){varvalue=array[index];if(depth>0&&predicate(value)){if(depth>1){// Recursively flatten arrays (susceptible to call stack limits).baseFlatten(value,depth-1,predicate,isStrict,result);}else{arrayPush(result,value);}}elseif(!isStrict){result[result.length]=value;}}returnresult;}module.exports=baseFlatten;