Compare an object with another, could be object, array, number, string, bool.
@private
@param {Object} a The first object to compare
@param {Object} a The second object to compare
@returns {Boolean} Whether the objects are identical
486892
function compare(a, b) {
  let isIdentical = true;

  if (isObject(a) && isObject(b)) {
    if (Object.keys(a).length !== Object.keys(b).length) {
      return false;
    }
    Object.keys(a).forEach((key) => {
      if (!compare(a[key], b[key])) {
        isIdentical = false;
      }
    });
    return isIdentical;
  } if (isArray(a) && isArray(b)) {
    if (a.length !== b.length) {
      return false;
    }
    for (let i = 0, l = a.length; i < l; i += 1) {
      if (!compare(a[i], b[i])) {
        return false;
      }
    }
    return true;
  }
  return a === b;
}
1201375
function objectsAreEqual(obj1, obj2) {
  // Always search through array on array columns
  if (Array.isArray(obj1)) {
    if (Array.isArray(obj2)) {
      throw new Parse.Error(107, `You cannot use ${obj2} as a query parameter`);
    } else {
      return _.some(obj1, obj => objectsAreEqual(obj, obj2));
    }
  }

  // scalar values (including null/undefined)
  // Note: undefined equals null.
  // For all other objects, strict equality is applied
  if (obj1 === obj2 || (_.isNil(obj1) && _.isNil(obj2))) {
    return true;
  }

  // if any of those is null or undefined the other is not because
  // of above --> abort
  if (_.isNil(obj1) || _.isNil(obj2)) {
    return false;
  }

  // objects
  if (_.isEqual(obj1, obj2)) {
    return true;
  }

  // both pointers
  if (obj1.objectId !== undefined && obj1.objectId === obj2.objectId) {
    return true;
  }

  // both dates
  if (isDate(obj1) && isDate(obj2)) {
    return deserializeQueryParam(obj1) === deserializeQueryParam(obj2);
  }

  return false;
}
164596
function arrayEquals(arrayA, arrayB) {
	"use strict";

	// if the other array is a falsy value, return
	if (!arrayB || !arrayA) {
		return false;
	}

	// compare lengths - can save a lot of time
	if (arrayA.length !== arrayB.length) {
		return false;
	}

	for (var i = 0; i < arrayA.length; i++) {
		// Check if we have nested arrays
		if (arrayA[i] instanceof Array && arrayB[i] instanceof Array) {
			// recurse into the nested arrays
			if (!arrayEquals(arrayA[i], arrayB[i])) {
				return false;
			}
		}
		else if (arrayA[i] !== arrayB[i]) {
			// Warning - two different object instances will never be equal: {x:20} != {x:20}
			return false;
		}
	}
	return true;
}
546353
function(a, b) {
      var keys = Object.keys(b)
        , i = 0
        , l = keys.length
        , val;

      for (; i < l; i++) {
        val = b[keys[i]];
        if (has(a, val)) return true;
      }

      return false;
    }
348444
function(a, b)
	{
		if ((a == null && b != null) || (a != null && b == null) ||
			(a != null && b != null && a.length != b.length))
		{
			return false;
		}
		else if (a != null && b != null)
		{
			for (var i = 0; i < a.length; i++)
			{
				if (a[i] == b[i] || (a[i] != null && !a[i].equals(b[i])))
				{
					return false;
				}
			}
		}
		
		return true;
	}
897612
def compare_arrays(a, b)
      a.each_with_index do |v1, i|
        v2 = b[i]
        if v1.is_a?(String) && v2.is_a?(Integer)
          return 1
        elsif v1.is_a?(Integer) && v2.is_a?(String)
          return -1
        end
        comparison = v1 <=> v2
        unless comparison == 0
          return comparison
        end
      end
      0
    end
44559
function _is_same(a, b){
	//bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b));

	var ret = false;
	if( a == b ){ // atoms, incl. null and 'string'
	    //bark('true on equal atoms: ' + a + '<>' + b);
	    ret = true;
	}else{ // is list or obj (ignore func)
	    if( typeof(a) === 'object' && typeof(b) === 'object' ){
		//bark('...are objects');
		
		// Null is an object, but not like the others.
		if( a == null || b == null ){
		    ret = false;
		}else if( Array.isArray(a) && Array.isArray(b) ){ // array equiv
		    //bark('...are arrays');
		    
		    // Recursively check array equiv.
		    if( a.length == b.length ){
			if( a.length == 0 ){
			    //bark('true on 0 length array');
			    ret = true;
			}else{
			    ret = true; // assume true until false here
			    for( var i = 0; i < a.length; i++ ){
				if( ! _is_same(a[i], b[i]) ){
				    //bark('false on diff @ index: ' + i);
				    ret = false;
				    break;
				}
			    }
			}
		    }

		}else{ // object equiv.

		    // Get unique set of keys.
		    var a_keys = Object.keys(a);
		    var b_keys = Object.keys(b);
		    var keys = a_keys.concat(b_keys.filter(function(it){
			return a_keys.indexOf(it) < 0;
		    }));
		    
		    // Assume true until false.
		    ret = true;
		    for( var j = 0; j < keys.length; j++ ){ // no forEach - break
			var k = keys[j];
			if( ! _is_same(a[k], b[k]) ){
			    //bark('false on key: ' + k);
			    ret = false;
			    break;
			}
		    }
		}
	    }else{
		//bark('false by default');
	    }
	}
	
	return ret;
    }
