Sha256: eb469e206280321a3878f2335ec98aa2104a155079d8ed83a23029098dccd215

Contents?: true

Size: 1.15 KB

Versions: 129

Compression:

Stored size: 1.15 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 (!equal(a[key], b[key])) return false;
    }

    return true;
  }

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

Version data entries

129 entries across 86 versions & 11 rubygems

Version Path
trusty-cms-6.3.1 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.51 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.50 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.49 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.48 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.47 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.46 node_modules/fast-deep-equal/index.js
pcp-server-ruby-sdk-0.0.6 node_modules/fast-deep-equal/index.js
pcp-server-ruby-sdk-0.1.0 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.45 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.44 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.43 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.42 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.41 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.40 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.39 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.38 node_modules/fast-deep-equal/index.js
optimacms-0.1.61 spec/dummy/node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.32 node_modules/fast-deep-equal/index.js
immosquare-cleaner-0.1.31 node_modules/fast-deep-equal/index.js