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

jcampconverter

Package Overview
Dependencies
Maintainers
0
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 9.6.4 to 10.0.0

348

jcampconverter.d.ts
import { Logger } from 'cheminfo-types';
import type { Molecule } from 'openchemlib';
import { openchemlib } from 'openchemlib';
declare interface Add2DOptions extends GenerateContourLinesOptions {
/**
* Don't calculate contour in case of 2D.
*/
noContour?: boolean;
}
declare interface Chromatogram {
times: number[];
series: Record<string, {
dimension: number;
data: any[];
}>;
}
declare interface ContourLines {
minX: number;
maxX: number;
minY: number;
maxY: number;
segments: Array<{
zValue?: number;
lines?: number[];
}>;
}
/**
* Conversion options
* @typedef {object} ConvertOptions@typedef {object} ConvertOptions
* @property {RegExp} [keepRecordsRegExp=/^$/] - By default we don't keep meta information.
* @property {boolean} [canonicDataLabels=true] - Canonize the Labels (uppercase without symbol).
* @property {boolean} [canonicMetadataLabels=false] - Canonize the metadata Labels (uppercase without symbol).
* @property {boolean} [dynamicTyping=false] - Convert numbers to Number.
* @property {boolean} [withoutXY=false] - Remove the XY data.
* @property {boolean} [chromatogram=false] - Special post-processing for GC / HPLC / MS.
* @property {boolean} [keepSpectra=false] - Force to keep the spectra in case of 2D.
* @property {RegExp} [noTrimRegExp=/^$/] - For which fields we should not trim ?
* @property {boolean} [noContour=false] - Don't calculate countour in case of 2D.
* @property {number} [nbContourLevels=7] - Number of positive / negative contour levels to calculate.
* @property {number} [noiseMultiplier=5] - Define for 2D the level as 5 times the median as default.
* @property {import('cheminfo-types').Logger} [logger] - A logger like 'pino'
* @property {boolean} [profiling=false] - Add profiling information.
*/
/**
*
* @typedef {object} Ntuples@typedef {object} Ntuples
* @property {string[]} [varname]
* @property {string[]} [symbol]
* @property {string[]} [vartype]
* @property {string[]} [varform]
* @property {number[]} [vardim]
* @property {string[]} [units]
* @property {number[]} [factor]
* @property {number[]} [first]
* @property {number[]} [last]
* @property {number[]} [min]
* @property {number[]} [max]
* @property {string[]} [nucleus]
*/
/**
* @typedef { Record<string, any> } Spectrum
* @property {Record<string, number[]>} [data]
* @property {number} [firstX] - first X value
* @property {number} [lastX] - last X value
* @property {number} [deltaX] - distance between 2 consecutive x axis values
* @property {number} [yFactor] - y axis scaling factor
* @property {number} [xFactor] - x axis scaling factor
* @property {number} [nbPoints] - Number of points
*/
/**
*
* @typedef {object} MinMax@typedef {object} MinMax
* @property {number[][]} [z]
* @property {number} minX
* @property {number} maxX
* @property {number} minY
* @property {number} maxY
* @property {number} minZ
* @property {number} maxZ
* @property {number} median
*/
/**
*
* @typedef {object} Entry@typedef {object} Entry
* @property {Spectrum[]} spectra
* @property {Ntuples} ntuples
* @property {Record<String, string | string[] | number | number[] | boolean | boolean[] | undefined>} meta
* @property {Record<String, string | string[] | number | number[] | boolean | boolean[] | undefined>} info
* @property {Record<String, string | string[] | number | number[] | boolean | boolean[] | undefined>} tmp
* @property {string} [title]
* @property {string} [dataType]
* @property {string} [dataClass]
* @property {string?} [jcampDX]
* @property {string?} [jcampCS]
* @property {boolean} [twoD]
* @property {MinMax} [minMax]
*/
/**
*
* @typedef { object } ConvertResult@typedef { object } ConvertResult
* @property { object[] | boolean } profiling
* @property { string[] } logs
* @property { object[] } entries
* @property { Entry[] } flatten
*/
/**
* Parse a jcamp.
* The data can be provide as a string or array buffer. In this later case
* Parse JCAMP-DX data.
* The data can be provided as a string or array buffer. In this latter case
* we will convert it first to a string before parsing.
* @param {string|ArrayBuffer|Uint8Array} jcamp
* @param {ConvertOptions} [options]
* @returns {ConvertResult}
* @param jcamp
* @param optionsParam
* @returns Converted result.
*/
export declare function convert(jcamp: string | ArrayBuffer | Uint8Array, options?: ConvertOptions | undefined): ConvertResult;
export declare function convert(jcamp: string | ArrayBuffer | Uint8Array, optionsParam?: ConvertOptions): ConvertResult;
/**
* Conversion options
* Conversion options.
*/
declare type ConvertOptions = {
declare interface ConvertOptions extends Partial<Add2DOptions> {
/**
* - By default we don't keep meta information.
* By default we don't keep meta information.
* @default `/^$/`
*/
keepRecordsRegExp?: RegExp | undefined;
keepRecordsRegExp?: RegExp;
/**
* - Canonize the Labels (uppercase without symbol).
* Canonize the Labels (uppercase without symbol).
*/
canonicDataLabels?: boolean | undefined;
canonicDataLabels?: boolean;
/**
* - Canonize the metadata Labels (uppercase without symbol).
* Canonize the metadata Labels (uppercase without symbol).
*/
canonicMetadataLabels?: boolean | undefined;
canonicMetadataLabels?: boolean;
/**
* - Convert numbers to Number.
* Convert numbers to Number.
*/
dynamicTyping?: boolean | undefined;
dynamicTyping?: boolean;
/**
* - Remove the XY data.
* Remove the XY data.
*/
withoutXY?: boolean | undefined;
withoutXY?: boolean;
/**
* - Special post-processing for GC / HPLC / MS.
* Special post-processing for GC / HPLC / MS.
*/
chromatogram?: boolean | undefined;
chromatogram?: boolean;
/**
* - Force to keep the spectra in case of 2D.
* Force to keep the spectra in case of 2D.
*/
keepSpectra?: boolean | undefined;
keepSpectra?: boolean;
/**
* - For which fields we should not trim ?
* For which fields we should not trim ?
* @default `/^$/`
*/
noTrimRegExp?: RegExp | undefined;
noTrimRegExp?: RegExp;
/**
* - Don't calculate countour in case of 2D.
* A logger like `pino`.
*/
noContour?: boolean | undefined;
logger?: Logger;
/**
* - Number of positive / negative contour levels to calculate.
* Add profiling information.
*/
nbContourLevels?: number | undefined;
/**
* - Define for 2D the level as 5 times the median as default.
*/
noiseMultiplier?: number | undefined;
/**
* - A logger like 'pino'
*/
logger?: Logger | undefined;
/**
* - Add profiling information.
*/
profiling?: boolean | undefined;
};
wantXY?: boolean;
start?: number;
fastParse?: boolean;
}
declare type ConvertResult = {
profiling: object[] | boolean;
logs: string[];
entries: object[];
declare interface ConvertResult {
entries: Entry[];
flatten: Entry[];
};
}
/**
*
* @typedef {object} CreateTreeOptions@typedef {object} CreateTreeOptions
* @property {boolean} [flatten=false]
* Parse the JCAMP-DX to extract the structure as a tree.
* @param jcamp
* @param options
* @returns Tree.
*/
/**
*
* @typedef {object} Tree@typedef {object} Tree
* @property {string} title
* @property {string} jcamp
* @property {Tree[]} [children]
*/
/**
* Parse the jcamp to extract the structure as a tree.
*
* @param {string|ArrayBuffer|Uint8Array} jcamp
* @param {CreateTreeOptions} [options={}]
* @returns {Tree[]}
*/
export declare function createTree(jcamp: string | ArrayBuffer | Uint8Array, options?: CreateTreeOptions | undefined): Tree[];
export declare function createTree(jcamp: string | ArrayBuffer | Uint8Array, options?: CreateTreeOptions): Stack[];
declare type CreateTreeOptions = {
flatten?: boolean | undefined;
};
declare interface CreateTreeOptions {
flatten?: boolean;
}
declare type Entry = {
declare interface Entry {
spectra: Spectrum[];

@@ -188,13 +114,33 @@ ntuples: Ntuples;

tmp: Record<string, string | string[] | number | number[] | boolean | boolean[] | undefined>;
title?: string | undefined;
dataType?: string | undefined;
dataClass?: string | undefined;
jcampDX?: string | null | undefined;
jcampCS?: string | null | undefined;
twoD?: boolean | undefined;
minMax?: MinMax | undefined;
};
title?: string;
dataType?: string;
dataClass?: string;
jcampDX?: string;
jcampCS?: string;
twoD?: boolean;
minMax?: MinMax;
children?: Entry[];
shiftOffsetVal?: number;
shiftOffsetNum?: number;
xType?: string;
yType?: string;
chromatogram?: Chromatogram;
contourLines?: ContourLines;
}
declare type MinMax = {
z?: number[][] | undefined;
declare interface GenerateContourLinesOptions {
/**
* Number of positive / negative contour levels to calculate.
* @default `7`
*/
nbContourLevels: number;
/**
* Define for 2D the level as 5 times the median as default.
* @default `5`
*/
noiseMultiplier: number;
}
declare interface MinMax {
z: number[][];
minX: number;

@@ -206,50 +152,64 @@ maxX: number;

maxZ: number;
median: number;
};
median?: number;
noice?: number;
}
declare type Ntuples = {
varname?: string[] | undefined;
symbol?: string[] | undefined;
vartype?: string[] | undefined;
varform?: string[] | undefined;
vardim?: number[] | undefined;
units?: string[] | undefined;
factor?: number[] | undefined;
first?: number[] | undefined;
last?: number[] | undefined;
min?: number[] | undefined;
max?: number[] | undefined;
nucleus?: string[] | undefined;
};
declare interface Ntuples {
varname?: string[];
symbol?: string[];
vartype?: string[];
varform?: string[];
vardim?: number[];
units?: string[];
factor?: number[];
first?: number[];
last?: number[];
min?: number[];
max?: number[];
nucleus?: string[];
[key: string]: any | undefined;
}
declare type OCL = openchemlib;
declare interface ParsedCS {
molfile: string;
molecule: Molecule;
}
/**
*
* @typedef {object} ParsedCS@typedef {object} ParsedCS
* @property {string} molfile
* @property {import("openchemlib").OCL} molecule
*/
/**
*
* @param {import("./convert.js").Entry} entry
* @param {object} [options={}]
* @param {import("fifo-logger").Logger} [options.logger]
* @param {import("openchemlib").OCL} [options.OCL]
* @param entry
* @param options
* @returns ParsedCS
*/
export declare function parseJcampCS(entry: Entry, options?: {
logger?: any;
OCL?: any;
} | undefined): {
molecule: any;
molfile: any;
} | undefined;
export declare function parseJcampCS(entry: Entry, options: ParseJcampCSOptions): ParsedCS | undefined;
declare type Spectrum = Record<string, any>;
declare interface ParseJcampCSOptions {
OCL: OCL;
logger?: Logger;
}
declare type Tree = {
declare interface Spectrum {
[key: string]: any;
data: Record<string, number[]>;
firstX?: number;
firstY?: number;
lastX?: number;
deltaX?: number;
yFactor?: number;
xFactor?: number;
nbPoints?: number;
}
declare interface Stack {
title: string;
jcamp: string;
children?: Tree[] | undefined;
};
children: Stack[] | undefined;
jcampDX?: string;
jcampCS?: string;
dataType?: string;
dataClass?: string;
}
export { }
{
"name": "jcampconverter",
"version": "9.6.4",
"version": "10.0.0",
"description": "Parse and convert JCAMP data",
"types": "jcampconverter.d.ts",
"main": "jcampconverter.cjs",
"module": "jcampconverter.mjs",
"keywords": [
"jcamp",
"converter"
],
"author": "Luc Patiny",
"license": "MIT",
"types": "./jcampconverter.d.ts",
"require": "./jcampconverter.cjs",
"module": "./jcampconverter.mjs",
"exports": {

@@ -22,5 +28,6 @@ ".": {

"api-extractor": "api-extractor run --local",
"build": "cheminfo-build --entry src/index.js --root JcampConverter --no-source-map && rm dist/jcampconverter.js",
"benchmark": "node benchmark/benchmark.js",
"build": "tsc --project tsconfig.cheminfo-build.json && cheminfo-build --entry lib/index.js --root JcampConverter --no-source-map && rm dist/jcampconverter.js",
"bundle": "npm run bundle-cjs && npm run bundle-esm",
"bundle-common": "esbuild src/index.js --bundle --packages=external --minify",
"bundle-common": "esbuild src/index.ts --bundle --packages=external --minify",
"bundle-cjs": "npm run bundle-common -- --format=cjs --outfile=jcampconverter.cjs",

@@ -30,3 +37,5 @@ "bundle-esm": "npm run bundle-common -- --format=esm --outfile=jcampconverter.mjs",

"check-types": "tsc --noEmit",
"clean": "rimraf dist types",
"clean": "rimraf dist lib types",
"deopt": "node --trace-opt --trace-deopt --code-comments debug/deoptimize.js > deopt.log",
"hydra": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm debug/deoptimize.js",
"eslint": "eslint src __tests__",

@@ -36,17 +45,8 @@ "eslint-fix": "npm run eslint -- --fix",

"prepack": "npm run bundle && npm run bundle-types",
"prettier": "prettier --check src",
"prettier-write": "prettier --write src",
"test": "npm run test-only && npm run eslint && npm run prettier && npm run check-types",
"test-only": "vitest run --globals --coverage",
"tsc": "tsc --project tsconfig.types.json",
"benchmark": "node benchmark/benchmark.js",
"deopt": "node --trace-opt --trace-deopt --code-comments debug/deoptimize.js > deopt.log",
"hydra": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm debug/deoptimize.js"
"prettier": "prettier --check src __tests__",
"prettier-write": "prettier --write src __tests__",
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
"test-only": "vitest run --coverage",
"tsc": "tsc --project tsconfig.types.json"
},
"keywords": [
"jcamp",
"converter"
],
"author": "Luc Patiny",
"license": "MIT",
"bugs": {

@@ -56,30 +56,26 @@ "url": "https://github.com/cheminfo/nmrium/issues/new?title=%5Bjcampconverter%5D"

"devDependencies": {
"@microsoft/api-extractor": "^7.42.3",
"@types/jest": "^29.5.12",
"@types/pino": "^7.0.5",
"@vitest/coverage-v8": "^1.3.1",
"@microsoft/api-extractor": "^7.47.10",
"@vitest/coverage-v8": "^2.1.3",
"benchmark": "^2.1.4",
"c8": "^9.1.0",
"cheminfo-build": "^1.2.0",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^12.2.0",
"esm": "^3.2.25",
"fifo-logger": "^0.6.1",
"esbuild": "^0.24.0",
"eslint": "^9.12.0",
"eslint-config-cheminfo-typescript": "^16.0.0",
"fifo-logger": "^1.0.0",
"jest-matcher-deep-close-to": "^3.0.2",
"jscpd": "^3.5.10",
"ml-spectra-processing": "^14.2.0",
"openchemlib": "^8.9.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"typescript": "^5.4.2",
"vitest": "^1.3.1"
"jscpd": "^4.0.5",
"ml-spectra-processing": "^14.6.0",
"openchemlib": "^8.15.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"typescript": "^5.6.3",
"vitest": "^2.1.3"
},
"dependencies": {
"cheminfo-types": "^1.7.2",
"dynamic-typing": "^1.0.0",
"cheminfo-types": "^1.8.0",
"dynamic-typing": "^1.0.1",
"ensure-string": "^1.2.0",
"gyromagnetic-ratio": "^1.1.1",
"gyromagnetic-ratio": "^1.2.0",
"ml-array-median": "^1.1.6"
}
}
[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

@@ -85,4 +84,2 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5091526.svg)](https://doi.org/10.5281/zenodo.5091526)

[npm-url]: https://npmjs.org/package/jcampconverter
[codecov-image]: https://img.shields.io/codecov/c/github/cheminfo/jcampconverter.svg
[codecov-url]: https://codecov.io/gh/cheminfo/jcampconverter
[ci-image]: https://github.com/cheminfo/jcampconverter/workflows/Node.js%20CI/badge.svg?branch=main

@@ -89,0 +86,0 @@ [ci-url]: https://github.com/cheminfo/jcampconverter/actions?query=workflow%3A%22Node.js+CI%22

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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