mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Bump to v4.14.0.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import arrayMap from './_arrayMap.js';
|
||||
import baseIntersection from './_baseIntersection.js';
|
||||
import baseIteratee from './_baseIteratee.js';
|
||||
import baseRest from './_baseRest.js';
|
||||
import castArrayLikeObject from './_castArrayLikeObject.js';
|
||||
import last from './last.js';
|
||||
import rest from './rest.js';
|
||||
|
||||
/**
|
||||
* This method is like `_.intersection` except that it accepts `iteratee`
|
||||
@@ -16,8 +16,7 @@ import rest from './rest.js';
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to inspect.
|
||||
* @param {Array|Function|Object|string} [iteratee=_.identity]
|
||||
* The iteratee invoked per element.
|
||||
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
||||
* @returns {Array} Returns the new array of intersecting values.
|
||||
* @example
|
||||
*
|
||||
@@ -28,7 +27,7 @@ import rest from './rest.js';
|
||||
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||
* // => [{ 'x': 1 }]
|
||||
*/
|
||||
var intersectionBy = rest(function(arrays) {
|
||||
var intersectionBy = baseRest(function(arrays) {
|
||||
var iteratee = last(arrays),
|
||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||
|
||||
@@ -38,7 +37,7 @@ var intersectionBy = rest(function(arrays) {
|
||||
mapped.pop();
|
||||
}
|
||||
return (mapped.length && mapped[0] === arrays[0])
|
||||
? baseIntersection(mapped, baseIteratee(iteratee))
|
||||
? baseIntersection(mapped, baseIteratee(iteratee, 2))
|
||||
: [];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user