Initial commit
[yaffs-website] / node_modules / sass-graph / node_modules / lodash / intersection.js
1 var arrayMap = require('./_arrayMap'),
2     baseIntersection = require('./_baseIntersection'),
3     baseRest = require('./_baseRest'),
4     castArrayLikeObject = require('./_castArrayLikeObject');
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  */
23 var intersection = baseRest(function(arrays) {
24   var mapped = arrayMap(arrays, castArrayLikeObject);
25   return (mapped.length && mapped[0] === arrays[0])
26     ? baseIntersection(mapped)
27     : [];
28 });
29
30 module.exports = intersection;