Skip to content

Commit c076e0c

Browse files
committed
feat: replaced fast-deep-equal with a more maintained, esm supported library fast-equals
1 parent c5cdf54 commit c076e0c

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

package-lock.json

+11-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
@@ -36,7 +36,7 @@
3636
"test:all": "jest"
3737
},
3838
"dependencies": {
39-
"fast-deep-equal": "^3.1.3",
39+
"fast-equals": "^5.0.1",
4040
"supercluster": "^8.0.1"
4141
},
4242
"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

3333
export interface GridOptions extends ViewportAlgorithmOptions {
@@ -69,7 +69,7 @@ export class GridAlgorithm extends AbstractViewportAlgorithm {
6969
if (this.state.zoom >= this.maxZoom && state.zoom >= this.maxZoom) {
7070
// still at or beyond maxZoom, no change
7171
} else {
72-
changed = !equal(this.state, state);
72+
changed = !deepEqual(this.state, state);
7373
}
7474
this.state = state;
7575
if (map.getZoom() >= this.maxZoom) {

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

2323
export type SuperClusterOptions = SuperCluster.Options<
2424
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -52,7 +52,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
5252
let changed = false;
5353
const state = { zoom: input.map.getZoom() };
5454

55-
if (!equal(input.markers, this.markers)) {
55+
if (!deepEqual(input.markers, this.markers)) {
5656
changed = true;
5757
// TODO use proxy to avoid copy?
5858
this.markers = [...input.markers];
@@ -74,7 +74,7 @@ export class SuperClusterAlgorithm extends AbstractAlgorithm {
7474

7575
if (!changed) {
7676
if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) {
77-
changed = !equal(this.state, state);
77+
changed = !deepEqual(this.state, state);
7878
}
7979
}
8080

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

3030
export interface SuperClusterViewportOptions
3131
extends SuperClusterOptions,
@@ -77,8 +77,8 @@ export class SuperClusterViewportAlgorithm extends AbstractViewportAlgorithm {
7777
),
7878
};
7979

80-
let changed = !equal(this.state, state);
81-
if (!equal(input.markers, this.markers)) {
80+
let changed = !deepEqual(this.state, state);
81+
if (!deepEqual(input.markers, this.markers)) {
8282
changed = true;
8383
// TODO use proxy to avoid copy?
8484
this.markers = [...input.markers];

0 commit comments

Comments
 (0)