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

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

Fix frontend appearance

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