module.exports = function () {
    var isEqual = function (object1, object2) {
        const keys1 = Object.keys(object1).sort();
        const keys2 = Object.keys(object2).sort();

        if (keys1.length !== keys2.length) {
           /* console.log("length : " + keys1 + " " + keys2);*/
            return false;
        }

        for (const key of keys1) {
            const val1 = object1[key];
            const val2 = object2[key];
            const areObjects = isObject(val1) && isObject(val2);
            if ((areObjects && !isEqual(val1, val2)) || (!areObjects && isEqualValue(val1, val2))) {
                //console.log("value Not Equal : ");
                //console.log(val1);
                //console.log(val2);
                //console.log("---------------");
                return false;
            }
        }

        return true;
    }
    var isObject = function (object) {
        return object != null && typeof object === 'object';
    }
    var isEqualValue = function (val1, val2) {
        return val1 !== val2;
    }
    return {
        isEqual: isEqual
    }
}();