common-utility-functions
    Preparing search index...

    Function deepEquals

    • Performs a deep equality comparison between two values. Recursively compares objects by their properties and handles primitive values, null, and undefined. Arrays are not specifically handled and will be compared as objects with numeric string keys.

      Parameters

      • obj1: unknown

        The first value to compare (can be object, primitive, null, or undefined)

      • obj2: unknown

        The second value to compare (can be object, primitive, null, or undefined)

      Returns boolean

      True if the values are deeply equal, false otherwise

      // Primitive values
      deepEquals(1, 1); // true
      deepEquals('hello', 'hello'); // true
      deepEquals(null, null); // true

      // Objects
      deepEquals({ a: 1, b: 2 }, { a: 1, b: 2 }); // true
      deepEquals({ a: 1, b: 2 }, { a: 1, b: 3 }); // false

      // Nested objects
      deepEquals(
      { user: { name: 'John', age: 30 } },
      { user: { name: 'John', age: 30 } }
      ); // true

      // Different types
      deepEquals(1, '1'); // false
      deepEquals(null, undefined); // false

      1.0.0