Skip to content

Commit b9737c4

Browse files
authored
fix(deps): remove timsort (#1946)
Up to the ECMAScript standard `Array.sort` is stable and all the browsers that we polyfill already implement it that way so we don't need timsort anymore.
1 parent b20a26f commit b9737c4

File tree

5 files changed

+3
-25
lines changed

5 files changed

+3
-25
lines changed

lib/network/modules/LayoutEngine.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* on non-hierarchical networks as well. The converse is also possible.
3131
*/
3232
"use strict";
33-
import TimSort from "timsort";
3433
import {
3534
Alea,
3635
deepExtend,
@@ -1506,7 +1505,7 @@ class LayoutEngine {
15061505
result.push(Number(size));
15071506
});
15081507

1509-
TimSort.sort(result, function (a, b) {
1508+
result.sort(function (a, b) {
15101509
return b - a;
15111510
});
15121511

lib/network/modules/components/DirectionStrategy.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* Strategy pattern for usage of direction methods for hierarchical layouts.
55
*/
66

7-
import { sort as timsort } from "timsort";
8-
97
/**
108
* Interface definition for direction strategy classes.
119
*
@@ -184,7 +182,7 @@ class VerticalStrategy extends DirectionInterface {
184182

185183
/** @inheritDoc */
186184
sort(nodeArray) {
187-
timsort(nodeArray, function (a, b) {
185+
nodeArray.sort(function (a, b) {
188186
return a.x - b.x;
189187
});
190188
}
@@ -249,7 +247,7 @@ class HorizontalStrategy extends DirectionInterface {
249247

250248
/** @inheritDoc */
251249
sort(nodeArray) {
252-
timsort(nodeArray, function (a, b) {
250+
nodeArray(function (a, b) {
253251
return a.y - b.y;
254252
});
255253
}

package-lock.json

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
"@egjs/hammerjs": "^2.0.0",
9898
"component-emitter": "^1.3.0",
9999
"keycharm": "^0.2.0 || ^0.3.0 || ^0.4.0",
100-
"timsort": "^0.3.0",
101100
"uuid": "^3.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
102101
"vis-data": "^6.3.0 || ^7.0.0",
103102
"vis-util": "^5.0.1"
@@ -113,7 +112,6 @@
113112
"@types/chai": "4.3.6",
114113
"@types/mocha": "10.0.2",
115114
"@types/sinon": "10.0.18",
116-
"@types/timsort": "0.3.1",
117115
"@types/uuid": "9.0.4",
118116
"compare-versions": "5.0.3",
119117
"component-emitter": "1.3.0",
@@ -137,7 +135,6 @@
137135
"sinon": "16.1.0",
138136
"snap-shot-it": "7.9.10",
139137
"start-server-and-test": "2.0.1",
140-
"timsort": "0.3.0",
141138
"tmp-promise": "3.0.2",
142139
"uuid": "9.0.1",
143140
"vis-data": "7.1.7",

rollup.build.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default generateRollupConfiguration({
1010
"vis-data": "vis",
1111
"vis-util": "vis",
1212
keycharm: "keycharm",
13-
timsort: "timsort",
1413
uuid: "uuid",
1514
},
1615
header: { name: "vis-network" },

0 commit comments

Comments
 (0)