mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Optimize _.intersection and _.intersectionBy for empty arrays.
This commit is contained in:
@@ -5421,7 +5421,7 @@
|
|||||||
*/
|
*/
|
||||||
var intersection = restParam(function(arrays) {
|
var intersection = restParam(function(arrays) {
|
||||||
var mapped = arrayMap(arrays, toArrayLikeObject);
|
var mapped = arrayMap(arrays, toArrayLikeObject);
|
||||||
return mapped[0] === arrays[0]
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
? baseIntersection(mapped)
|
? baseIntersection(mapped)
|
||||||
: [];
|
: [];
|
||||||
});
|
});
|
||||||
@@ -5448,7 +5448,7 @@
|
|||||||
*/
|
*/
|
||||||
var intersectionBy = restParam(function(arrays) {
|
var intersectionBy = restParam(function(arrays) {
|
||||||
var mapped = arrayMap(arrays, toArrayLikeObject);
|
var mapped = arrayMap(arrays, toArrayLikeObject);
|
||||||
return mapped[0] === arrays[0]
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
? baseIntersectionBy(mapped, getIteratee(last(arrays)))
|
? baseIntersectionBy(mapped, getIteratee(last(arrays)))
|
||||||
: [];
|
: [];
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user