You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					20 lines
				
				574 B
			
		
		
			
		
	
	
					20 lines
				
				574 B
			| 
											3 years ago
										 | import getLength from './_getLength.js'; | ||
|  | import contains from './contains.js'; | ||
|  | 
 | ||
|  | // Produce an array that contains every item shared between all the
 | ||
|  | // passed-in arrays.
 | ||
|  | export default function intersection(array) { | ||
|  |   var result = []; | ||
|  |   var argsLength = arguments.length; | ||
|  |   for (var i = 0, length = getLength(array); i < length; i++) { | ||
|  |     var item = array[i]; | ||
|  |     if (contains(result, item)) continue; | ||
|  |     var j; | ||
|  |     for (j = 1; j < argsLength; j++) { | ||
|  |       if (!contains(arguments[j], item)) break; | ||
|  |     } | ||
|  |     if (j === argsLength) result.push(item); | ||
|  |   } | ||
|  |   return result; | ||
|  | } |