Skip to content

Instantly share code, notes, and snippets.

View anastaciocintra's full-sized avatar
🎯
Focusing

Marco Antonio anastaciocintra

🎯
Focusing
View GitHub Profile
@anastaciocintra
anastaciocintra / Compare two data objects .md
Last active June 26, 2024 20:25
Compare two objects JS

Compare two data objects / arrays in javascript and/or typescript regardless of the order of the data;

When to use:

  • When you need compare two "json" objects to know if it have same data.
  • When the order of the array doesn't matters ie. [1,2] should be equal [2,1], but it is configurable.
  • lightweight - just one small .js file

when not to use:

  • when you need to compare more complex objects, with functions, for example.