Sha256: 0594701665fcfaa40ff9ae40f086ec107b74d6f5360f0b2cae45841e75b515cc

Contents?: true

Size: 920 Bytes

Versions: 7

Compression:

Stored size: 920 Bytes

Contents

var hasOwn = require('./hasOwn');
var every = require('./every');
var isObject = require('../lang/isObject');

    function defaultCompare(a, b) {
        return a === b;
    }

    // Makes a function to compare the object values from the specified compare
    // operation callback.
    function makeCompare(callback) {
        return function(value, key) {
            return hasOwn(this, key) && callback(value, this[key]);
        };
    }

    function checkProperties(value, key) {
        return hasOwn(this, key);
    }

    /**
     * Checks if two objects have the same keys and values.
     */
    function equals(a, b, callback) {
        callback = callback || defaultCompare;

        if (!isObject(a) || !isObject(b)) {
            return callback(a, b);
        }

        return (every(a, makeCompare(callback), b) &&
                every(b, checkProperties, a));
    }

    module.exports = equals;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/mout/object/equals.js