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
+10-2
Original file line number
Diff line number
Diff line change
@@ -104,12 +104,12 @@ type ObjectDiff = {
104
104
diff:Diff[];
105
105
};
106
106
107
-
/** recursive diff in case of subproperties */
108
107
typeDiff= {
109
108
property:string;
110
109
previousValue:unknown;
111
110
currentValue:unknown;
112
111
status:"added"|"deleted"|"equal"|"updated";
112
+
// recursive diff in case of subproperties
113
113
diff?:Diff[];
114
114
};
115
115
```
@@ -314,6 +314,8 @@ import { streamListDiff } from "@donedeal0/superdiff/client";
314
314
315
315
Streams the diff of two object lists, ideal for large lists and maximum performance.
316
316
317
+
ℹ️ `streamListDiff` requires ESM support. For browser usage, it will work out of the box if you use a modern bundler (Webpack, Rollup) or JavaScript framework (Next.js, Vue.js). For Node.js, just add `"type": "module"` in your package.json.
318
+
317
319
#### FORMAT
318
320
319
321
**Input**
@@ -330,6 +332,7 @@ Streams the diff of two object lists, ideal for large lists and maximum performa
330
332
showOnly?: ("added"|"deleted"|"moved"|"updated"|"equal")[], // [] by default
331
333
chunksSize?:number, // 0 by default
332
334
considerMoveAsUpdate?:boolean; // false by default
335
+
useWorker?:boolean// true by default
333
336
}
334
337
```
335
338
@@ -344,7 +347,9 @@ Streams the diff of two object lists, ideal for large lists and maximum performa
344
347
options: {
345
348
showOnly?: ("added"|"deleted"|"moved"|"updated"|"equal")[], // [] by default
346
349
chunksSize?:number, // 0 by default
347
-
considerMoveAsUpdate?:boolean; // false by default
350
+
considerMoveAsUpdate?:boolean, // false by default
351
+
useWorker?:boolean// true by default
352
+
348
353
}
349
354
```
350
355
@@ -355,6 +360,9 @@ Streams the diff of two object lists, ideal for large lists and maximum performa
355
360
-`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).
356
361
-`showOnly` gives you the option to return only the values whose status you are interested in (e.g. `["added", "equal"]`).
357
362
-`considerMoveAsUpdate`: if set to `true` a `moved` value will be considered as `updated`.
363
+
-`useWorker`: if set to `true`, the diff will be run in a worker for maximum performance. Only recommended for large lists (e.g. +100,000 items).
364
+
365
+
> ⚠️ Warning: using Readable streams in NodeJS may impact workers' performance since they need to be converted to arrays. Consider using arrays or files for optimal performance. Alternatively, you can turn the `useWorker` option off.
0 commit comments