adapted from react-redux shallowEqual.js https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js
504602
function isSameRef(x, y) {
  if (x === y) {
    return x !== 0 || y !== 0 || 1 / x === 1 / y
  } else {
    return x !== x && y !== y
  }
}
670093
function eventuallyEqual(promise, expected, done) {
    all([
        promise.should.be.fulfilled,
        promise.should.eventually.deep.equal(expected)
    ], done);
}
564417
private static RenderQuality  parseRenderQuality(String val)
   {
      switch (val)
      {
         case "auto":            return RenderQuality.auto;
         case "optimizeQuality": return RenderQuality.optimizeQuality;
         case "optimizeSpeed":   return RenderQuality.optimizeSpeed;
         default:                return null;
      }
   }
377074
function _shallowCopy(component) {
        var clone = {},
            property;

        for (property in component) {
            if (component.hasOwnProperty(property)) {
                clone[property] = component[property];
            }
        }

        return clone;
    }
1274373
function compareScreenshot(path1, path2, compareOpts) {
    var compareOptions = _.extend({}, options, compareOpts || {});

    var deferred = Q.defer();
    // console.log('compareScreenshot - compareOptions:', compareOptions);
    gm.compare(path1, path2, compareOptions, function (err, isEqual, equality /*, raw*/) {
      // console.log('gm compare results:', err, isEqual, equality, raw);
      if (err) { throw err; }
      isEqual ? deferred.resolve(equality) : deferred.reject([path2, ' is not equal to ', path1, ' (tolerance:', compareOptions.tolerance, ', result:', equality, ')'].join(''));
    });
    return deferred.promise;
  }
911072
function mongoEqual(documentValue,queryOperand) {
    if(documentValue instanceof Array) {
        if(!(queryOperand instanceof Array))
            return false
        if(documentValue.length !== queryOperand.length) {
            return false
        } else {
            return documentValue.reduce(function(previousValue, currentValue, index) {
                return previousValue && mongoEqual(currentValue,queryOperand[index])
            }, true)
        }
    } else if(documentValue instanceof Object) {
        if(!(queryOperand instanceof Object))
            return false

        var aKeys = Object.keys(documentValue)
        var bKeys = Object.keys(queryOperand)

        if(aKeys.length !== bKeys.length) {
            return false
        } else {
            for(var n=0; n<aKeys.length; n++) {
                if(aKeys[n] !== bKeys[n]) return false

                var key = aKeys[n]
                var aVal = documentValue[key]
                var bVal = queryOperand[key]

                if(!mongoEqual(aVal,bVal)) {
                    return false
                }
            }
            // else
            return true
        }
    } else {
        if(queryOperand === null) {
            return documentValue === undefined || documentValue === null
        } else {
            return documentValue===queryOperand
        }
    }
}
496402
function objToEquals(obj) {
    var expressions = [];
    for (var col in obj) {
      expressions.push(sql.equal(col, obj[col]));
    }
    return expressions;
  }
457933
function nonSearchParamsEqual(fromAndToState, fromParams, toParams) {
      // Identify whether all the parameters that differ between `fromParams` and `toParams` were search params.
      function notSearchParam(key) {
        return fromAndToState.params[key].location != "search";
      }
      var nonQueryParamKeys = fromAndToState.params.$$keys().filter(notSearchParam);
      var nonQueryParams = pick.apply({}, [fromAndToState.params].concat(nonQueryParamKeys));
      var nonQueryParamSet = new $$UMFP.ParamSet(nonQueryParams);
      return nonQueryParamSet.$$equals(fromParams, toParams);
    }
621057
function isEqualWith (obj1, obj2, func) {
  if (isFunction(func)) {
    return equalCompare(obj1, obj2, function (v1, v2, key, obj1, obj2) {
      var result = func(v1, v2, key, obj1, obj2)
      return isUndefined(result) ? defaultCompare(v1, v2) : !!result
    }, func)
  }
  return equalCompare(obj1, obj2, defaultCompare)
}
372277
def _comparison(self, op, value):
    
    # NOTE: This is also used by query.gql().
    if not self._indexed:
      raise datastore_errors.BadFilterError(
          'Cannot query for unindexed property %s' % self._name)
    from .query import FilterNode  # Import late to avoid circular imports.
    if value is not None:
      value = self._do_validate(value)
      value = self._call_to_base_type(value)
      value = self._datastore_type(value)
    return FilterNode(self._name, op, value)
