mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Remove copyArray dep from _.flattenDepth.
This commit is contained in:
32
lodash.js
32
lodash.js
@@ -2507,7 +2507,7 @@
|
|||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index];
|
var value = array[index];
|
||||||
if (isArrayLikeObject(value) &&
|
if (depth > 0 && isArrayLikeObject(value) &&
|
||||||
(isStrict || isArray(value) || isArguments(value))) {
|
(isStrict || isArray(value) || isArguments(value))) {
|
||||||
if (depth > 1) {
|
if (depth > 1) {
|
||||||
// Recursively flatten arrays (susceptible to call stack limits).
|
// Recursively flatten arrays (susceptible to call stack limits).
|
||||||
@@ -4173,7 +4173,7 @@
|
|||||||
*/
|
*/
|
||||||
function createFlow(fromRight) {
|
function createFlow(fromRight) {
|
||||||
return rest(function(funcs) {
|
return rest(function(funcs) {
|
||||||
funcs = baseFlatten(funcs);
|
funcs = baseFlatten(funcs, 1);
|
||||||
|
|
||||||
var length = funcs.length,
|
var length = funcs.length,
|
||||||
index = length,
|
index = length,
|
||||||
@@ -4313,7 +4313,7 @@
|
|||||||
*/
|
*/
|
||||||
function createOver(arrayFunc) {
|
function createOver(arrayFunc) {
|
||||||
return rest(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
iteratees = arrayMap(baseFlatten(iteratees), getIteratee());
|
iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee());
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, function(iteratee) {
|
||||||
@@ -5453,7 +5453,7 @@
|
|||||||
if (!isArray(array)) {
|
if (!isArray(array)) {
|
||||||
array = array == null ? [] : [Object(array)];
|
array = array == null ? [] : [Object(array)];
|
||||||
}
|
}
|
||||||
values = baseFlatten(values);
|
values = baseFlatten(values, 1);
|
||||||
return arrayConcat(array, values);
|
return arrayConcat(array, values);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -5819,7 +5819,7 @@
|
|||||||
*/
|
*/
|
||||||
function flatten(array) {
|
function flatten(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array ? array.length : 0;
|
||||||
return length ? baseFlatten(array) : [];
|
return length ? baseFlatten(array, 1) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5865,7 +5865,7 @@
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
depth = depth === undefined ? 1 : toInteger(depth);
|
depth = depth === undefined ? 1 : toInteger(depth);
|
||||||
return depth < 1 ? copyArray(array) : baseFlatten(array, depth);
|
return baseFlatten(array, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6233,7 +6233,7 @@
|
|||||||
* // => [10, 20]
|
* // => [10, 20]
|
||||||
*/
|
*/
|
||||||
var pullAt = rest(function(array, indexes) {
|
var pullAt = rest(function(array, indexes) {
|
||||||
indexes = arrayMap(baseFlatten(indexes), String);
|
indexes = arrayMap(baseFlatten(indexes, 1), String);
|
||||||
|
|
||||||
var result = baseAt(array, indexes);
|
var result = baseAt(array, indexes);
|
||||||
basePullAt(array, indexes.sort(compareAscending));
|
basePullAt(array, indexes.sort(compareAscending));
|
||||||
@@ -7184,7 +7184,7 @@
|
|||||||
* // => ['a', 'c']
|
* // => ['a', 'c']
|
||||||
*/
|
*/
|
||||||
var wrapperAt = rest(function(paths) {
|
var wrapperAt = rest(function(paths) {
|
||||||
paths = baseFlatten(paths);
|
paths = baseFlatten(paths, 1);
|
||||||
var length = paths.length,
|
var length = paths.length,
|
||||||
start = length ? paths[0] : 0,
|
start = length ? paths[0] : 0,
|
||||||
value = this.__wrapped__,
|
value = this.__wrapped__,
|
||||||
@@ -7624,7 +7624,7 @@
|
|||||||
* // => [1, 1, 2, 2]
|
* // => [1, 1, 2, 2]
|
||||||
*/
|
*/
|
||||||
function flatMap(collection, iteratee) {
|
function flatMap(collection, iteratee) {
|
||||||
return baseFlatten(map(collection, iteratee));
|
return baseFlatten(map(collection, iteratee), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8246,7 +8246,7 @@
|
|||||||
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
||||||
iteratees.length = 1;
|
iteratees.length = 1;
|
||||||
}
|
}
|
||||||
return baseOrderBy(collection, baseFlatten(iteratees), []);
|
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
@@ -8924,7 +8924,7 @@
|
|||||||
* // => [100, 10]
|
* // => [100, 10]
|
||||||
*/
|
*/
|
||||||
var overArgs = rest(function(func, transforms) {
|
var overArgs = rest(function(func, transforms) {
|
||||||
transforms = arrayMap(baseFlatten(transforms), getIteratee());
|
transforms = arrayMap(baseFlatten(transforms, 1), getIteratee());
|
||||||
|
|
||||||
var funcsLength = transforms.length;
|
var funcsLength = transforms.length;
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
@@ -9038,7 +9038,7 @@
|
|||||||
* // => ['a', 'b', 'c']
|
* // => ['a', 'b', 'c']
|
||||||
*/
|
*/
|
||||||
var rearg = rest(function(func, indexes) {
|
var rearg = rest(function(func, indexes) {
|
||||||
return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
|
return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10808,7 +10808,7 @@
|
|||||||
* // => ['a', 'c']
|
* // => ['a', 'c']
|
||||||
*/
|
*/
|
||||||
var at = rest(function(object, paths) {
|
var at = rest(function(object, paths) {
|
||||||
return baseAt(object, baseFlatten(paths));
|
return baseAt(object, baseFlatten(paths, 1));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11544,7 +11544,7 @@
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
props = arrayMap(baseFlatten(props), String);
|
props = arrayMap(baseFlatten(props, 1), String);
|
||||||
return basePick(object, baseDifference(keysIn(object), props));
|
return basePick(object, baseDifference(keysIn(object), props));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -11591,7 +11591,7 @@
|
|||||||
* // => { 'a': 1, 'c': 3 }
|
* // => { 'a': 1, 'c': 3 }
|
||||||
*/
|
*/
|
||||||
var pick = rest(function(object, props) {
|
var pick = rest(function(object, props) {
|
||||||
return object == null ? {} : basePick(object, baseFlatten(props));
|
return object == null ? {} : basePick(object, baseFlatten(props, 1));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13154,7 +13154,7 @@
|
|||||||
* // => logs 'clicked docs' when clicked
|
* // => logs 'clicked docs' when clicked
|
||||||
*/
|
*/
|
||||||
var bindAll = rest(function(object, methodNames) {
|
var bindAll = rest(function(object, methodNames) {
|
||||||
arrayEach(baseFlatten(methodNames), function(key) {
|
arrayEach(baseFlatten(methodNames, 1), function(key) {
|
||||||
object[key] = bind(object[key], object);
|
object[key] = bind(object[key], object);
|
||||||
});
|
});
|
||||||
return object;
|
return object;
|
||||||
|
|||||||
Reference in New Issue
Block a user