x-deep-object-equal
TypeScript icon, indicating that this package has built-in type declarations

10.0.1 • Public • Published

xDeepObjectEqual is a TypeScript function that allows you to deeply compare two objects for equality. It traverses nested objects and their properties to determine if they are equal.

Installation

To use xDeepObjectEqual, you'll need to include the provided TypeScript file in your project.

  1. Download the xDeepObjectEqual.ts file from this repository.
  2. Add the file to your project directory.

Usage

  1. Import the xDeepObjectEqual class into your TypeScript code:

    import { xDeepObjectEqual } from 'x-deep-object-equal'
    
     const firstObject = {
       a: 1,
       b: {
         c: 2,
         d: {
           e: 3,
         },
       },
     };
    
     const secondObject = {
       a: 1,
       b: {
         c: 2,
         d: {
           e: 3,
         },
       },
       f: 5,
     };
    
    xDeepObjectEqual(firstObject, secondObject);
    // false
  2. Import the xDeepObjectEqual class into your Javascript code:

    const { xDeepObjectEqual } = require("x-deep-object-equal")
    
    xDeepObjectEqual(firstObject, secondObject);
    // false

Support Me

If you find this project helpful or want to show your appreciation, you can support me by buying me a coffee. Your support is greatly appreciated!

Package Sidebar

Install

npm i x-deep-object-equal

Weekly Downloads

0

Version

10.0.1

License

MIT

Unpacked Size

18.6 kB

Total Files

8

Last publish

Collaborators

  • nhutdm198