Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jcampconverter

Package Overview
Dependencies
Maintainers
6
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jcampconverter - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

2

package.json
{
"name": "jcampconverter",
"version": "4.0.0",
"version": "4.1.0",
"description": "Parse and convert JCAMP data",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

# JCAMP converter
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]
Parse and convert JCAMP data

@@ -28,23 +28,24 @@

__Arguments__
**Arguments**
* `jcamp` - String containing the JCAMP data
* `options` - Object with options to pass to the converter
* `useWorker` - Browser only: convert in a web worker (default: false). If this option is set to true, it will return a [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise).
- `jcamp` - String containing the JCAMP data
- `options` - Object with options to pass to the converter
- `useWorker` - Browser only: convert in a web worker (default: false). If this option is set to true, it will return a [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise).
__Options__
**Options**
* keepRecordsRegExp - regexp to select which records should be placed in the info field. By default: :/^$/} (nothing is kept)
* xy - instead of creating a 1D array containing [x1,y1,x2,y2, ...] create an object: {x:[], y:[]}
* withoutXY - do not parse XYDATA or PEAKTABLE fields. Useful to only extract metadata fields (combine this option with `keepRecordsRegExp`)
* chromatogram - use the new GC/MS data format output (default: false)
* canonicDataLabels - canonize data labels (uppercase) (default: true).
- keepRecordsRegExp - regexp to select which records should be placed in the info field. By default: :/^\$/} (nothing is kept)
- xy - instead of creating a 1D array containing [x1,y1,x2,y2, ...] create an object: {x:[], y:[]}
- withoutXY - do not parse XYDATA or PEAKTABLE fields. Useful to only extract metadata fields (combine this option with `keepRecordsRegExp`)
- chromatogram - use the new GC/MS data format output (default: false)
- canonicDataLabels - canonize data labels (uppercase) (default: true).
- dynamicTyping - When parsing field convert to number if a number
2D NMR options:
* noContour - if true, the contour levels will not be generated. Instead the raw data will be available in `result.minMax.z` (default: false)
* nbContourLevels - number of contour levels to use in each positive and negative sides (default: 7)
* noiseMultiplier - default: 5
* keepSpectra - Generate array for 2D NMR spectra (default: false)
- noContour - if true, the contour levels will not be generated. Instead the raw data will be available in `result.minMax.z` (default: false)
- nbContourLevels - number of contour levels to use in each positive and negative sides (default: 7)
- noiseMultiplier - default: 5
- keepSpectra - Generate array for 2D NMR spectra (default: false)
### Use as a module

@@ -55,4 +56,6 @@

```javascript
var converter = require('jcampconverter');
var jcamp = require('fs').readFileSync('path/to/jcamp.dx').toString();
var converter = require("jcampconverter");
var jcamp = require("fs")
.readFileSync("path/to/jcamp.dx")
.toString();

@@ -65,7 +68,7 @@ var result = converter.convert(jcamp);

```javascript
require(['jcampconverter'], function(JcampConverter) {
// Use the worker
JcampConverter.convert(jcamp, true).then(function (result) {
// Do something with result
});
require(["jcampconverter"], function(JcampConverter) {
// Use the worker
JcampConverter.convert(jcamp, true).then(function(result) {
// Do something with result
});
});

@@ -72,0 +75,0 @@ ```

@@ -21,2 +21,3 @@ 'use strict';

canonicDataLabels: true,
dynamicTyping: false,
xy: false,

@@ -315,2 +316,6 @@ withoutXY: false,

let label = options.canonicDataLabels ? canonicDataLabel : dataLabel;
let value = dataValue.trim();
if (options.dynamicTyping && !isNaN(value)) {
value = Number(value);
}
if (result.info[label]) {

@@ -320,5 +325,5 @@ if (!Array.isArray(result.info[label])) {

}
result.info[label].push(dataValue.trim());
result.info[label].push(value);
} else {
result.info[label] = dataValue.trim();
result.info[label] = value;
}

@@ -325,0 +330,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc