src/object.js
function equals( obj1, obj2 ){
	var t1 = typeof obj1,
		t2 = typeof obj2,
		c,
		i,
		keyCheck;

	if ( obj1 === obj2 ){
		return true;
	}else if ( obj1 !== obj1 && obj2 !== obj2 ){
		return true; // silly NaN
	}else if ( obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined ){
		return false; // undefined or null
	}else if ( obj1.equals ){
		return obj1.equals( obj2 );
	}else if ( obj2.equals ){
		return obj2.equals( obj1 ); // because maybe somene wants a class to be able to equal a simple object
	}else if ( t1 === t2 ){
		if ( t1 === 'object' ){
			if ( bmoor.isArrayLike(obj1) ){
				if ( !bmoor.isArrayLike(obj2) ){ 
					return false; 
				}

				if ( (c = obj1.length) === obj2.length ){
					for( i = 0; i < c; i++ ){
						if ( !equals(obj1[i], obj2[i]) ) { 
							return false;
						}
					}

					return true;
				}
			}else if ( !bmoor.isArrayLike(obj2) ){
				keyCheck = {};
				for( i in obj1 ){
					if ( obj1.hasOwnProperty(i) ){
						if ( !equals(obj1[i],obj2[i]) ){
							return false;
						}

						keyCheck[i] = true;
					}
				}

				for( i in obj2 ){
					if ( obj2.hasOwnProperty(i) ){
						if ( !keyCheck && obj2[i] !== undefined ){
							return false;
						}
					}
				}
			}
		}
	}

	return false;
}
function equals( obj1, obj2 ){
	var t1 = typeof obj1,
		t2 = typeof obj2,
		c,
		i,
		keyCheck;

	if ( obj1 === obj2 ){
		return true;
	}else if ( obj1 !== obj1 && obj2 !== obj2 ){
		return true; // silly NaN
	}else if ( obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined ){
		return false; // undefined or null
	}else if ( obj1.equals ){
		return obj1.equals( obj2 );
	}else if ( obj2.equals ){
		return obj2.equals( obj1 ); // because maybe somene wants a class to be able to equal a simple object
	}else if ( t1 === t2 ){
		if ( t1 === 'object' ){
			if ( bmoor.isArrayLike(obj1) ){
				if ( !bmoor.isArrayLike(obj2) ){ 
					return false; 
				}

				if ( (c = obj1.length) === obj2.length ){
					for( i = 0; i < c; i++ ){
						if ( !equals(obj1[i], obj2[i]) ) { 
							return false;
						}
					}

					return true;
				}
			}else if ( !bmoor.isArrayLike(obj2) ){
				keyCheck = {};
				for( i in obj1 ){
					if ( obj1.hasOwnProperty(i) ){
						if ( !equals(obj1[i],obj2[i]) ){
							return false;
						}

						keyCheck[i] = true;
					}
				}

				for( i in obj2 ){
					if ( obj2.hasOwnProperty(i) ){
						if ( !keyCheck && obj2[i] !== undefined ){
							return false;
						}
					}
				}
			}
		}
	}

	return false;
}
function equals ( obj1 , obj2 ) { var t1 = typeof obj1 , t2 = typeof obj2 , c , i , keyCheck ; if ( obj1 === obj2 ) { return true ; } else if ( obj1 !== obj1 && obj2 !== obj2 ) { return true ; // silly NaN
 } else if ( obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined ) { return false ; // undefined or null
 } else if ( obj1 . equals ) { return obj1 . equals ( obj2 ) ; } else if ( obj2 . equals ) { return obj2 . equals ( obj1 ) ; // because maybe somene wants a class to be able to equal a simple object
 } else if ( t1 === t2 ) { if ( t1 === 'object' ) { if ( bmoor . isArrayLike ( obj1 ) ) { if ( ! bmoor . isArrayLike ( obj2 ) ) { return false ; } if ( ( c = obj1 . length ) === obj2 . length ) { for ( i = 0 ; i < c ; i ++ ) { if ( ! equals ( obj1 [ i ] , obj2 [ i ] ) ) { return false ; } } return true ; } } else if ( ! bmoor . isArrayLike ( obj2 ) ) { keyCheck = { } ; for ( i in obj1 ) { if ( obj1 . hasOwnProperty ( i ) ) { if ( ! equals ( obj1 [ i ] , obj2 [ i ] ) ) { return false ; } keyCheck [ i ] = true ; } } for ( i in obj2 ) { if ( obj2 . hasOwnProperty ( i ) ) { if ( ! keyCheck && obj2 [ i ] !== undefined ) { return false ; } } } } } } return false ; }
A general comparison algorithm to test if two objects are equal

@function equals
@param {object} obj1 The object to copy the content from
@param {object} obj2 The object into which to copy the content
@preturns {boolean}
A general comparison algorithm to test if two objects are equal