Skip to content

Commit

Permalink
fix(deps): remove timsort (#1946)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Thomaash authored Oct 6, 2023
1 parent b20a26f commit b9737c4
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 25 deletions.
3 changes: 1 addition & 2 deletions lib/network/modules/LayoutEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* on non-hierarchical networks as well. The converse is also possible.
*/
"use strict";
import TimSort from "timsort";
import {
Alea,
deepExtend,
Expand Down Expand Up @@ -1506,7 +1505,7 @@ class LayoutEngine {
result.push(Number(size));
});

TimSort.sort(result, function (a, b) {
result.sort(function (a, b) {
return b - a;
});

Expand Down
6 changes: 2 additions & 4 deletions lib/network/modules/components/DirectionStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Strategy pattern for usage of direction methods for hierarchical layouts.
*/

import { sort as timsort } from "timsort";

/**
* Interface definition for direction strategy classes.
*
Expand Down Expand Up @@ -184,7 +182,7 @@ class VerticalStrategy extends DirectionInterface {

/** @inheritDoc */
sort(nodeArray) {
timsort(nodeArray, function (a, b) {
nodeArray.sort(function (a, b) {
return a.x - b.x;
});
}
Expand Down Expand Up @@ -249,7 +247,7 @@ class HorizontalStrategy extends DirectionInterface {

/** @inheritDoc */
sort(nodeArray) {
timsort(nodeArray, function (a, b) {
nodeArray(function (a, b) {
return a.y - b.y;
});
}
Expand Down
15 changes: 0 additions & 15 deletions package-lock.json

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

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"@egjs/hammerjs": "^2.0.0",
"component-emitter": "^1.3.0",
"keycharm": "^0.2.0 || ^0.3.0 || ^0.4.0",
"timsort": "^0.3.0",
"uuid": "^3.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
"vis-data": "^6.3.0 || ^7.0.0",
"vis-util": "^5.0.1"
Expand All @@ -113,7 +112,6 @@
"@types/chai": "4.3.6",
"@types/mocha": "10.0.2",
"@types/sinon": "10.0.18",
"@types/timsort": "0.3.1",
"@types/uuid": "9.0.4",
"compare-versions": "5.0.3",
"component-emitter": "1.3.0",
Expand All @@ -137,7 +135,6 @@
"sinon": "16.1.0",
"snap-shot-it": "7.9.10",
"start-server-and-test": "2.0.1",
"timsort": "0.3.0",
"tmp-promise": "3.0.2",
"uuid": "9.0.1",
"vis-data": "7.1.7",
Expand Down
1 change: 0 additions & 1 deletion rollup.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default generateRollupConfiguration({
"vis-data": "vis",
"vis-util": "vis",
keycharm: "keycharm",
timsort: "timsort",
uuid: "uuid",
},
header: { name: "vis-network" },
Expand Down

0 comments on commit b9737c4

Please sign in to comment.