source: frontend/node_modules/underscore/cjs/intersection.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 599 bytes
Line 
1var _getLength = require('./_getLength.js');
2var contains = require('./contains.js');
3
4// Produce an array that contains every item shared between all the
5// passed-in arrays.
6function intersection(array) {
7 var result = [];
8 var argsLength = arguments.length;
9 for (var i = 0, length = _getLength(array); i < length; i++) {
10 var item = array[i];
11 if (contains(result, item)) continue;
12 var j;
13 for (j = 1; j < argsLength; j++) {
14 if (!contains(arguments[j], item)) break;
15 }
16 if (j === argsLength) result.push(item);
17 }
18 return result;
19}
20
21module.exports = intersection;
Note: See TracBrowser for help on using the repository browser.