v3.0.0
New Feature
streamListDiffnow supports array, stream, and file inputs for maximum performance, polyvalence, and optimal memory usage. 🎸🦅 (#28).
Import
// If you are in a server environment
import { streamListDiff } from "@donedeal0/superdiff/server";
// If you are in a browser environment
import { streamListDiff } from "@donedeal0/superdiff/client";Input
You can send streams, file paths, or arrays as input:
If you are in a server environment
// for a simple array
const stream = [{ id: 1, name: "hello" }]
// for a large array
const stream = Readable.from(list, { objectMode: true });
// for a local file
const stream = path.resolve(__dirname, "./list.json");
If you are in a browser environment
// for a simple array
const stream = [{ id: 1, name: "hello" }]
// for a large array
const stream = new ReadableStream({
start(controller) {
list.forEach((value) => controller.enqueue(value));
controller.close();
},
});
// for a local file
const stream = new File([JSON.stringify(file)], "file.json", { type: "application/json" });
// for a file input
const stream = e.target.files[0]; See the documentation for more details.
Improvement
- Improve the execution time of
getObjectDiff⚡️(#30). - Rewrite the
getObjectDiffcode which is now cleaner and more elegant.
Chores
- Update the documentation.
- Create two subbuilds:
clientandserverto expose an appropriate version ofstreamListDiff.
BREAKING CHANGE
streamListDiffis no longer imported from the index, but from@donedeal0/superdiff/serveror@donedeal0/superdiff/client.