function intersect () {
                    var arrays = libs.object.only(libs.object.toArray(arguments), 'array');

                    if(arrays.length === 0) return [];
                    if(arrays.length === 1) return libs.object.copy(arrays[0]);

                    var intersection = arrays[0], intermediate = [];
                    for(var i = 1; i < arrays.length; i++) {
                        var arr = libs.object.copy(arrays[i]); // Don't want to modify the original array!
                        for(var n = 0; n < intersection.length; n++) {
                            if(arr.indexOf(intersection[n]) > -1) {
                                intermediate.push(intersection[n]);
                                var idx = arr.indexOf(intersection[n]);
                                arr.splice(idx, 1);
                            }
                        }
                        intersection = intermediate;
                        intermediate = [];
                    }

                    return intersection;
                }
function intersect () {
                    var arrays = libs.object.only(libs.object.toArray(arguments), 'array');

                    if(arrays.length === 0) return [];
                    if(arrays.length === 1) return libs.object.copy(arrays[0]);

                    var intersection = arrays[0], intermediate = [];
                    for(var i = 1; i < arrays.length; i++) {
                        var arr = libs.object.copy(arrays[i]); 
                        for(var n = 0; n < intersection.length; n++) {
                            if(arr.indexOf(intersection[n]) > -1) {
                                intermediate.push(intersection[n]);
                                var idx = arr.indexOf(intersection[n]);
                                arr.splice(idx, 1);
                            }
                        }
                        intersection = intermediate;
                        intermediate = [];
                    }

                    return intersection;
                }
function intersect ( ) { var arrays = libs . object . only ( libs . object . toArray ( arguments ) , 'array' ) ; if ( arrays . length === 0 ) return [ ] ; if ( arrays . length === 1 ) return libs . object . copy ( arrays [ 0 ] ) ; var intersection = arrays [ 0 ] , intermediate = [ ] ; for ( var i = 1 ; i < arrays . length ; i ++ ) { var arr = libs . object . copy ( arrays [ i ] ) ; // Don't want to modify the original array! for ( var n = 0 ; n < intersection . length ; n ++ ) { if ( arr . indexOf ( intersection [ n ] ) > - 1 ) { intermediate . push ( intersection [ n ] ) ; var idx = arr . indexOf ( intersection [ n ] ) ; arr . splice ( idx , 1 ) ; } } intersection = intermediate ; intermediate = [ ] ; } return intersection ; }
Returns the items common to all arrays.
@param {...Array} items The arrays from which to compute the intersection.
@return {Array} A new array with items common to both arrays.
Returns the items common to all arrays .