1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- "use strict";
- 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;
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ0b1N0cmluZyIsIk9iamVjdCIsInByb3RvdHlwZSIsImVxdWFsT2JqZWN0cyIsImEiLCJiIiwiY2FsbCIsIkFycmF5IiwiaXNBcnJheSIsImxlbmd0aCIsImkiLCJrZXlzIiwia2V5IiwibW9kdWxlIiwiZXhwb3J0cyJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9MaXZlUXVlcnkvZXF1YWxPYmplY3RzLmpzIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b1N0cmluZyA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7XG5cbi8qKlxuICogRGV0ZXJtaW5lcyB3aGV0aGVyIHR3byBvYmplY3RzIHJlcHJlc2VudCB0aGUgc2FtZSBwcmltaXRpdmUsIHNwZWNpYWwgUGFyc2VcbiAqIHR5cGUsIG9yIGZ1bGwgUGFyc2UgT2JqZWN0LlxuICovXG5mdW5jdGlvbiBlcXVhbE9iamVjdHMoYSwgYikge1xuICBpZiAodHlwZW9mI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