jcampconverter
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "jcampconverter", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Parse and convert JCAMP data", | ||
@@ -39,11 +39,11 @@ "main": "./src/index.js", | ||
"benchmark": "^2.1.4", | ||
"cheminfo-tools": "^1.22.4", | ||
"eslint": "^5.12.1", | ||
"eslint-config-cheminfo": "^1.20.0", | ||
"eslint-plugin-import": "^2.15.0", | ||
"eslint-plugin-jest": "^22.1.3", | ||
"eslint-plugin-no-only-tests": "^2.0.1", | ||
"jest": "^23.6.0", | ||
"cheminfo-tools": "^1.23.2", | ||
"eslint": "^5.16.0", | ||
"eslint-config-cheminfo": "^1.20.1", | ||
"eslint-plugin-import": "^2.17.1", | ||
"eslint-plugin-jest": "^22.4.1", | ||
"eslint-plugin-no-only-tests": "^2.3.0", | ||
"jest": "^24.7.1", | ||
"npm-run-all": "^4.1.3" | ||
} | ||
} |
@@ -740,3 +740,4 @@ 'use strict'; | ||
var inComment = false; | ||
var currentValue = 0; | ||
var currentValue = 0; // can be a difference or a duplicate | ||
var lastValue = 0; // must be the real last value | ||
var isNegative = false; | ||
@@ -790,2 +791,4 @@ var inValue = false; | ||
isDifference = false; | ||
} else if (!isDuplicate) { | ||
lastValue = isNegative ? 0 - currentValue : currentValue; | ||
} | ||
@@ -797,3 +800,3 @@ var duplicate = isDuplicate ? currentValue - 1 : 1; | ||
} else { | ||
currentY = isNegative ? 0 - currentValue : currentValue; | ||
currentY = lastValue; | ||
} | ||
@@ -995,11 +998,14 @@ currentData.push(currentX); | ||
let spaces = jcamp.includes('## '); | ||
for (var i = 0; i < lines.length; i++) { | ||
var line = lines[i]; | ||
let line = lines[i]; | ||
let labelLine = spaces ? line.replace(/ /g, '') : line; | ||
if (line.substring(0, 9) === '##NTUPLES') { | ||
if (labelLine.substring(0, 9) === '##NTUPLES') { | ||
ntupleLevel++; | ||
} | ||
if (line.substring(0, 7) === '##TITLE') { | ||
let title = [line.substring(8).trim()]; | ||
if (labelLine.substring(0, 7) === '##TITLE') { | ||
let title = [labelLine.substring(8).trim()]; | ||
for (let j = i + 1; j < lines.length; j++) { | ||
@@ -1019,3 +1025,3 @@ if (lines[j].startsWith('##')) { | ||
flat.push(current); | ||
} else if (line.substring(0, 5) === '##END' && ntupleLevel === 0) { | ||
} else if (labelLine.substring(0, 5) === '##END' && ntupleLevel === 0) { | ||
current.jcamp += `${line}\n`; | ||
@@ -1032,3 +1038,3 @@ var finished = stack.pop(); | ||
current.jcamp += `${line}\n`; | ||
var match = line.match(/^##(.*?)=(.+)/); | ||
var match = labelLine.match(/^##(.*?)=(.+)/); | ||
if (match) { | ||
@@ -1042,3 +1048,3 @@ var dataLabel = match[1].replace(/[ _-]/g, '').toUpperCase(); | ||
if (line.substring(0, 5) === '##END' && ntupleLevel > 0) { | ||
if (labelLine.substring(0, 5) === '##END' && ntupleLevel > 0) { | ||
ntupleLevel--; | ||
@@ -1045,0 +1051,0 @@ } |
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
43750
981