@ -6,19 +6,10 @@ This library compares two arrays or objects and return a complete diff of their
@@ -6,19 +6,10 @@ This library compares two arrays or objects and return a complete diff of their
## WHY YOU SHOULD USE THIS LIB
All other existing solutions return a weird diff format which often require an additional parsing. They are also slow and limited to object comparison. 👎
All other existing solutions return a weird diff format which often require an additional parsing. They are also limited to object comparison. 👎
**Superdiff** gives you a complete diff for both array <u>and</u> objects with a very readable format. Last but not least, it's battled tested and super fast. Import. Enjoy. 👍
**Benchmark**:
| Objects | Deep-diff 🐢 | Superdiff ⚡ |
| --------- | ------------ | ------------ |
| 1.000 | 10.47ms | 5.73ms |
| 10.000 | 43.05ms | 18.60ms |
| 100.000 | 289.71ms | 50.96ms |
| 1.000.000 | 2786.70ms | 389.78ms |
## DIFF FORMAT COMPARISON
Let's compare the diff format of **Superdiff** and **Deep-diff**, the most popular diff lib on npm:
granularity?: "basic" | "deep" // basic by default
granularity?: "basic" | "deep" // "basic" by default
}
}
```
- `ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be considered as `equal`, because the two arrays have the same value, just not in the same order.
- `showOnly`: gives you the option to only return the values whose status interest you. It has two parameters:
- `showOnly`: only returns the values whose status interest you. It has two parameters:
- `statuses`: status you want to see in the output (ex: `["added", "equal"]`)
- `granularity`:
- `basic` only returns the main properties whose status match your request, without taking into account their eventual subproperties.
- `deep`return main properties whose status match your request but also their relevant subproperties.
- `basic` only returns the main properties whose status match your request.
- `deep`can return main properties if some of their subproperties' status match your request. The subproperties will be filtered accordingly.
### getListDiff()
@ -219,6 +211,8 @@ type ListDiff = {
@@ -219,6 +211,8 @@ type ListDiff = {
**Options**
You can add a third `options` parameter to `getListDiff`.
"description":"SuperDiff checks the changes between two objects or arrays. It returns a complete diff with relevant information for each property or piece of data",