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

mf-parser

Package Overview
Dependencies
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf-parser - npm Package Compare versions

Comparing version 0.5.9 to 0.5.10

8

package.json
{
"name": "mf-parser",
"version": "0.5.9",
"version": "0.5.10",
"description": "",

@@ -21,6 +21,6 @@ "main": "src/index.js",

"dependencies": {
"atom-sorter": "^0.5.9",
"chemical-elements": "^0.5.9",
"mf-utilities": "^0.5.9"
"atom-sorter": "^0.5.10",
"chemical-elements": "^0.5.10",
"mf-utilities": "^0.5.10"
}
}

@@ -43,3 +43,3 @@ 'use strict';

for (var key of Object.keys(tests)) {
check(key, tests[key]);
checkMF(key, tests[key]);
}

@@ -55,5 +55,5 @@ });

function check(mf, result) {
var parsed = parse(mf);
function checkMF(mf, result) {
let parsed = parse(mf);
expect(parsed).toMatchObject(result);
}

@@ -64,7 +64,7 @@ 'use strict';

for (let aTest of tests) {
check(aTest.parsed, aTest.result);
checkMF(aTest.parsed, aTest.result);
}
});
function check(parsed, result) {
function checkMF(parsed, result) {
var display = toDisplay(parsed);

@@ -71,0 +71,0 @@ expect(display).toMatchObject(result);

@@ -63,7 +63,7 @@ 'use strict';

for (let aTest of tests) {
check(aTest.mf, aTest.result);
checkMF(aTest.mf, aTest.result);
}
});
function check(mf, result) {
function checkMF(mf, result) {
var parsed = parse(mf);

@@ -70,0 +70,0 @@ var parts = toParts(parsed);

@@ -128,12 +128,12 @@ 'use strict';

if (!element) throw new Error(`Element not found: ${value.atom}`);
let isotopes = element.isotopes;
let isotopesArray = element.isotopes;
let ratios = normalize(value.ratio);
let max = Math.max(...ratios);
if (ratios.length > isotopes.length) {
if (ratios.length > isotopesArray.length) {
throw new Error(`the number of specified ratios is bigger that the number of stable isotopes: ${value.atom}`);
}
for (let i = 0; i < ratios.length; i++) {
result.mass += ratios[i] * isotopes[i].mass;
result.mass += ratios[i] * isotopesArray[i].mass;
if (max === ratios[i] && result.monoisotopicMass === 0) {
result.monoisotopicMass = isotopes[i].mass;
result.monoisotopicMass = isotopesArray[i].mass;
}

@@ -140,0 +140,0 @@ }

@@ -73,6 +73,6 @@ 'use strict';

function getDistribution(isotopes, ratio) {
function getDistribution(isotopesArray, ratio) {
let ratios = normalize(ratio);
let result = [];
if (ratios.length > isotopes.length) {
if (ratios.length > isotopesArray.length) {
throw new Error(`the number of specified ratios is bigger that the number of stable isotopes: ${isotopes}`);

@@ -82,3 +82,3 @@ }

result.push({
x: isotopes[i].mass,
x: isotopesArray[i].mass,
y: ratios[i]

@@ -85,0 +85,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