diff --git a/package.json b/package.json index 86586d8..4e295fb 100644 --- a/package.json +++ b/package.json @@ -38,22 +38,22 @@ }, "homepage": "https://github.com/mljs/signal-processing#readme", "devDependencies": { - "@types/jest": "^29.5.0", - "eslint": "^8.36.0", - "eslint-config-cheminfo-typescript": "^11.3.1", - "jest": "^29.5.0", + "@types/jest": "^29.5.12", + "eslint": "^8.57.0", + "eslint-config-cheminfo-typescript": "^12.2.0", + "jest": "^29.7.0", "jest-matcher-deep-close-to": "^3.0.2", - "prettier": "^2.8.7", - "rimraf": "^4.4.1", - "ts-jest": "^29.0.5", - "typescript": "^5.0.2", - "typescript-json-schema": "^0.55.0" + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "ts-jest": "^29.1.2", + "typescript": "^5.4.2", + "typescript-json-schema": "^0.63.0" }, "dependencies": { - "baselines": "^1.1.5", - "cheminfo-types": "^1.4.0", - "ml-gsd": "^12.1.3", + "baselines": "^1.1.7", + "cheminfo-types": "^1.7.2", + "ml-gsd": "^12.1.5", "ml-savitzky-golay-generalized": "^4.0.1", - "ml-spectra-processing": "^12.0.0" + "ml-spectra-processing": "^14.2.0" } } diff --git a/src/filterMatrix.ts b/src/filterMatrix.ts index 08793ce..5719caf 100644 --- a/src/filterMatrix.ts +++ b/src/filterMatrix.ts @@ -8,7 +8,7 @@ export function filterMatrix( // eslint-disable-next-line @typescript-eslint/no-unused-vars filters: FilterMatrixType[], ) { - let result = { + const result = { data: matrix, }; diff --git a/src/filterXY.ts b/src/filterXY.ts index 3ddf79b..6131185 100644 --- a/src/filterXY.ts +++ b/src/filterXY.ts @@ -15,7 +15,7 @@ export function filterXY(data: DataXY, filters: FilterXYType[]) { const logs = []; - for (let filter of filters) { + for (const filter of filters) { const start = Date.now(); // eslint-disable-next-line import/namespace const filterFct = Filters[filter.name]; diff --git a/src/filters/sg/__tests__/firstDerivative.test.ts b/src/filters/sg/__tests__/firstDerivative.test.ts index a4a141a..6e4b525 100644 --- a/src/filters/sg/__tests__/firstDerivative.test.ts +++ b/src/filters/sg/__tests__/firstDerivative.test.ts @@ -6,7 +6,7 @@ import { firstDerivative } from '../firstDerivative'; expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); test('firstDerivative', () => { - let result = firstDerivative(linear); + const result = firstDerivative(linear); expect(result.data).toMatchCloseTo({ x: Float64Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9]), y: Float64Array.from([ diff --git a/src/filters/sg/__tests__/savitzkyGolay.test.ts b/src/filters/sg/__tests__/savitzkyGolay.test.ts index b434b49..2244b01 100644 --- a/src/filters/sg/__tests__/savitzkyGolay.test.ts +++ b/src/filters/sg/__tests__/savitzkyGolay.test.ts @@ -6,7 +6,7 @@ import { savitzkyGolay } from '../savitzkyGolay'; expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); test('savitzkyGolay', () => { - let result = savitzkyGolay(linear, { + const result = savitzkyGolay(linear, { derivative: 1, }); expect(result.data).toMatchCloseTo({ diff --git a/src/filters/sg/__tests__/secondDerivative.test.ts b/src/filters/sg/__tests__/secondDerivative.test.ts index 75c3fd3..2e5b708 100644 --- a/src/filters/sg/__tests__/secondDerivative.test.ts +++ b/src/filters/sg/__tests__/secondDerivative.test.ts @@ -6,7 +6,7 @@ import { secondDerivative } from '../secondDerivative'; expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); test('secondDerivative', () => { - let result = secondDerivative(linear); + const result = secondDerivative(linear); expect(result.data).toMatchCloseTo({ x: Float64Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9]), y: Float64Array.from([ diff --git a/src/filters/sg/__tests__/thirdDerivate.test.ts b/src/filters/sg/__tests__/thirdDerivate.test.ts index 6ae644a..b055a43 100644 --- a/src/filters/sg/__tests__/thirdDerivate.test.ts +++ b/src/filters/sg/__tests__/thirdDerivate.test.ts @@ -6,7 +6,7 @@ import { thirdDerivative } from '../thirdDerivative'; expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); test('thirdDerivative', () => { - let result = thirdDerivative(linear); + const result = thirdDerivative(linear); expect(result.data).toMatchCloseTo({ x: Float64Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9]), y: Float64Array.from([0, 0, 0, 0, 0, 0, 0, 0, 0]), diff --git a/src/filters/x/__tests__/calibrateX.test.ts b/src/filters/x/__tests__/calibrateX.test.ts index 6e27c9b..1c79939 100644 --- a/src/filters/x/__tests__/calibrateX.test.ts +++ b/src/filters/x/__tests__/calibrateX.test.ts @@ -6,12 +6,12 @@ expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); describe('calibrateX', () => { it('undefined params', () => { - let data = { + const data = { x: Float64Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]), y: Float64Array.from([1, 1, 1, 1, 1, 1, 700, 1, 1, 1, 1, 1, 1]), }; - let shifted = calibrateX(data); + const shifted = calibrateX(data); expect(shifted.data.x).toMatchCloseTo( Float64Array.from([-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6]), ); @@ -19,7 +19,7 @@ describe('calibrateX', () => { }); it('too small data', () => { - let data = { + const data = { x: Float64Array.from([0, 1, 2, 3]), y: Float64Array.from([1, 1, 5, 1]), }; @@ -29,12 +29,12 @@ describe('calibrateX', () => { }); it('no shift', () => { - let data = { + const data = { x: Float64Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]), y: Float64Array.from([1, 1, 5, 1, 1, 1, 700, 1, 1, 1, 1, 1, 1]), }; - let gsdOptions = { + const gsdOptions = { minMaxRatio: 0.4, realTopDetection: true, smoothY: true, @@ -44,7 +44,7 @@ describe('calibrateX', () => { }, }; - let shifted = calibrateX(data, { + const shifted = calibrateX(data, { from: 1, to: 10, targetX: 6, @@ -58,12 +58,12 @@ describe('calibrateX', () => { }); it('shift of 2', () => { - let data = { + const data = { x: Float64Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]), y: Float64Array.from([1, 1, 1, 1, 700, 1, 5, 1, 1, 1, 1, 1, 1]), }; - let gsdOptions = { + const gsdOptions = { minMaxRatio: 0.4, realTopDetection: true, smoothY: true, @@ -73,7 +73,7 @@ describe('calibrateX', () => { }, }; - let shifted = calibrateX(data, { + const shifted = calibrateX(data, { targetX: 6, gsd: gsdOptions, from: 1, @@ -89,7 +89,7 @@ describe('calibrateX', () => { }); it('2 peaks', () => { - let data = { + const data = { x: Float64Array.from([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, @@ -99,7 +99,7 @@ describe('calibrateX', () => { ]), }; - let gsdOptions = { + const gsdOptions = { minMaxRatio: 0.4, realTopDetection: true, smoothY: true, @@ -109,7 +109,7 @@ describe('calibrateX', () => { }, }; - let shifted = calibrateX(data, { + const shifted = calibrateX(data, { targetX: 6, gsd: gsdOptions, nbPeaks: 2, diff --git a/src/filters/x/calibrateX.ts b/src/filters/x/calibrateX.ts index dde7fd6..7cc1a07 100644 --- a/src/filters/x/calibrateX.ts +++ b/src/filters/x/calibrateX.ts @@ -55,7 +55,7 @@ export function calibrateX( const fromIndex = xFindClosestIndex(data.x, from); const toIndex = xFindClosestIndex(data.x, to); - let peaks = gsd( + const peaks = gsd( { x: data.x.subarray(fromIndex, toIndex), y: data.y.subarray(fromIndex, toIndex),