v3.0.0
New Feature
streamListDiff
now 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
getObjectDiff
code which is now cleaner and more elegant.
Chores
- Update the documentation.
- Create two subbuilds:
client
andserver
to expose an appropriate version ofstreamListDiff
.
BREAKING CHANGE
streamListDiff
is no longer imported from the index, but from@donedeal0/superdiff/server
or@donedeal0/superdiff/client
.