Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

react.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. 'use strict';
  2. // do not edit .js files directly - edit src/index.jst
  3. module.exports = function equal(a, b) {
  4. if (a === b) return true;
  5. if (a && b && typeof a == 'object' && typeof b == 'object') {
  6. if (a.constructor !== b.constructor) return false;
  7. var length, i, keys;
  8. if (Array.isArray(a)) {
  9. length = a.length;
  10. if (length != b.length) return false;
  11. for (i = length; i-- !== 0;)
  12. if (!equal(a[i], b[i])) return false;
  13. return true;
  14. }
  15. if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
  16. if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
  17. if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
  18. keys = Object.keys(a);
  19. length = keys.length;
  20. if (length !== Object.keys(b).length) return false;
  21. for (i = length; i-- !== 0;)
  22. if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
  23. for (i = length; i-- !== 0;) {
  24. var key = keys[i];
  25. if (key === '_owner' && a.$$typeof) {
  26. // React-specific: avoid traversing React elements' _owner.
  27. // _owner contains circular references
  28. // and is not needed when comparing the actual elements (and not their owners)
  29. continue;
  30. }
  31. if (!equal(a[key], b[key])) return false;
  32. }
  33. return true;
  34. }
  35. // true if both NaN, false otherwise
  36. return a!==a && b!==b;
  37. };