Skip to content

Commit 3ce3b81

Browse files
committed
chore: update dependencies
1 parent 946c194 commit 3ce3b81

12 files changed

Lines changed: 67 additions & 60 deletions

File tree

.eslintrc.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import cheminfo from 'eslint-config-cheminfo';
2+
3+
export default [...cheminfo];

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@
3535
"testEnvironment": "node"
3636
},
3737
"devDependencies": {
38-
"@babel/plugin-transform-modules-commonjs": "^7.17.9",
39-
"@types/jest": "^27.5.0",
40-
"cheminfo-build": "^1.1.11",
38+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
39+
"@types/jest": "^30.0.0",
40+
"cheminfo-build": "^1.2.1",
4141
"codecov": "^3.8.2",
42-
"eslint": "^8.15.0",
43-
"eslint-config-cheminfo": "^7.3.0",
42+
"eslint": "^9.32.0",
43+
"eslint-config-cheminfo": "^15.0.1",
4444
"esm": "^3.2.25",
45-
"jest": "^28.1.0",
45+
"jest": "^30.0.5",
4646
"jest-matcher-deep-close-to": "^3.0.2",
47-
"prettier": "^2.6.2",
48-
"rollup": "^2.72.1"
47+
"prettier": "^3.6.2",
48+
"rollup": "^4.46.2"
4949
},
5050
"dependencies": {
51-
"common-spectrum": "1.0.2",
52-
"ml-spectra-processing": "^11.6.0",
53-
"spc-parser": "^0.5.2",
54-
"wdf-parser": "^0.2.1"
51+
"common-spectrum": "3.0.0",
52+
"ml-spectra-processing": "^14.14.0",
53+
"spc-parser": "^1.0.0",
54+
"wdf-parser": "^0.3.0"
5555
},
5656
"info": {
5757
"logo": "https://raw.githubusercontent.com/cheminfo/font/main/src/raman/assignment.svg",

src/__tests__/index.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
import { readFileSync } from 'fs';
2-
import { join } from 'path';
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
33

4-
import { fromJcamp, autoPeakPicking } from '..';
4+
import { expect, test } from 'vitest';
5+
6+
import { autoPeakPicking, fromJcamp } from '..';
57

68
test('fromJcamp', () => {
79
const arrayBuffer = readFileSync(join(__dirname, 'data/adamantan.jdx'));
810
const analysis = fromJcamp(arrayBuffer);
11+
912
expect(analysis.spectra).toHaveLength(1);
1013
expect(analysis.spectra[0].variables).toHaveProperty('x');
1114
expect(analysis.spectra[0].variables).toHaveProperty('y');
1215
expect(analysis.spectra[0].variables.x.data).toHaveLength(1791);
1316

1417
const spectrum = analysis.getSpectrum();
1518
const peaks = autoPeakPicking(spectrum);
19+
1620
expect(peaks).toHaveLength(38);
1721
});

src/from/__tests__/fromSPC.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { readFileSync } from 'fs';
2-
import { join } from 'path';
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
3+
4+
import { expect, test } from 'vitest';
35

46
import { fromSPC } from '../..';
57

@@ -9,6 +11,7 @@ test('fromSPC', () => {
911

1012
let measurement = analysis.getSpectrum();
1113
let variables = measurement.variables;
14+
1215
expect(measurement.variables.x.data).toHaveLength(3632);
1316
expect(Math.min(...variables.x.data)).toBeCloseTo(-3005.9560546875);
1417
expect(Math.max(...variables.x.data)).toBeCloseTo(3996.8232421875);

src/from/__tests__/fromWDF.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { readFileSync } from 'fs';
2-
import { join } from 'path';
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
3+
4+
import { expect, test } from 'vitest';
35

46
import { fromWDF } from '../..';
57

src/from/fromSPC.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { parse } from 'spc-parser';
2-
31
import { Analysis } from 'common-spectrum';
2+
import { parse } from 'spc-parser';
43

54
export function fromSPC(arrayBuffer) {
65
let analysis = new Analysis();

src/from/fromWDF.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { parse } from 'wdf-parser';
2-
31
import { Analysis } from 'common-spectrum';
2+
import { parse } from 'wdf-parser';
43

54
export function fromWDF(arrayBuffer) {
65
let analysis = new Analysis();
@@ -31,9 +30,9 @@ export function fromWDF(arrayBuffer) {
3130
}
3231

3332
function getXVariable(blocks) {
34-
const xBlock = blocks.filter(
33+
const xBlock = blocks.find(
3534
(block) => block.blockType === 'WDF_BLOCKID_XLIST',
36-
)[0];
35+
);
3736
return {
3837
label: xBlock.xList.units.replace(/(.*) \((.*)\)/, '$1'),
3938
units: xBlock.xList.units.replace(/(.*) \((.*)\)/, '$2'),
@@ -42,9 +41,9 @@ function getXVariable(blocks) {
4241
}
4342

4443
function getYVariables(blocks) {
45-
const dataBlock = blocks.filter(
44+
const dataBlock = blocks.find(
4645
(block) => block.blockType === 'WDF_BLOCKID_DATA',
47-
)[0];
46+
);
4847
const yVariables = [];
4948
for (let spectrum of dataBlock.spectrum) {
5049
yVariables.push({
@@ -56,17 +55,13 @@ function getYVariables(blocks) {
5655
}
5756

5857
function getOrigins(blocks) {
59-
const originBlock = blocks.filter(
58+
const originBlock = blocks.find(
6059
(block) => block.blockType === 'WDF_BLOCKID_ORIGIN',
61-
)[0];
60+
);
6261
if (!originBlock) return [];
6362

64-
const xPositions = originBlock.origins.filter(
65-
(entry) => entry.label === 'X',
66-
)[0];
67-
const yPositions = originBlock.origins.filter(
68-
(entry) => entry.label === 'Y',
69-
)[0];
63+
const xPositions = originBlock.origins.find((entry) => entry.label === 'X');
64+
const yPositions = originBlock.origins.find((entry) => entry.label === 'Y');
7065

7166
if (!xPositions || !yPositions) return [];
7267

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { JSGraph as OriginalJSGraph } from 'common-spectrum';
33
import { getAnnotations } from './jsgraph/getAnnotations';
44

55
export {
6-
Analysis,
76
AnalysesManager,
8-
toJcamp,
9-
toJcamps,
10-
peakPicking,
7+
Analysis,
118
autoPeakPicking,
129
fromJcamp,
10+
peakPicking,
11+
toJcamp,
12+
toJcamps,
1313
} from 'common-spectrum';
1414

1515
export const JSGraph = { ...OriginalJSGraph, getAnnotations };

src/jsgraph/getAnnotations.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {Object} Peak
2+
* @typedef {object} Peak
33
* @property {number} wavenumber
44
* @property {number} transmittance
55
* @property {number} intensity
@@ -9,13 +9,13 @@
99

1010
/**
1111
* Creates annotations for jsgraph that allows to display the result of peak picking
12-
* @param {array<Peak>} peaks
12+
* @param {Array<Peak>} peaks
1313
* @param {object} [options={}]
1414
* @param {string} [options.fillColor='green']
1515
* @param {string} [options.strokeColor='red']
16-
* @param {string} [options.showKind=true] Display the kind, 'm', 'w', 'S'
17-
* @param {string} [options.showAssignment=true] Display the assignment
18-
* @param {function} [options.createFct] (annotation, peak) => {}: callback allowing to add properties
16+
* @param {string} [options.showKind=true] - Display the kind, 'm', 'w', 'S'
17+
* @param {string} [options.showAssignment=true] - Display the assignment
18+
* @param {Function} [options.createFct] - (annotation, peak) => {}: callback allowing to add properties
1919
* @returns array
2020
*/
2121

@@ -25,9 +25,9 @@ export function getAnnotations(peaks, options = {}) {
2525
let annotation = {
2626
line: 1,
2727
type: 'rect',
28-
strokeColor: strokeColor,
28+
strokeColor,
2929
strokeWidth: 0,
30-
fillColor: fillColor,
30+
fillColor,
3131
};
3232
if (creationFct) {
3333
creationFct(annotation, peak);

0 commit comments

Comments
 (0)