MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / equals

Function equals

OpenReservation/wwwroot/Scripts/angular.js:1026–1070  ·  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 equ

(o1, o2)

Source from the content-addressed store, hash-verified

1024 * @returns {boolean} True if arguments are equal.
1025 */
1026 function equals(o1, o2) {
1027 if (o1 === o2) return true;
1028 if (o1 === null || o2 === null) return false;
1029 if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
1030 var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
1031 if (t1 == t2 && t1 == 'object') {
1032 if (isArray(o1)) {
1033 if (!isArray(o2)) return false;
1034 if ((length = o1.length) == o2.length) {
1035 for (key = 0; key < length; key++) {
1036 if (!equals(o1[key], o2[key])) return false;
1037 }
1038 return true;
1039 }
1040 } else if (isDate(o1)) {
1041 if (!isDate(o2)) return false;
1042 return equals(o1.getTime(), o2.getTime());
1043 } else if (isRegExp(o1)) {
1044 if (!isRegExp(o2)) return false;
1045 return o1.toString() == o2.toString();
1046 } else {
1047 if (isScope(o1) ||
1048 isScope(o2) ||
1049 isWindow(o1) ||
1050 isWindow(o2) ||
1051 isArray(o2) ||
1052 isDate(o2) ||
1053 isRegExp(o2)) return false;
1054 keySet = createMap();
1055 for (key in o1) {
1056 if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
1057 if (!equals(o1[key], o2[key])) return false;
1058 keySet[key] = true;
1059 }
1060 for (key in o2) {
1061 if (!(key in keySet) &&
1062 key.charAt(0) !== '$' &&
1063 isDefined(o2[key]) &&
1064 !isFunction(o2[key])) return false;
1065 }
1066 return true;
1067 }
1068 }
1069 return false;
1070 }
1071
1072 var csp = function () {
1073 if (!isDefined(csp.rules)) {

Callers 6

cacheStateFunction · 0.85
$RootScopeProviderFunction · 0.85
checkboxInputTypeFunction · 0.85
ngClassWatchActionFunction · 0.85
updateOptionsFunction · 0.85
selectPreLinkFunction · 0.85

Calls 7

isDateFunction · 0.85
isRegExpFunction · 0.85
isScopeFunction · 0.85
isWindowFunction · 0.85
createMapFunction · 0.85
isFunctionFunction · 0.85
isDefinedFunction · 0.85

Tested by

no test coverage detected