Skip to content

Commit

Permalink
feat: update ir-spectrum and add more filters
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Nov 14, 2024
1 parent e6ddaa8 commit 7834b77
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 37 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.yml

This file was deleted.

12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import cheminfo from 'eslint-config-cheminfo';

export default [
...cheminfo,
{
languageOptions: {
globals: {
__dirname: 'readonly',
},
},
},
];
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"prepack": "rollup -c",
"prettier": "prettier --check src",
"prettier-write": "prettier --write src",
"test": "npm run test-coverage && npm run eslint",
"test-coverage": "jest --coverage",
"test-only": "jest"
"test": "npm run test-coverage && npm run eslint && npm run prettier",
"test-coverage": "vitest run --coverage",
"test-only": "viest run"
},
"repository": {
"type": "git",
Expand All @@ -35,22 +35,23 @@
"testEnvironment": "node"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@types/jest": "^29.5.3",
"@babel/plugin-transform-modules-commonjs": "^7.25.9",
"@vitest/coverage-v8": "^2.1.5",
"cheminfo-build": "^1.2.0",
"codecov": "^3.8.3",
"eslint": "^8.47.0",
"eslint-config-cheminfo": "^9.0.2",
"eslint": "^9.14.0",
"eslint-config-cheminfo": "^12.0.1",
"esm": "^3.2.25",
"jest": "^29.6.3",
"jest-matcher-deep-close-to": "^3.0.2",
"prettier": "^3.0.2",
"rollup": "^3.28.1"
"prettier": "^3.3.3",
"rollup": "^4.26.0",
"vitest": "^2.1.5"
},
"dependencies": {
"common-spectrum": "2.2.1",
"ml-gsd": "^12.1.3",
"spc-parser": "^0.7.2"
"common-spectrum": "2.12.0",
"ml-gsd": "^12.1.8",
"spc-parser": "^1.0.0",
"uninstall": "^0.0.0"
},
"info": {
"logo": "https://raw.githubusercontent.com/cheminfo/font/master/src/ir/assignment.svg",
Expand Down
5 changes: 3 additions & 2 deletions src/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { readFileSync } from 'fs';
import { join } from 'path';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
import { test, expect } from 'vitest';

import { fromJcamp, autoPeakPicking, peakPicking } from '..';

Expand Down
5 changes: 3 additions & 2 deletions src/from/__tests__/fromJcamp.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { readFileSync } from 'fs';
import { join } from 'path';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
import { describe, it, expect } from 'vitest';

import { fromJcamp } from '../fromJcamp';

Expand Down
5 changes: 3 additions & 2 deletions src/from/__tests__/fromSPC.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { readFileSync } from 'fs';
import { join } from 'path';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

import { toJcamp } from 'common-spectrum';
import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
import { describe, it, expect } from 'vitest';

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

Expand Down
6 changes: 3 additions & 3 deletions src/from/fromJcamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { spectrumCallback } from './utils/spectrumCallback';
* @param {ArrayBuffer|string} jcamp

Check warning on line 7 in src/from/fromJcamp.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "jcamp" description
* @param {object} [options={}]

Check warning on line 8 in src/from/fromJcamp.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options" description
* @param {string|number} [options.id=Math.random()]

Check warning on line 9 in src/from/fromJcamp.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options.id" description
* @param {string} [options.label=options.id] human redeable label
* @param {string} [options.spectrumCallback] a callback to apply on variables when creating spectrum. Default will add a and t
* @return {Analysis} - New class element with the given data
* @param {string} [options.label=options.id] - human redeable label
* @param {string} [options.spectrumCallback] - a callback to apply on variables when creating spectrum. Default will add a and t
* @returns {Analysis} - New class element with the given data

Check warning on line 12 in src/from/fromJcamp.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

The type 'Analysis' is undefined
*/
export function fromJcamp(jcamp, options = {}) {
return commonFromJcamp(jcamp, { ...options, spectrumCallback });
Expand Down
6 changes: 3 additions & 3 deletions src/from/fromSPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { spectrumCallback } from './utils/spectrumCallback';
* @param {ArrayBuffer} buffer

Check warning on line 8 in src/from/fromSPC.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "buffer" description
* @param {object} [options={}]

Check warning on line 9 in src/from/fromSPC.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options" description
* @param {object} [options.id=Math.random()]

Check warning on line 10 in src/from/fromSPC.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "options.id" description
* @param {string} [options.label=options.id] human redeable label
* @param {string} [options.spectrumCallback] a callback to apply on variables when creating spectrum. Default will add a and t
* @return {Analysis} - New class element with the given data
* @param {string} [options.label=options.id] - human redeable label
* @param {string} [options.spectrumCallback] - a callback to apply on variables when creating spectrum. Default will add a and t
* @returns {Analysis} - New class element with the given data
*/

export function fromSPC(buffer, options = {}) {
Expand Down
12 changes: 6 additions & 6 deletions src/jsgraph/getAnnotations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {Object} Peak
* @typedef {object} Peak
* @property {number} wavenumber
* @property {number} transmittance
* @property {number} absorbance
Expand All @@ -9,14 +9,14 @@

/**
* Creates annotations for jsgraph that allows to display the result of peak picking
* @param {array<Peak>} peaks
* @param {Array<Peak>} peaks
* @param {object} [options={}]
* @param {string} [options.fillColor='green']
* @param {string} [options.strokeColor='red']
* @param {string} [options.showKind=true] Display the kind, 'm', 'w', 'S'
* @param {string} [options.showAssignment=true] Display the assignment
* @param {function} [options.createFct] (annotation, peak) => {}: callback allowing to add properties
* @param {string} [options.mode='t100'] 't100'=transmittance in %, 't'=transmittance, 'a'=absorbance
* @param {string} [options.showKind=true] - Display the kind, 'm', 'w', 'S'
* @param {string} [options.showAssignment=true] - Display the assignment
* @param {Function} [options.createFct] - (annotation, peak) => {}: callback allowing to add properties
* @param {string} [options.mode='t100'] - 't100'=transmittance in %, 't'=transmittance, 'a'=absorbance
* @returns array
*/

Expand Down

0 comments on commit 7834b77

Please sign in to comment.