You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+15-15
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ This library compares two arrays or objects and returns a full diff of their dif
16
16
17
17
## WHY YOU SHOULD USE THIS LIBRARY
18
18
19
-
All other existing solutions return a strange diff format that often requires additional parsing. They are also limited to object comparison.
19
+
Most existing solutions return a confusing diff format that often requires extra parsing. They are also limited to object comparison.
20
20
21
-
**Superdiff**gives you a complete diff for both array <u>and</u> objects in a very readable format. Last but not least, it's battle-tested, has zero dependencies, and is super fast.
21
+
**Superdiff**provides a complete and readable diff for both arrays **and** objects. Plus, it's battle-tested, has zero dependencies, and is super fast.
Compares two objects and return a diff for each value and their potential subvalues. Supports deeply nested objects with any kind of values.
69
+
Compares two objects and returns a diff for each value and its possible subvalues. Supports deeply nested objects of any value type.
70
70
71
71
#### FORMAT
72
72
@@ -87,7 +87,7 @@ options?: {
87
87
-`prevData`: the original object.
88
88
-`nextData`: the new object.
89
89
-`options`
90
-
-`ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays have the same value, just not in the same order.
90
+
-`ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays contain the same values, just in a different order.
91
91
-`showOnly`: returns only the values whose status you are interested in. It takes two parameters:
92
92
93
93
-`statuses`: status you want to see in the output (e.g. `["added", "equal"]`)
@@ -226,8 +226,8 @@ Compares two arrays and returns a diff for each entry. Supports duplicate values
226
226
-`nextList`: the new list.
227
227
-`options`
228
228
-`showOnly` gives you the option to return only the values whose status you are interested in (e.g. `["added", "equal"]`).
229
-
-`referenceProperty` will consider an object to be updated instead of added or deleted if one of its properties remains stable, such as its `id`. This option has no effect on other datatypes.
230
-
-`ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays have the same value, just not in the same order.
229
+
-`referenceProperty` will consider an object to be `updated` rather than `added` or `deleted` if one of its properties remains stable, such as its `id`. This option has no effect on other datatypes.
230
+
-`ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays contain the same values, just in a different order.
231
231
-`considerMoveAsUpdate`: if set to `true` a `moved` value will be considered as `updated`.
232
232
233
233
**Output**
@@ -328,18 +328,18 @@ Streams the diff of two object lists, ideal for large lists and maximum performa
328
328
329
329
- `prevList`: the original object list.
330
330
- `nextList`: the new object list.
331
-
- `referenceProperty`: a common property in all the objects of your lists (e.g. `id`).
331
+
- `referenceProperty`: a property common to all objects in your lists (e.g. `id`).
332
332
- `options`
333
-
- `chunksSize` the number of object diffs returned by each streamed chunk. (e.g. `0` = 1 object diff by chunk, `10` = 10 object diffs by chunk).
333
+
- `chunksSize` the number of object diffs returned by each streamed chunk. (e.g. `0` = 1 object diff per chunk, `10` = 10 object diffs per chunk).
334
334
- `showOnly` gives you the option to return only the values whose status you are interested in (e.g. `["added", "equal"]`).
335
335
- `considerMoveAsUpdate`: if set to `true` a `moved` value will be considered as `updated`.
336
336
337
337
**Output**
338
338
339
-
The objects diff are grouped in arrays - called `chunks` - and are consumed thanks to an event listener. You have access to 3 events:
339
+
The objects diff are grouped into arrays - called `chunks` - and are consumed thanks to an event listener. You have access to 3 events:
340
340
- `data`: to be notified when a new chunk of object diffs is available.
341
-
- `finish`: to be notified when the stream is complete.
342
-
- `error`: to be notified of an error during the stream.
341
+
- `finish`: to be notified when the stream is finished.
342
+
- `error`: to be notified if an error occurs during the stream.
- `b`: the value that will be compared to the value `a`.
460
-
- `ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays have the same value, just not in the same order.
458
+
- `a`: the value to be compared to the value `b`.
459
+
- `b`: the value to be compared to the value `a`.
460
+
- `ignoreArrayOrder`: if set to `true`, `["hello", "world"]` and `["world", "hello"]` will be treated as `equal`, because the two arrays contain the same values, just in a different order.
0 commit comments