Skip to content

Commit

Permalink
feat: keep meta information from netcdf
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Aug 28, 2024
1 parent 63da9ae commit 7863e4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Chromatogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { getMzVsTimesMatrix } from './util/getMzVsTimesMatrix';
import { integrate } from './util/integrate';

export class Chromatogram {
constructor(times, series) {
constructor(times, series, options = {}) {
this.meta = options.meta || {};
this.series = {};
this.times = [];
if (!isAnyArray(times)) {
Expand Down Expand Up @@ -237,9 +238,8 @@ export class Chromatogram {
}

export function fromJSON(json) {

Check warning on line 240 in src/Chromatogram.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc comment
let series = json.series;
let times = json.times;
let chromatogram = new Chromatogram(times);
const { series, times, meta = {} } = json;
let chromatogram = new Chromatogram(times, undefined, { meta });

if (Array.isArray(series)) {
for (let i = 0; i < series.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/chromatoToJcamp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test('chromatoToJcamp', () => {
title: 'Total ion chromatogram',
dataType: 'Chromatogram',
},
meta: chromatogram.meta,
});
expect(jcamp.split(/\n/)).toHaveLength(4529);
expect(jcamp.split(/\n/)).toHaveLength(4558);
});

0 comments on commit 7863e4f

Please sign in to comment.