UNPKG

matterbridge

Version:
53 lines 2.22 kB
/** * This file contains the deepEqual function. * * @file deepEqual.ts * @author Luca Liguori * @date 2025-02-16 * @version 1.0.0 * * Copyright 2025, 2026, 2027 Luca Liguori. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Performs a deep comparison between two values to determine if they are equivalent. * This comparison includes primitive types, arrays, and objects, allowing for optional * exclusion of specific properties from the comparison in objects. * * @param {any} a The first value to compare. * @param {any} b The second value to compare. * @param {string[]} [excludeProperties=[]] An array of property names to exclude from the comparison in objects. * @returns {boolean} True if the values are deeply equal, excluding any specified properties; otherwise, false. * * Note: This function utilizes recursion for deep comparison of nested structures and includes a debugging * mechanism that can be toggled on or off for detailed comparison logging. It is important to ensure that * objects do not contain circular references when enabling debug logging to avoid infinite loops. * * Example usage: * ``` * const obj1 = { a: 1, b: { c: 2 } }; * const obj2 = { a: 1, b: { c: 2 } }; * console.log(deepEqual(obj1, obj2)); // true * * const arr1 = [1, 2, [3, 4]]; * const arr2 = [1, 2, [3, 4]]; * console.log(deepEqual(arr1, arr2)); // true * * const obj3 = { a: 1, b: { c: 2, d: 3 } }; * const obj4 = { a: 1, b: { c: 2 } }; * console.log(deepEqual(obj3, obj4, ['d'])); // true, excluding property 'd' from comparison * ``` */ export declare function deepEqual(a: any, b: any, excludeProperties?: string[]): boolean; //# sourceMappingURL=deepEqual.d.ts.map