jcampconverter 8.1.3 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ### [8.2.1](https://www.github.com/cheminfo/jcampconverter/compare/v8.2.0...v8.2.1) (2021-09-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * ensure compatibility with node 12 ([c5c68cc](https://www.github.com/cheminfo/jcampconverter/commit/c5c68cc9de6330088f7c838573369c280ba68ff6))
9
+ * update nmr-processing library ([0732b3a](https://www.github.com/cheminfo/jcampconverter/commit/0732b3a44fd9bd92a721f6694bb98e46d12ea7bd))
10
+
11
+ ## [8.2.0](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.5...v8.2.0) (2021-09-07)
12
+
13
+
14
+ ### Features
15
+
16
+ * use dynamic-typing package and parse hexadecimal values ([0b584f3](https://www.github.com/cheminfo/jcampconverter/commit/0b584f37b3b5dadbcb9b77ec40124ef5cb0a0af7))
17
+
18
+ ### [8.1.5](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.4...v8.1.5) (2021-07-29)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * update dependencies ([602f123](https://www.github.com/cheminfo/jcampconverter/commit/602f123e8b0053e5b53bbbcf032122ce1ed82f0d))
24
+
25
+ ### [8.1.4](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.3...v8.1.4) (2021-07-12)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * reelase for Zenodo DOI ([973ed64](https://www.github.com/cheminfo/jcampconverter/commit/973ed64d3be6fb1ec1c4830a791b9ee901479f67))
31
+
3
32
  ### [8.1.3](https://www.github.com/cheminfo/jcampconverter/compare/v8.1.2...v8.1.3) (2021-06-18)
4
33
 
5
34
 
package/README.md CHANGED
@@ -16,6 +16,7 @@ Parse and convert JCAMP data
16
16
  [![build status][ci-image]][ci-url]
17
17
  [![Test coverage][codecov-image]][codecov-url]
18
18
  [![npm download][download-image]][download-url]
19
+ [![DOI](https://www.zenodo.org/badge/22728620.svg)](https://www.zenodo.org/badge/latestdoi/22728620)
19
20
 
20
21
  </h3>
21
22
 
package/lib/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var ensureString = require('ensure-string');
6
+ var dynamicTyping = require('dynamic-typing');
6
7
  var getMedian = require('ml-array-median');
7
8
  var nmrProcessing = require('nmr-processing');
8
9
 
@@ -451,9 +452,9 @@ function convertTo3DZ(spectra) {
451
452
  for (let i = 0; i < row.length; i++) {
452
453
  if (row[i] < 0) row[i] = -row[i];
453
454
  }
454
- medians.push(getMedian__default['default'](row));
455
+ medians.push(getMedian__default["default"](row));
455
456
  }
456
- const median = getMedian__default['default'](medians);
457
+ const median = getMedian__default["default"](medians);
457
458
 
458
459
  return {
459
460
  z: z,
@@ -1178,13 +1179,7 @@ function convert(jcamp, options = {}) {
1178
1179
  }
1179
1180
 
1180
1181
  if (options.dynamicTyping) {
1181
- if (value === 'true' || value === 'TRUE') {
1182
- value = true;
1183
- } else if (value === 'false' || value === 'FALSE') {
1184
- value = false;
1185
- } else if (value !== '' && !isNaN(value)) {
1186
- value = parseFloat(value);
1187
- }
1182
+ value = dynamicTyping.parseString(value);
1188
1183
  }
1189
1184
  if (target[label]) {
1190
1185
  if (!Array.isArray(target[label])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jcampconverter",
3
- "version": "8.1.3",
3
+ "version": "8.2.1",
4
4
  "description": "Parse and convert JCAMP data",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -17,10 +17,9 @@
17
17
  },
18
18
  "scripts": {
19
19
  "build": "cheminfo-build --entry src/index.js --root JcampConverter",
20
- "compile": "rollup -c",
21
- "prepack": "npm run compile",
22
20
  "eslint": "eslint src __tests__",
23
21
  "eslint-fix": "npm run eslint -- --fix",
22
+ "prepack": "rollup -c",
24
23
  "test": "npm run test-coverage && npm run eslint",
25
24
  "test-coverage": "jest --coverage",
26
25
  "test-only": "jest",
@@ -46,24 +45,25 @@
46
45
  "testEnvironment": "node"
47
46
  },
48
47
  "devDependencies": {
49
- "@babel/plugin-transform-modules-commonjs": "^7.14.0",
50
- "@types/jest": "^26.0.23",
48
+ "@babel/plugin-transform-modules-commonjs": "^7.15.4",
49
+ "@types/jest": "^27.0.2",
51
50
  "benchmark": "^2.1.4",
52
- "cheminfo-build": "^1.1.10",
53
- "eslint": "^7.27.0",
54
- "eslint-config-cheminfo": "^5.2.4",
55
- "eslint-plugin-import": "^2.23.3",
56
- "eslint-plugin-jest": "^24.3.6",
57
- "eslint-plugin-prettier": "^3.4.0",
51
+ "cheminfo-build": "^1.1.11",
52
+ "eslint": "^7.32.0",
53
+ "eslint-config-cheminfo": "^5.5.0",
54
+ "eslint-plugin-import": "^2.24.2",
55
+ "eslint-plugin-jest": "^24.5.0",
56
+ "eslint-plugin-prettier": "^4.0.0",
58
57
  "esm": "^3.2.25",
59
- "jest": "^27.0.1",
60
- "jest-matcher-deep-close-to": "^2.0.1",
61
- "prettier": "^2.3.0",
62
- "rollup": "^2.50.2"
58
+ "jest": "^27.2.4",
59
+ "jest-matcher-deep-close-to": "^3.0.0",
60
+ "prettier": "^2.4.1",
61
+ "rollup": "^2.57.0"
63
62
  },
64
63
  "dependencies": {
65
- "ensure-string": "^0.1.1",
64
+ "dynamic-typing": "^0.1.3",
65
+ "ensure-string": "^1.1.0",
66
66
  "ml-array-median": "^1.1.5",
67
- "nmr-processing": "^1.4.0"
67
+ "nmr-processing": "^3.0.2"
68
68
  }
69
69
  }
package/src/convert.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { parseString } from 'dynamic-typing';
1
2
  import { ensureString } from 'ensure-string';
2
3
 
3
4
  import { isMSField, convertMSFieldToLabel } from './complexChromatogram';
@@ -302,13 +303,7 @@ export default function convert(jcamp, options = {}) {
302
303
  }
303
304
 
304
305
  if (options.dynamicTyping) {
305
- if (value === 'true' || value === 'TRUE') {
306
- value = true;
307
- } else if (value === 'false' || value === 'FALSE') {
308
- value = false;
309
- } else if (value !== '' && !isNaN(value)) {
310
- value = parseFloat(value);
311
- }
306
+ value = parseString(value);
312
307
  }
313
308
  if (target[label]) {
314
309
  if (!Array.isArray(target[label])) {