export var Equals;
(function (Equals) {
    /**
     * Compares two arrays to check if they are deeply equal.
     * @param arr1 The first array to compare.
     * @param arr2 The second array to compare.
     * @returns `true` if arrays are deeply equal, `false` otherwise.
     */
    function areArraysEqual(arr1, arr2, equalityFn) {
        const fn = equalityFn ?? (areObjectsEqual);
        if (arr1.length !== arr2.length) {
            return false;
        }
        return arr1.every((item, index) => fn(item, arr2[index]));
    }
    Equals.areArraysEqual = areArraysEqual;
    /**
     * Performs a deep comparison of two objects to determine if they are equal.
     * @param obj1 The first object to compare.
     * @param obj2 The second object to compare.
     * @returns `true` if objects are deeply equal, `false` otherwise.
     */
    function areObjectsEqual(obj1, obj2) {
        if (obj1 === obj2) {
            return true;
        }
        // eslint-disable-next-line no-eq-null
        if (obj1 == null || obj2 == null) {
            return false;
        }
        if (typeof obj1 !== 'object' || typeof obj2 !== 'object') {
            return false;
        }
        const keys1 = Object.keys(obj1);
        const keys2 = Object.keys(obj2);
        if (keys1.length !== keys2.length) {
            return false;
        }
        return keys1.every((key) => isEqual(obj1[key], obj2[key]));
    }
    Equals.areObjectsEqual = areObjectsEqual;
    /**
     * General purpose equality check for any values, including nested objects.
     * @param val1 The first value to compare.
     * @param val2 The second value to compare.
     * @returns `true` if the values are equal, `false` otherwise.
     */
    function isEqual(val1, val2) {
        if (val1 === val2) {
            return true;
        }
        if (typeof val1 === 'object' && typeof val2 === 'object') {
            if (val1 === null || val2 === null) {
                return false;
            }
            return areObjectsEqual(val1, val2);
        }
        return false;
    }
    Equals.isEqual = isEqual;
})(Equals || (Equals = {}));
//# sourceMappingURL=Equals.js.map