Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed May 9, 2024
1 parent c5a64bf commit 484cea4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@
},
"homepage": "https://github.com/mljs/conrec#readme",
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
"@babel/preset-typescript": "^7.21.4",
"@types/jest": "^29.5.1",
"eslint": "^8.38.0",
"eslint-config-cheminfo-typescript": "^11.3.1",
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@types/jest": "^29.5.12",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^12.4.0",
"esm": "^3.2.25",
"jcampconverter": "^9.1.1",
"jest": "^29.5.0",
"prettier": "^2.8.7",
"rimraf": "^5.0.0",
"typescript": "^5.0.4"
"jcampconverter": "^9.6.4",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"typescript": "^5.4.5"
},
"dependencies": {
"cheminfo-types": "^1.7.1"
"cheminfo-types": "^1.7.3"
}
}
16 changes: 8 additions & 8 deletions src/ContourBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export class ContourBuilder {
}
if (ma === null && mb === null) {
// both unmatched, add as new sequence
let aa: SequenceNode = { p: a, prev: null, next: null };
let bb: SequenceNode = { p: b, prev: null, next: null };
const aa: SequenceNode = { p: a, prev: null, next: null };
const bb: SequenceNode = { p: b, prev: null, next: null };
aa.next = bb;
bb.prev = aa;
// create sequence element and push onto head of main list. The order
Expand Down Expand Up @@ -275,8 +275,8 @@ export class ContourBuilder {
}

function pointsEqual(a: Point, b: Point) {
let x = a.x - b.x;
let y = a.y - b.y;
const x = a.x - b.x;
const y = a.y - b.y;
return x * x + y * y < Number.EPSILON;
}

Expand All @@ -302,16 +302,16 @@ export interface Point {
x: number;
y: number;
}
export type SequenceNode = {
export interface SequenceNode {
p: Point;
next: SequenceNode | null;
prev: SequenceNode | null;
};
}

type Sequence = {
interface Sequence {
head: SequenceNode;
tail: SequenceNode;
next: Sequence | null;
prev: Sequence | null;
closed: boolean;
};
}
6 changes: 3 additions & 3 deletions src/ShapeContourDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export class ShapeContourDrawer {
}

getContour() {
let l: ShapeContour[] = [];
let a = this.contours;
const l: ShapeContour[] = [];
const a = this.contours;
for (let k = 0; k < a.length; k++) {
let s = a[k].s;
let level = a[k].level;
const level = a[k].level;
while (s) {
let h: SequenceNode | null = s.head;
const l2: ShapeContour = { lines: [], level, k };
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/shape.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function parse(string: string) {
.filter((line) => line);

const matrix: number[][] = [];
for (let line of lines) {
for (const line of lines) {
matrix.push(line.split('').map((value: string) => parseInt(value, 10)));
}
return matrix;
Expand Down
14 changes: 7 additions & 7 deletions src/calculateContour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ export function calculateContour(
return true;
}
for (let i = ilb; i < iub; i++) {
let dij = matrix[i][j];
let dij1 = matrix[i][j + 1];
let di1j = matrix[i + 1][j];
let di1j1 = matrix[i + 1][j + 1];
const dij = matrix[i][j];
const dij1 = matrix[i][j + 1];
const di1j = matrix[i + 1][j];
const di1j1 = matrix[i + 1][j + 1];
let min1, min2, max1, max2;
if (dij > dij1) {
min1 = dij1;
Expand All @@ -204,8 +204,8 @@ export function calculateContour(
min2 = di1j;
max2 = di1j1;
}
let dmin = Math.min(min1, min2);
let dmax = Math.max(max1, max2);
const dmin = Math.min(min1, min2);
const dmax = Math.max(max1, max2);
// Ternary operator is now much slower: https://jsbench.me/d5l0dh502g
//let dmin = min1 > min2 ? min2 : min1;
//let dmax = max1 > max2 ? max1 : max2;
Expand Down Expand Up @@ -270,7 +270,7 @@ export function calculateContour(
} else {
m3 = 1;
}
let caseValue = castab[sh[m1] + 1][sh[m2] + 1][sh[m3] + 1];
const caseValue = castab[sh[m1] + 1][sh[m2] + 1][sh[m3] + 1];
if (caseValue !== 0) {
switch (caseValue) {
case 1: // Line between vertices 1 and 2
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export type ContourDrawerName = 'basic' | 'shape';
type ContourDrawerByName<DrawerName extends ContourDrawerName> =
DrawerName extends 'basic' ? BasicContourDrawer : ShapeContourDrawer;

export type DrawContourResult<DrawerName extends ContourDrawerName> = {
export interface DrawContourResult<DrawerName extends ContourDrawerName> {
contours: ReturnType<ContourDrawerByName<DrawerName>['getContour']>;
timeout: boolean;
};
}

export class Conrec {
matrix: Readonly<NumberMatrix>;
Expand Down

0 comments on commit 484cea4

Please sign in to comment.