mf-utilities
Advanced tools
Comparing version 3.2.0 to 3.2.1
{ | ||
"name": "mf-utilities", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Small utilities dealing with molecular formula", | ||
"main": "lib/index.js", | ||
"main": "lib/src/index.js", | ||
"module": "src/index.js", | ||
@@ -23,7 +23,7 @@ "files": [ | ||
"dependencies": { | ||
"chemical-elements": "^2.1.0", | ||
"chemical-groups": "^2.2.0", | ||
"mf-parser": "^3.2.0" | ||
"chemical-elements": "^2.1.1", | ||
"chemical-groups": "^2.2.1", | ||
"mf-parser": "^3.2.1" | ||
}, | ||
"gitHead": "28dae91d3b42556a23097ee08acfe4061f276ed0" | ||
"gitHead": "838f98a30846d4b1721b8ed7aa94a55e854d7521" | ||
} |
import { Kind, parse } from 'mf-parser'; | ||
export function getRangesForFragment(ranges) { | ||
ranges = JSON.parse(JSON.stringify(ranges)); | ||
ranges = structuredClone(ranges); | ||
if (typeof ranges === 'string') { | ||
// need to convert to ranges | ||
let parsed = parse(ranges.replace(/[\r\n\t ]/g, '')); | ||
let parsed = parse(ranges.replaceAll(/[\t\n\r ]/g, '')); | ||
let newRanges = []; | ||
// example ClBr2(CH2)0-2NO | ||
// the idea is that has long as we don't have a range we don't really care | ||
// the idea is that as long as we don't have a range we don't really care | ||
// there is a limitation is that the range has to be first level of parenthesis | ||
@@ -72,3 +72,3 @@ let parenthesisLevel = 0; | ||
default: | ||
throw Error(`can not preprocess ${ranges}`); | ||
throw new Error(`can not preprocess ${ranges}`); | ||
} | ||
@@ -75,0 +75,0 @@ } |
@@ -7,5 +7,5 @@ import { MF } from 'mf-parser'; | ||
let atoms = Object.keys(mf1); | ||
Object.keys(mf2).forEach((atom) => { | ||
for (const atom of Object.keys(mf2)) { | ||
if (!atoms.includes(atom)) atoms.push(atom); | ||
}); | ||
} | ||
let mf = ''; | ||
@@ -12,0 +12,0 @@ for (let atom of atoms) { |
@@ -5,3 +5,3 @@ import { MF } from 'mf-parser'; | ||
if (Array.isArray(ionizationsString)) return ionizationsString; | ||
let ionizations = ionizationsString.split(/ *[.,;\t\r\n]+ */); | ||
let ionizations = ionizationsString.split(/ *[\t\n\r,.;]+ */); | ||
@@ -8,0 +8,0 @@ // it is allowed to have ranges in Ionizations. We need to explode them. |
import { Kind, MF, parse } from 'mf-parser'; | ||
export function preprocessRanges(ranges) { | ||
ranges = JSON.parse(JSON.stringify(ranges)); | ||
ranges = structuredClone(ranges); | ||
if (typeof ranges === 'string') { | ||
// need to convert to ranges | ||
let parsed = parse(ranges.replace(/[\r\n\t ]/g, '')); | ||
let parsed = parse(ranges.replaceAll(/[\t\n\r ]/g, '')); | ||
let newRanges = []; | ||
@@ -64,3 +64,3 @@ let current = { | ||
default: | ||
throw Error(`can not preprocess ${ranges}`); | ||
throw new Error(`can not preprocess ${ranges}`); | ||
} | ||
@@ -67,0 +67,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
64963
28
2
Updatedchemical-elements@^2.1.1
Updatedchemical-groups@^2.2.1
Updatedmf-parser@^3.2.1