MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / equals

Function equals

code/songhop/www/lib/angular/angular.js:892–931  ·  view source on GitHub ↗

* @ngdoc function * @name angular.equals * @module ng * @kind function * * @description * Determines if two objects or two values are equivalent. Supports value types, regular * expressions, arrays and objects. * * Two objects or values are considered equivalent if at least one of the follo

(o1, o2)

Source from the content-addressed store, hash-verified

890 * @returns {boolean} True if arguments are equal.
891 */
892function equals(o1, o2) {
893 if (o1 === o2) return true;
894 if (o1 === null || o2 === null) return false;
895 if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
896 var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
897 if (t1 == t2) {
898 if (t1 == 'object') {
899 if (isArray(o1)) {
900 if (!isArray(o2)) return false;
901 if ((length = o1.length) == o2.length) {
902 for (key = 0; key < length; key++) {
903 if (!equals(o1[key], o2[key])) return false;
904 }
905 return true;
906 }
907 } else if (isDate(o1)) {
908 if (!isDate(o2)) return false;
909 return equals(o1.getTime(), o2.getTime());
910 } else if (isRegExp(o1) && isRegExp(o2)) {
911 return o1.toString() == o2.toString();
912 } else {
913 if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;
914 keySet = {};
915 for (key in o1) {
916 if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
917 if (!equals(o1[key], o2[key])) return false;
918 keySet[key] = true;
919 }
920 for (key in o2) {
921 if (!keySet.hasOwnProperty(key) &&
922 key.charAt(0) !== '$' &&
923 o2[key] !== undefined &&
924 !isFunction(o2[key])) return false;
925 }
926 return true;
927 }
928 }
929 }
930 return false;
931}
932
933var csp = function() {
934 if (isDefined(csp.isActive_)) return csp.isActive_;

Callers 5

cacheStateFunction · 0.70
$RootScopeProviderFunction · 0.70
checkboxInputTypeFunction · 0.70
ngClassWatchActionFunction · 0.70
setupAsMultipleFunction · 0.70

Calls 5

isDateFunction · 0.70
isRegExpFunction · 0.70
isScopeFunction · 0.70
isWindowFunction · 0.70
isFunctionFunction · 0.70

Tested by

no test coverage detected