jcampconverter
Advanced tools
Comparing version 8.1.2 to 8.1.3
# Changelog | ||
### [8.1.3](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.2...v8.1.3) (2021-06-18) | ||
### Bug Fixes | ||
* prevent isNaN with dynamicTyping ([c171dcf](https://www.github.com/cheminfo/jcampconverter/commit/c171dcf0c1f9891bf85435c6693aec9c54a98c01)) | ||
### [8.1.2](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.1...v8.1.2) (2021-05-27) | ||
@@ -4,0 +11,0 @@ |
@@ -898,3 +898,2 @@ 'use strict'; | ||
const ntuplesSeparatorRegExp = /[ \t]*,[ \t]*/; | ||
const numberRegExp = /^[-+]?[0-9]*\.?[0-9]+(e[-+]?[0-9]+)?$/; | ||
@@ -1183,4 +1182,8 @@ class Spectrum {} | ||
if (options.dynamicTyping) { | ||
if (value.match(numberRegExp)) { | ||
value = Number.parseFloat(value); | ||
if (value === 'true' || value === 'TRUE') { | ||
value = true; | ||
} else if (value === 'false' || value === 'FALSE') { | ||
value = false; | ||
} else if (value !== '' && !isNaN(value)) { | ||
value = parseFloat(value); | ||
} | ||
@@ -1187,0 +1190,0 @@ } |
{ | ||
"name": "jcampconverter", | ||
"version": "8.1.2", | ||
"version": "8.1.3", | ||
"description": "Parse and convert JCAMP data", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -15,3 +15,2 @@ import { ensureString } from 'ensure-string'; | ||
const ntuplesSeparatorRegExp = /[ \t]*,[ \t]*/; | ||
const numberRegExp = /^[-+]?[0-9]*\.?[0-9]+(e[-+]?[0-9]+)?$/; | ||
@@ -307,4 +306,8 @@ class Spectrum {} | ||
if (options.dynamicTyping) { | ||
if (value.match(numberRegExp)) { | ||
value = Number.parseFloat(value); | ||
if (value === 'true' || value === 'TRUE') { | ||
value = true; | ||
} else if (value === 'false' || value === 'FALSE') { | ||
value = false; | ||
} else if (value !== '' && !isNaN(value)) { | ||
value = parseFloat(value); | ||
} | ||
@@ -311,0 +314,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
96247
2248