Skip to content

Commit b3915fb

Browse files
feat: replaced fast-deep-equal with fast-equals (#893)
* feat: replaced fast-deep-equal with a more maintained, esm supported library fast-equals * chore: update fast-equals package version * chore: update package-lock.json --------- Co-authored-by: byt3sage <[email protected]> Co-authored-by: Martin Schuhfuss <[email protected]>
1 parent 644fbdc commit b3915fb

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

package-lock.json

+12-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"test:all": "jest"
3838
},
3939
"dependencies": {
40-
"fast-deep-equal": "^3.1.3",
40+
"fast-equals": "^5.2.2",
4141
"supercluster": "^8.0.1"
4242
},
4343
"devDependencies": {

src/algorithms/grid.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from "./utils";
2828

2929
import { Cluster } from "../cluster";
30-
import equal from "fast-deep-equal";
30+
import { deepEqual } from "fast-equals";
3131
import { MarkerUtils, Marker } from "../marker-utils";
3232
import { assertNotNull } from "../utils";
3333

@@ -74,7 +74,7 @@ export class GridAlgorithm extends AbstractViewportAlgorithm {
7474
if (this.state.zoom >= this.maxZoom && newState.zoom >= this.maxZoom) {
7575
// still at or beyond maxZoom, no change
7676
} else {
77-
changed = !equal(this.state, newState);
77+
changed = !deepEqual(this.state, newState);
7878
}
7979

8080
this.state = newState;

src/algorithms/supercluster.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { AbstractAlgorithm, AlgorithmInput, AlgorithmOutput } from "./core";
1818
import SuperCluster, { ClusterFeature } from "supercluster";
1919
import { MarkerUtils, Marker } from "../marker-utils";
2020
import { Cluster } from "../cluster";
21-
import equal from "fast-deep-equal";
21+
import { deepEqual } from "fast-equals";
2222
import { assertNotNull } from "../utils";
2323

2424
export type SuperClusterOptions = SuperCluster.Options<
@@ -57,7 +57,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
5757

5858
const state = { zoom: zoom };
5959

60-
if (!equal(input.markers, this.markers)) {
60+
if (!deepEqual(input.markers, this.markers)) {
6161
changed = true;
6262
// TODO use proxy to avoid copy?
6363
this.markers = [...input.markers];
@@ -79,7 +79,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
7979

8080
if (!changed) {
8181
if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) {
82-
changed = !equal(this.state, state);
82+
changed = !deepEqual(this.state, state);
8383
}
8484
}
8585

src/algorithms/superviewport.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import SuperCluster, { ClusterFeature } from "supercluster";
2525
import { MarkerUtils, Marker } from "../marker-utils";
2626
import { Cluster } from "../cluster";
2727
import { getPaddedViewport } from "./utils";
28-
import equal from "fast-deep-equal";
28+
import { deepEqual } from "fast-equals";
2929
import { assertNotNull } from "../utils";
3030

3131
export interface SuperClusterViewportOptions
@@ -71,8 +71,8 @@ export class SuperClusterViewportAlgorithm extends AbstractViewportAlgorithm {
7171
public calculate(input: AlgorithmInput): AlgorithmOutput {
7272
const state = this.getViewportState(input);
7373

74-
let changed = !equal(this.state, state);
75-
if (!equal(input.markers, this.markers)) {
74+
let changed = !deepEqual(this.state, state);
75+
if (!deepEqual(input.markers, this.markers)) {
7676
changed = true;
7777
// TODO use proxy to avoid copy?
7878
this.markers = [...input.markers];

0 commit comments

Comments
 (0)