src/array.js
function compare( arr1, arr2, func ){
	var cmp,
		left = [],
		right = [],
		leftI = [],
		rightI = [];

	arr1 = arr1.slice(0);
	arr2 = arr2.slice(0);

	arr1.sort( func );
	arr2.sort( func );

	while( arr1.length > 0 && arr2.length > 0 ){
		cmp = func( arr1[0], arr2[0] );

		if ( cmp < 0 ){
			left.push( arr1.shift() );
		}else if ( cmp > 0 ){
			right.push( arr2.shift() );
		}else{
			leftI.push( arr1.shift() );
			rightI.push( arr2.shift() );
		}
	}

	while( arr1.length ){
		left.push( arr1.shift() );
	}

	while( arr2.length ){
		right.push( arr2.shift() );
	}

	return {
		left : left,
		intersection : {
			left : leftI,
			right : rightI
		},
		right : right
	};
}
function compare( arr1, arr2, func ){
	var cmp,
		left = [],
		right = [],
		leftI = [],
		rightI = [];

	arr1 = arr1.slice(0);
	arr2 = arr2.slice(0);

	arr1.sort( func );
	arr2.sort( func );

	while( arr1.length > 0 && arr2.length > 0 ){
		cmp = func( arr1[0], arr2[0] );

		if ( cmp < 0 ){
			left.push( arr1.shift() );
		}else if ( cmp > 0 ){
			right.push( arr2.shift() );
		}else{
			leftI.push( arr1.shift() );
			rightI.push( arr2.shift() );
		}
	}

	while( arr1.length ){
		left.push( arr1.shift() );
	}

	while( arr2.length ){
		right.push( arr2.shift() );
	}

	return {
		left : left,
		intersection : {
			left : leftI,
			right : rightI
		},
		right : right
	};
}
function compare ( arr1 , arr2 , func ) { var cmp , left = [ ] , right = [ ] , leftI = [ ] , rightI = [ ] ; arr1 = arr1 . slice ( 0 ) ; arr2 = arr2 . slice ( 0 ) ; arr1 . sort ( func ) ; arr2 . sort ( func ) ; while ( arr1 . length > 0 && arr2 . length > 0 ) { cmp = func ( arr1 [ 0 ] , arr2 [ 0 ] ) ; if ( cmp < 0 ) { left . push ( arr1 . shift ( ) ) ; } else if ( cmp > 0 ) { right . push ( arr2 . shift ( ) ) ; } else { leftI . push ( arr1 . shift ( ) ) ; rightI . push ( arr2 . shift ( ) ) ; } } while ( arr1 . length ) { left . push ( arr1 . shift ( ) ) ; } while ( arr2 . length ) { right . push ( arr2 . shift ( ) ) ; } return { left : left , intersection : { left : leftI , right : rightI } , right : right } ; }
Compare two arrays.

@function remove
@param {array} arr1 An array to be compared
@param {array} arr2 An array to be compared
@param {function} func The comparison function
@return {object} an object containing the elements unique to the left, matched, and unqiue to the right
Compare two arrays .