MCPcopy Index your code
hub / github.com/parse-community/parse-server / equalObjects

Function equalObjects

src/LiveQuery/equalObjects.js:7–46  ·  view source on GitHub ↗

* Determines whether two objects represent the same primitive, special Parse * type, or full Parse Object.

(a, b)

Source from the content-addressed store, hash-verified

5 * type, or full Parse Object.
6 */
7function equalObjects(a, b) {
8 if (typeof a !== typeof b) {
9 return false;
10 }
11 if (typeof a !== 'object') {
12 return a === b;
13 }
14 if (a === b) {
15 return true;
16 }
17 if (toString.call(a) === '[object Date]') {
18 if (toString.call(b) === '[object Date]') {
19 return +a === +b;
20 }
21 return false;
22 }
23 if (Array.isArray(a)) {
24 if (Array.isArray(b)) {
25 if (a.length !== b.length) {
26 return false;
27 }
28 for (var i = 0; i < a.length; i++) {
29 if (!equalObjects(a[i], b[i])) {
30 return false;
31 }
32 }
33 return true;
34 }
35 return false;
36 }
37 if (Object.keys(a).length !== Object.keys(b).length) {
38 return false;
39 }
40 for (var key in a) {
41 if (!equalObjects(a[key], b[key])) {
42 return false;
43 }
44 }
45 return true;
46}
47
48module.exports = equalObjects;

Callers 1

matchesKeyConstraintsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected