source: imaps-frontend/node_modules/lodash-es/intersection.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 951 bytes
RevLine 
[d565449]1import arrayMap from './_arrayMap.js';
2import baseIntersection from './_baseIntersection.js';
3import baseRest from './_baseRest.js';
4import castArrayLikeObject from './_castArrayLikeObject.js';
5
6/**
7 * Creates an array of unique values that are included in all given arrays
8 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9 * for equality comparisons. The order and references of result values are
10 * determined by the first array.
11 *
12 * @static
13 * @memberOf _
14 * @since 0.1.0
15 * @category Array
16 * @param {...Array} [arrays] The arrays to inspect.
17 * @returns {Array} Returns the new array of intersecting values.
18 * @example
19 *
20 * _.intersection([2, 1], [2, 3]);
21 * // => [2]
22 */
23var intersection = baseRest(function(arrays) {
24 var mapped = arrayMap(arrays, castArrayLikeObject);
25 return (mapped.length && mapped[0] === arrays[0])
26 ? baseIntersection(mapped)
27 : [];
28});
29
30export default intersection;
Note: See TracBrowser for help on using the repository browser.