Add LiveQuery

This commit is contained in:
wangmengyan95
2016-03-10 14:27:00 -08:00
parent cf3606246f
commit 555e25bf33
33 changed files with 3580 additions and 48 deletions

View File

@@ -0,0 +1,48 @@
var toString = Object.prototype.toString;
/**
* Determines whether two objects represent the same primitive, special Parse
* type, or full Parse Object.
*/
function equalObjects(a, b) {
if (typeof a !== typeof b) {
return false;
}
if (typeof a !== 'object') {
return (a === b);
}
if (a === b) {
return true;
}
if (toString.call(a) === '[object Date]') {
if (toString.call(b) === '[object Date]') {
return (+a === +b);
}
return false;
}
if (Array.isArray(a)) {
if (Array.isArray(b)) {
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
if (!equalObjects(a[i], b[i])) {
return false;
}
}
return true;
}
return false;
}
if (Object.keys(a).length !== Object.keys(b).length) {
return false;
}
for (var key in a) {
if (!equalObjects(a[key], b[key])) {
return false;
}
}
return true;
}
module.exports = equalObjects;