Sha256: 37cbd168dbd42c73119ce7326556bddef40b3a5fbd2e215cf81a7c78fb73ff9a

Contents?: true

Size: 1.42 KB

Versions: 140

Compression:

Stored size: 1.42 KB

Contents

'use strict';

// do not edit .js files directly - edit src/index.jst



module.exports = function equal(a, b) {
  if (a === b) return true;

  if (a && b && typeof a == 'object' && typeof b == 'object') {
    if (a.constructor !== b.constructor) return false;

    var length, i, keys;
    if (Array.isArray(a)) {
      length = a.length;
      if (length != b.length) return false;
      for (i = length; i-- !== 0;)
        if (!equal(a[i], b[i])) return false;
      return true;
    }



    if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
    if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
    if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();

    keys = Object.keys(a);
    length = keys.length;
    if (length !== Object.keys(b).length) return false;

    for (i = length; i-- !== 0;)
      if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;

    for (i = length; i-- !== 0;) {
      var key = keys[i];

      if (key === '_owner' && a.$$typeof) {
        // React-specific: avoid traversing React elements' _owner.
        //  _owner contains circular references
        // and is not needed when comparing the actual elements (and not their owners)
        continue;
      }

      if (!equal(a[key], b[key])) return false;
    }

    return true;
  }

  // true if both NaN, false otherwise
  return a!==a && b!==b;
};

Version data entries

140 entries across 97 versions & 11 rubygems

Version Path
tang-0.2.1 spec/tang_app/node_modules/fast-deep-equal/react.js
trusty-cms-4.2.2 node_modules/fast-deep-equal/react.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/fast-deep-equal/react.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/fast-deep-equal/react.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/fast-deep-equal/react.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/fast-deep-equal/react.js
trusty-cms-4.2.1 node_modules/fast-deep-equal/react.js
trusty-cms-4.2 node_modules/fast-deep-equal/react.js
trusty-cms-4.1.9 node_modules/fast-deep-equal/react.js
trusty-cms-4.1.8 node_modules/fast-deep-equal/react.js
tang-0.2.0 spec/tang_app/node_modules/fast-deep-equal/react.js
trusty-cms-4.1.7 node_modules/fast-deep-equal/react.js
tang-0.1.0 spec/tang_app/node_modules/fast-deep-equal/react.js
tang-0.0.9 spec/tang_app/node_modules/fast-deep-equal/react.js
trusty-cms-4.1.6 node_modules/fast-deep-equal/react.js
trusty-cms-4.1.5 node_modules/fast-deep-equal/react.js
enju_library-0.3.8 spec/dummy/node_modules/fast-deep-equal/react.js
ilog-0.4.1 node_modules/fast-deep-equal/react.js
ilog-0.4.0 node_modules/fast-deep-equal/react.js
ilog-0.3.3 node_modules/fast-deep-equal/react.js