brukerconverter
Advanced tools
Comparing version 6.0.1 to 6.0.2-pre.1673538890
@@ -563,2 +563,3 @@ 'use strict'; | ||
* @param {boolean} [options.xy] - if true, spectra data is a object with x and y | ||
* @param {boolean} [options.keepFiles] - if true, the fileCollectionItems will be saved in source. | ||
* @param {boolean} [options.keepSpectra=false] - for 2D should we keep the spectra or just the matrix ? | ||
@@ -584,2 +585,5 @@ * @param {RegExp} [options.keepRecordsRegExp='\/.*\/'] - regular expresion to parse the metadata of the spectrum. | ||
} | ||
if (options.keepFiles) { | ||
result.source.files = brukerFiles.fileCollectionItems; | ||
} | ||
// todo we could as well keep the FileList at this level if | ||
@@ -592,5 +596,5 @@ // we want to keep the original data | ||
if (result.meta.GRPDLY) { | ||
result.meta.GRPDLY = Number(result.meta.GRPDLY); | ||
result.meta.DSPFVS = Number(result.meta.DSPFVS); | ||
result.meta.DECIM = Number(result.meta.DECIM); | ||
maybeAdd(result.meta, 'DSPFVS', result.meta.DSPFVS); | ||
maybeAdd(result.meta, 'GRPDLY', result.meta.GRPDLY); | ||
maybeAdd(result.meta, 'DECIM', result.meta.DECIM); | ||
} | ||
@@ -623,2 +627,21 @@ | ||
function maybeAdd(obj, name, value) { | ||
if (value === undefined) return; | ||
if (Array.isArray(value)) { | ||
obj[name] = value.map(cleanValue); | ||
} else { | ||
obj[name] = [cleanValue(value)]; | ||
} | ||
} | ||
function cleanValue(value) { | ||
if (typeof value === 'string') { | ||
if (value.startsWith('<') && value.endsWith('>')) { | ||
value = value.substring(1, value.length - 1); | ||
} | ||
value = value.trim(); | ||
} | ||
return value; | ||
} | ||
/** | ||
@@ -651,3 +674,4 @@ * | ||
exports.convertFileCollection = convertFileCollection; | ||
exports.convertOneExperiment = convertOneExperiment; | ||
exports.convertZip = convertZip; | ||
exports.groupByExperiments = groupByExperiments; |
{ | ||
"name": "brukerconverter", | ||
"version": "6.0.1", | ||
"version": "6.0.2-pre.1673538890", | ||
"description": "Parse and convert Bruker raw data", | ||
@@ -53,2 +53,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
export { convertZip } from './helpers/convertZip'; | ||
export { convertOneExperiment } from './util/convertOneExperiment'; | ||
export { convertFileCollection } from './convertFileCollection'; | ||
export { groupByExperiments } from './groupByExperiments'; |
@@ -10,2 +10,3 @@ import { convert1D } from './convert1D'; | ||
* @param {boolean} [options.xy] - if true, spectra data is a object with x and y | ||
* @param {boolean} [options.keepFiles] - if true, the fileCollectionItems will be saved in source. | ||
* @param {boolean} [options.keepSpectra=false] - for 2D should we keep the spectra or just the matrix ? | ||
@@ -31,2 +32,5 @@ * @param {RegExp} [options.keepRecordsRegExp='\/.*\/'] - regular expresion to parse the metadata of the spectrum. | ||
} | ||
if (options.keepFiles) { | ||
result.source.files = brukerFiles.fileCollectionItems; | ||
} | ||
// todo we could as well keep the FileList at this level if | ||
@@ -39,5 +43,5 @@ // we want to keep the original data | ||
if (result.meta.GRPDLY) { | ||
result.meta.GRPDLY = Number(result.meta.GRPDLY); | ||
result.meta.DSPFVS = Number(result.meta.DSPFVS); | ||
result.meta.DECIM = Number(result.meta.DECIM); | ||
maybeAdd(result.meta, 'DSPFVS', result.meta.DSPFVS); | ||
maybeAdd(result.meta, 'GRPDLY', result.meta.GRPDLY); | ||
maybeAdd(result.meta, 'DECIM', result.meta.DECIM); | ||
} | ||
@@ -69,1 +73,20 @@ | ||
} | ||
function maybeAdd(obj, name, value) { | ||
if (value === undefined) return; | ||
if (Array.isArray(value)) { | ||
obj[name] = value.map(cleanValue); | ||
} else { | ||
obj[name] = [cleanValue(value)]; | ||
} | ||
} | ||
function cleanValue(value) { | ||
if (typeof value === 'string') { | ||
if (value.startsWith('<') && value.endsWith('>')) { | ||
value = value.substring(1, value.length - 1); | ||
} | ||
value = value.trim(); | ||
} | ||
return value; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54193
1547
2
0