737531
function equalArrays(array1, array2) {
  // if the other array is a falsy value, return
  if (!array1 || !array2)
      return false;

  // compare lengths - can save a lot of time
  if (array1.length != array2.length)
      return false;

  for (var i = 0, l=array1.length; i < l; i++) {
      // Check if we have nested arrays
      if (array1[i] instanceof Array && array2[i] instanceof Array) {
          // recurse into the nested arrays
          if (!equalArrays(array1[i],array2[i]))
              return false;
      }
      else if (array1[i] != array2[i]) {
          // Warning - two different object instances will never be equal: {x:20} != {x:20}
          return false;
      }
  }
  return true;
}
1272622
function (list) {
            if (list.size() !== this.size()) {
                return false;
            }
            var isEqual = true,
                a, b;
            for (var i = 0; i < this.$items.length; i++) {
                a = this.$items[i];
                b = list.at(i);
                if (a instanceof Bindable && b instanceof Bindable) {
                    if (!a.isDeepEqual(b)) {
                        return false;
                    }
                } else if (a instanceof Bindable || b instanceof Bindable) {
                    return false;
                } else {
                    isEqual = _.isEqual(a, b);
                }
            }

            return isEqual;
        }
73027
function compare(a, b) {
    try {
        return semver.compare(a, b);
    } catch(err) {
        if(semver.valid(a)) {
            return 1
        }
        if(semver.valid(b)) {
            return -1;
        }
        return 0;
    }
}
253403
function _compareTypes(typeA, typeB, sameTypes, propertyA, propertyB) {
  sameTypes = sameTypes || {}
  if (typeA === typeB) {
    if (typeA === types.class && propertyA && propertyB) {
      return propertyA.constructor.name === propertyB.constructor.name;
    }
    return true;
  }

  if (Object.keys(sameTypes).length === 0) {
    return false;
  }
  let typeKeyA;
  let typeKeyB;
  let foundMatch = false
  Object.keys(sameTypes).forEach((key) => {
    if (foundMatch) { return }
    const similar = sameTypes[key];
    if (similar.indexOf(typeA) > -1) {
      typeKeyA = key;
    }
    if (similar.indexOf(typeB) > -1) {
      typeKeyB = key;
    }
    if (typeKeyA && typeKeyB) { foundMatch = true }
  });
  return foundMatch && typeKeyA === typeKeyB;
}
973781
public static boolean sameList(final Vector v, final Object[] a) {
    if (v == null || a == null || v.size() != a.length) {
      return false;
    }
    for (int i = 0; i < a.length; i++) {
      final Object o = a[i];
      if (!o.equals(v.elementAt(i))) {
        return false;
      }
    }
    return true;
  }
454885
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;
}
249253
function(a) {
                    for(var i=0; i<a.length; i++)
                        if(!a[i].equals(0)) return i;
                }
1035904
public final static boolean objectEquals(Object a, Object b) {
        return a == null ?
                b == null ? true : false :
                    b == null ? false : a.equals(b);
    }
1052660
function equals(first, second){

		//If are the same instance, true
		if (first === second)
			return true;
			
		//If values are equals, return true
		if (first == second)
			return true;
			
		//If different type, false
		if (typeof first != typeof second)
			return false;
			
		//If are not objects, check value
		if (typeof first != "object")
			return first == second;
			
		//For each property on first
		for (var current in first){
		
			//Get property value from each element
			var firstValue = first[current];
			var secondValue = second[current];
			
			//If current is object, invoke "Equals" on each 
			//member of the object; otherwise just check values
			var isEqual = (typeof firstValue === 'object') ? equals(firstValue, secondValue) : firstValue == secondValue;
			
			//If not equals, exit
			if (!isEqual)
				return false;
		}
		
		//Confirm
		return true;	
	}
1094562
private static boolean numbersEqual(Number a, Number b) {
        if (a.equals(b)) {
            return true;
        }
        if (a.doubleValue() == b.doubleValue()) {
            return true;
        }
        return false;
    }