Releases: DoneDeal0/superdiff
v3.1.2
DOCUMENTATION
Add the link to the documentation website: https://superdiff.gitbook.io/donedeal0-superdiff (#33 )
v3.1.1
Bug Fix
- Fix the subpath exports that broke the library import. (#32)
ℹ️ Please refer to the latest release note for information on the new features.
v3.1.0
FEATURE
- Add a
useWorker
option tostreamListDiff
. If set totrue
, the diff will be run in a worker for maximum performance. Only recommended for large lists (e.g. +100,000 items).true
by default.
const diff = streamListDiff(hugeListA, hugeListB, "id", { chunksSize: 100_000, useWorker: true });
pull request #31
BREAKING CHANGES
- Enums standardization
OBJECT_STATUS
becomesObjectStatus
LIST_STATUS
becomesListStatus
GRANULARITY
becomesGranularity
CHORE
- Add a
showWarnings
option tostreamListDiff
- Allow enum and unions for
ListStatus
- Clean models
- Fix
client
andserver
import subpaths - Convert Jest config to Typescript
- Update dev dependencies
- Update
README.md
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
.
v2.1.0
2.1.0
New Feature
- Add a new function
streamListDiff
to stream the diff of two object lists. It is ideal for large lists and maximum performance 🔥 (#26).
Basic usage (see the documentation for more details)
import { streamListDiff } from "@donedeal0/superdiff";
const diff = streamListDiff([], [], "id")
diff.on("data", (chunk) => { console.log(chunk) )}
diff.on("finish", () => console.log("The full diff is available"))
diff.on("error", (err) => console.log(err))
Improvement
- Improve the execution time of
getListDiff
by 55.6% ⚡️(#27).
Chores
- Use SWC to speed up the tests.
- Add aliases (
@models
,@lib
). - Clean devDependencies.
- Restructure the codebase.
- Update the documentation.
v2.0.0
2.0.0 (2024-09-29)
Features
Chore
- pre-commit script
- better linter
- improved CI, automated CD
BREAKING CHANGES
subPropertiesDiff
has been removed from thegetObjectDiff
output. There is now a single recursivediff
key for more simplicity. The types have also been improved.
1.1.3
v1.1.2
v1.1.1
- add
referenceProperty
in theoptions
parameter ofgetListDiff
.referenceProperty
will consider an object to be updated instead of added or deleted if one of its properties remains stable, such as itsid
. This option has no effect on other datatypes. (feature requested in #14)
getListDiff(listA, listB, { referenceProperty: "id" })
- update dev dependencies
- add generic types for
getListDiff
- add typescript documentation to functions
- correct
README.md
grammar and update the documentation
v1.0.9
v1.0.9
- Add the option
showOnly
to filtergetObjectDiff
output by status:
{
ignoreArrayOrder?: boolean // false by default,
showOnly?: {
statuses: ("added" | "deleted" | "updated" | "equal")[], // [] by default
granularity?: "basic" | "deep" // "basic" by default
}
}
-
ignoreArrayOrder
: if set totrue
,["hello", "world"]
and["world", "hello"]
will be considered asequal
, because the two arrays have the same value, just not in the same order. -
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.deep
can return main properties if some of their subproperties' status match your request. The subproperties will be filtered accordingly.
-
Add the option
showOnly
to filtergetListDiff
output by status:
{
showOnly?: ("added" | "deleted" | "moved" | "updated" | "equal")[], // [] by default
}
-
showOnly
gives you the option to only return the values whose status interest you (ex:["added", "equal"]
). -
Upgrade dev dependencies
-
Add more tests
Breaking changes
- in
getObjectDiff
output,subPropertiesDiff.name
is now renamedsubPropertiesDiff.property
. - The option
discardArrayOrder
is now renamedignoreArrayOrder