Skip to content

Commit

Permalink
Replace fast-deep-equal with dequal
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Feb 23, 2024
1 parent ad26c81 commit 387d799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"typescript": "^5.0.0"
},
"dependencies": {
"fast-deep-equal": "^3.1.3"
"dequal": "^2.0.3"
}
}
15 changes: 8 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/diff.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HasUrlObject } from "./model";
import equal from "fast-deep-equal/es6";
import { dequal } from "dequal/lite";

/**
* A special value which indicates that the difference between two objects is Irreconcilable.
Expand Down Expand Up @@ -187,7 +187,7 @@ function diffPrimitive<T extends { [key: string]: any }>(
const yKeys = Object.keys(y);
const deletedKeys = setDifference(xKeys, yKeys);
const addedKeys = setDifference(yKeys, xKeys);
const changedKeys = xKeys.filter((key) => !equal(x[key], y[key]));
const changedKeys = xKeys.filter((key) => !dequal(x[key], y[key]));
const diffKeys = addedKeys.concat(changedKeys);
return {
...Object.fromEntries(deletedKeys.map((key) => [key, undefined])),
Expand Down

0 comments on commit 387d799

Please sign in to comment.