Skip to content

Commit 62dae97

Browse files
committed
fix: update dependencies
1 parent 47d8ba7 commit 62dae97

File tree

4 files changed

+33
-32
lines changed

4 files changed

+33
-32
lines changed

.github/workflows/nodejs-ts.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ jobs:
1111
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
1212
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
1313
with:
14-
node-version-matrix: '[16, 18]'
1514
lint-check-types: true

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"check-types": "tsc --noEmit",
1919
"eslint": "eslint src --ext ts --cache",
2020
"eslint-fix": "npm run eslint -- --fix",
21-
"prepublishOnly": "npm run tsc",
21+
"prepack": "npm run tsc",
2222
"prettier": "prettier --check src",
2323
"prettier-write": "prettier --write src",
2424
"test": "npm run test-coverage && npm run eslint",
2525
"test-coverage": "npm run test-only -- --coverage",
2626
"test-only": "jest",
27-
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm",
27+
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm && npm run tsc-types",
2828
"tsc-cjs": "tsc --project tsconfig.cjs.json",
2929
"tsc-esm": "tsc --project tsconfig.esm.json"
3030
},
@@ -48,20 +48,20 @@
4848
"trailingComma": "all"
4949
},
5050
"dependencies": {
51-
"cheminfo-types": "^1.4.0",
51+
"cheminfo-types": "^1.7.2",
5252
"install": "^0.13.0",
53-
"ml-matrix": "^6.10.4",
54-
"ml-spectra-processing": "^12.0.0"
53+
"ml-matrix": "^6.11.0",
54+
"ml-spectra-processing": "^14.2.1"
5555
},
5656
"devDependencies": {
57-
"@types/jest": "^29.5.0",
58-
"eslint": "^8.36.0",
59-
"eslint-config-cheminfo-typescript": "^11.3.1",
60-
"jest": "^29.5.0",
57+
"@types/jest": "^29.5.12",
58+
"eslint": "^8.57.0",
59+
"eslint-config-cheminfo-typescript": "^12.2.0",
60+
"jest": "^29.7.0",
6161
"jest-matcher-deep-close-to": "^3.0.2",
62-
"prettier": "^2.8.7",
63-
"rimraf": "^4.4.1",
64-
"ts-jest": "^29.0.5",
65-
"typescript": "^5.0.2"
62+
"prettier": "^3.2.5",
63+
"rimraf": "^5.0.5",
64+
"ts-jest": "^29.1.2",
65+
"typescript": "^5.4.2"
6666
}
6767
}

src/getShortestPath.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DoubleArray } from 'cheminfo-types';
22
import type { Matrix } from 'ml-matrix';
3-
import { xSequentialFill } from 'ml-spectra-processing';
3+
import { xSequentialFillFromTo } from 'ml-spectra-processing';
44

55
interface GetShortestPathOptions {
66
currUnAssCol: number;
@@ -12,7 +12,7 @@ interface GetShortestPathOptions {
1212
}
1313

1414
export function getShortestPath(options: GetShortestPathOptions) {
15-
let {
15+
const {
1616
currUnAssCol,
1717
dualVariableForColumns,
1818
dualVariableForRows,
@@ -21,28 +21,30 @@ export function getShortestPath(options: GetShortestPathOptions) {
2121
matrix,
2222
} = options;
2323

24-
let nbRows = matrix.rows;
25-
let nbColumns = matrix.columns;
24+
const nbRows = matrix.rows;
25+
const nbColumns = matrix.columns;
2626

27-
let pred = new Float64Array(nbRows);
28-
let scannedColumns = new Float64Array(nbColumns);
29-
let scannedRows = new Float64Array(nbRows);
27+
const pred = new Float64Array(nbRows);
28+
const scannedColumns = new Float64Array(nbColumns);
29+
const scannedRows = new Float64Array(nbRows);
3030

31-
let rows2Scan = Array.from(xSequentialFill({ from: 0, to: nbRows - 1 }));
31+
const rows2Scan = Array.from(
32+
xSequentialFillFromTo({ from: 0, to: nbRows - 1, size: nbRows }),
33+
);
3234
let numRows2Scan = nbRows;
3335

3436
let sink = -1;
3537
let delta = 0;
3638
let curColumn = currUnAssCol;
37-
let shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY);
39+
const shortestPathCost = new Array(nbRows).fill(Number.POSITIVE_INFINITY);
3840
while (sink === -1) {
3941
scannedColumns[curColumn] = 1;
4042
let minVal = Number.POSITIVE_INFINITY;
4143
let closestRowScan = -1;
4244
for (let curRowScan = 0; curRowScan < numRows2Scan; curRowScan++) {
43-
let curRow = rows2Scan[curRowScan];
45+
const curRow = rows2Scan[curRowScan];
4446

45-
let reducedCost =
47+
const reducedCost =
4648
delta +
4749
matrix.get(curRow, curColumn) -
4850
dualVariableForColumns[curColumn] -
@@ -60,7 +62,7 @@ export function getShortestPath(options: GetShortestPathOptions) {
6062
if (!Number.isFinite(minVal)) {
6163
return { dualVariableForColumns, dualVariableForRows, sink, pred };
6264
}
63-
let closestRow = rows2Scan[closestRowScan];
65+
const closestRow = rows2Scan[closestRowScan];
6466
scannedRows[closestRow] = 1;
6567
numRows2Scan -= 1;
6668
rows2Scan.splice(closestRowScan, 1);

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export function linearSumAssignment(
3232
matrix = matrix.transpose();
3333
}
3434

35-
let nbRows = matrix.rows;
36-
let nbColumns = matrix.columns;
35+
const nbRows = matrix.rows;
36+
const nbColumns = matrix.columns;
3737

38-
let matrixDelta = maximaze ? matrix.max() : matrix.min();
38+
const matrixDelta = maximaze ? matrix.max() : matrix.min();
3939
matrix = matrix.subtract(matrixDelta);
4040
if (maximaze) matrix = matrix.mul(-1);
4141

@@ -45,15 +45,15 @@ export function linearSumAssignment(
4545
let dualVariableForRows: DoubleArray = new Float64Array(nbRows);
4646

4747
for (let currUnAssCol = 0; currUnAssCol < nbColumns; currUnAssCol++) {
48-
let currentAugmenting = getShortestPath({
48+
const currentAugmenting = getShortestPath({
4949
matrix,
5050
currUnAssCol,
5151
dualVariableForColumns,
5252
dualVariableForRows,
5353
rowAssignments,
5454
columnAssignments,
5555
});
56-
let { sink, pred } = currentAugmenting;
56+
const { sink, pred } = currentAugmenting;
5757

5858
if (sink === -1) {
5959
return {
@@ -70,7 +70,7 @@ export function linearSumAssignment(
7070
let j = sink;
7171
for (let i = pred[j]; true; i = pred[j]) {
7272
rowAssignments[j] = i;
73-
let h = columnAssignments[i];
73+
const h = columnAssignments[i];
7474
columnAssignments[i] = j;
7575
j = h;
7676
if (i === currUnAssCol) break;

0 commit comments

Comments
 (0)