1018188
function parseQuality(rawQuality) {
  const defaultQuality = 100
  if (typeof rawQuality !== 'number') {
    return defaultQuality
  }
  const quality = parseInt(rawQuality)
  return quality > 0 && quality <= 100 ? quality : defaultQuality
}
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;
}
1208117
function isMatch (obj, source) {
  var objKeys = objectKeys(obj)
  var sourceKeys = objectKeys(source)
  if (sourceKeys.length) {
    if (XEUtils.includeArrays(objKeys, sourceKeys)) {
      return XEUtils.some(sourceKeys, function (key2) {
        return findIndexOf(objKeys, function (key1) {
          return key1 === key2 && isEqual(obj[key1], source[key2])
        }) > -1
      })
    }
  } else {
    return true
  }
  return isEqual(obj, source)
}
1327369
function lookupQualifiedType(qname) {
	var t = type_env.get(qname)
	if (!t)
		throw new TypeError("Unresolved type: " + qname)
	return t;
}
176621
function shallowEqual(objA, objB) {
  if (isSameRef(objA, objB)) {
    return true
  }

  if (
    typeof objA !== 'object' ||
    objA === null ||
    typeof objB !== 'object' ||
    objB === null
  ) {
    return false
  }

  const keysA = Object.keys(objA)
  const keysB = Object.keys(objB)

  if (keysA.length !== keysB.length) {
    return false
  }

  for (let k of keysA) {
    if (!objB.hasOwnProperty(k)) {
      return false
    } else if (!isSameRef(objA[k], objB[k])) {
      return false
    }
  }

  return true
}
1362546
function eq(a, b, aStack, bStack, customTesters) {
    var result = true;

    var asymmetricResult = asymmetricMatch(a, b);
    if (!j$.util.isUndefined(asymmetricResult)) {
      return asymmetricResult;
    }

    for (var i = 0; i < customTesters.length; i++) {
      var customTesterResult = customTesters[i](a, b);
      if (!j$.util.isUndefined(customTesterResult)) {
        return customTesterResult;
      }
    }

    if (a instanceof Error && b instanceof Error) {
      return a.message == b.message;
    }

    // Identical objects are equal. `0 === -0`, but they aren't identical.
    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
    if (a === b) { return a !== 0 || 1 / a == 1 / b; }
    // A strict comparison is necessary because `null == undefined`.
    if (a === null || b === null) { return a === b; }
    var className = Object.prototype.toString.call(a);
    if (className != Object.prototype.toString.call(b)) { return false; }
    switch (className) {
      // Strings, numbers, dates, and booleans are compared by value.
      case '[object String]':
        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
        // equivalent to `new String("5")`.
        return a == String(b);
      case '[object Number]':
        // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
        // other numeric values.
        return a != +a ? b != +b : (a === 0 ? 1 / a == 1 / b : a == +b);
      case '[object Date]':
      case '[object Boolean]':
        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
        // millisecond representations. Note that invalid dates with millisecond representations
        // of `NaN` are not equivalent.
        return +a == +b;
      // RegExps are compared by their source patterns and flags.
      case '[object RegExp]':
        return a.source == b.source &&
          a.global == b.global &&
          a.multiline == b.multiline &&
          a.ignoreCase == b.ignoreCase;
    }
    if (typeof a != 'object' || typeof b != 'object') { return false; }

    var aIsDomNode = j$.isDomNode(a);
    var bIsDomNode = j$.isDomNode(b);
    if (aIsDomNode && bIsDomNode) {
      // At first try to use DOM3 method isEqualNode
      if (a.isEqualNode) {
        return a.isEqualNode(b);
      }
      // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
      var aIsElement = a instanceof Element;
      var bIsElement = b instanceof Element;
      if (aIsElement && bIsElement) {
        return a.outerHTML == b.outerHTML;
      }
      if (aIsElement || bIsElement) {
        return false;
      }
      return a.innerText == b.innerText && a.textContent == b.textContent;
    }
    if (aIsDomNode || bIsDomNode) {
      return false;
    }

    // Assume equality for cyclic structures. The algorithm for detecting cyclic
    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
    var length = aStack.length;
    while (length--) {
      // Linear search. Performance is inversely proportional to the number of
      // unique nested structures.
      if (aStack[length] == a) { return bStack[length] == b; }
    }
    // Add the first object to the stack of traversed objects.
    aStack.push(a);
    bStack.push(b);
    var size = 0;
    // Recursively compare objects and arrays.
    // Compare array lengths to determine if a deep comparison is necessary.
    if (className == '[object Array]' && a.length !== b.length) {
      result = false;
    }

    if (result) {
      // Objects with different constructors are not equivalent, but `Object`s
      // from different frames are.
      var aCtor = a.constructor, bCtor = b.constructor;
      if (aCtor !== bCtor && !(isFunction(aCtor) && (aCtor instanceof aCtor) &&
        isFunction(bCtor) && (bCtor instanceof bCtor))) {
        return false;
      }
      // Deep compare objects.
      for (var key in a) {
        if (has(a, key)) {
          // Count the expected number of properties.
          size++;
          // Deep compare each member.
          if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
        }
      }
      // Ensure that both objects contain the same number of properties.
      if (result) {
        for (key in b) {
          if (has(b, key) && !(size--)) { break; }
        }
        result = !size;
      }
    }
    // Remove the first object from the stack of traversed objects.
    aStack.pop();
    bStack.pop();

    return result;

    function has(obj, key) {
      return Object.prototype.hasOwnProperty.call(obj, key);
    }

    function isFunction(obj) {
      return typeof obj === 'function';
    }
  }
1162898
function isDeepEqual(obj1, obj2, isStrict) {
      if (typeof obj1 !== typeof obj2) return false;
      if (isArr(obj1) && isArr(obj2)) {
        if (obj1.length !== obj2.length) return false;
        for (var i = 0; i < obj1.length; i++) {
          if (!isDeepEqual(obj1[i], obj2[i], isStrict)) return false;
        }
        return true;
      }
      else if (isObj(obj1) && isObj(obj2)) {
        if (len(obj1) !== len(obj2)) return false;
        var ks = keys(obj1);
        if (isStrict && !isDeepEqual(ks, keys(obj2))) return false;
        for (var i = 0; i < ks.length; i++) {
          if (
            !has(obj2, ks[i]) || !isDeepEqual(obj1[ks[i]], obj2[ks[i]], isStrict)
          ) return false;
        }
        return true;
      }
      else return obj1 === obj2;
    }