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

mf-utilities

Package Overview
Dependencies
Maintainers
0
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf-utilities - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

lib/src/getEutrophicationPotential.d.ts

12

package.json
{
"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 @@ }

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