jcampconverter
Advanced tools
Comparing version 2.0.7 to 2.0.8
{ | ||
"name": "jcampconverter", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"main": [ | ||
@@ -27,2 +27,2 @@ "dist/jcampconverter.js", | ||
] | ||
} | ||
} |
{ | ||
"name": "jcampconverter", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Parse and convert JCAMP data", | ||
@@ -44,6 +44,5 @@ "main": "./src/index.js", | ||
"should": "latest", | ||
"v8-profiler": "^5.2.3", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.0.0" | ||
} | ||
} | ||
} |
@@ -76,3 +76,2 @@ 'use strict'; | ||
if (dataLabel == 'DATATABLE') { | ||
endLine = dataValue.indexOf('\n'); | ||
@@ -86,4 +85,3 @@ if (endLine == -1) endLine = dataValue.indexOf('\r'); | ||
infos = dataValue.substring(0, endLine).split(/[ ,;\t]+/); | ||
infos = dataValue.substring(0, endLine).split(/[ ,;\t]{2,}/); | ||
if (infos[0].indexOf('++') > 0) { | ||
@@ -173,26 +171,26 @@ var firstVariable = infos[0].replace(/.*\(([a-zA-Z0-9]+)\+\+.*/, '$1'); | ||
} else if (dataLabel == 'VARNAME') { | ||
ntuples.varname = dataValue.split(/[, \t]+/); | ||
ntuples.varname = dataValue.split(/[, \t]{2,}/); | ||
} else if (dataLabel == 'SYMBOL') { | ||
ntuples.symbol = dataValue.split(/[, \t]+/); | ||
ntuples.symbol = dataValue.split(/[, \t]{2,}/); | ||
} else if (dataLabel == 'VARTYPE') { | ||
ntuples.vartype = dataValue.split(/[, \t]+/); | ||
ntuples.vartype = dataValue.split(/[, \t]{2,}/); | ||
} else if (dataLabel == 'VARFORM') { | ||
ntuples.varform = dataValue.split(/[, \t]+/); | ||
ntuples.varform = dataValue.split(/[, \t]{2,}/); | ||
} else if (dataLabel == 'VARDIM') { | ||
ntuples.vardim = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.vardim = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == 'UNITS') { | ||
ntuples.units = dataValue.split(/[, \t]+/); | ||
ntuples.units = dataValue.split(/[, \t]{2,}/); | ||
} else if (dataLabel == 'FACTOR') { | ||
ntuples.factor = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.factor = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == 'FIRST') { | ||
ntuples.first = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.first = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == 'LAST') { | ||
ntuples.last = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.last = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == 'MIN') { | ||
ntuples.min = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.min = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == 'MAX') { | ||
ntuples.max = convertToFloatArray(dataValue.split(/[, \t]+/)); | ||
ntuples.max = convertToFloatArray(dataValue.split(/[, \t]{2,}/)); | ||
} else if (dataLabel == '.NUCLEUS') { | ||
if (result.twoD) { | ||
result.yType = dataValue.split(/[, \t]+/)[0]; | ||
result.yType = dataValue.split(/[, \t]{2,}/)[0]; | ||
} | ||
@@ -240,2 +238,16 @@ } else if (dataLabel == 'PAGE') { | ||
if (Object.keys(ntuples).length>0) { | ||
var newNtuples=[]; | ||
var keys=Object.keys(ntuples); | ||
for (var i=0; i<keys.length; i++) { | ||
var key=keys[i]; | ||
var values=ntuples[key]; | ||
for (var j=0; j<values.length; j++) { | ||
if (! newNtuples[j]) newNtuples[j]={}; | ||
newNtuples[j][key]=values[j]; | ||
} | ||
} | ||
result.ntuples=newNtuples; | ||
} | ||
if (result.twoD) { | ||
@@ -254,3 +266,3 @@ add2D(result); | ||
// maybe it is a GC (HPLC) / MS. In this case we add a new format | ||
if (spectra.length > 1 && spectra[0].dataType.toLowerCase().match(/.*mass./)) { | ||
if (spectra.length > 1 && spectra[0].dataType && spectra[0].dataType.toLowerCase().match(/.*mass./)) { | ||
addGCMS(result); | ||
@@ -257,0 +269,0 @@ if (result.profiling) result.profiling.push({ |
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
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
39447
13
732