Comparing version 0.5.9 to 0.5.10
{ | ||
"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 @@ }); |
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
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
54281
Updatedatom-sorter@^0.5.10
Updatedchemical-elements@^0.5.10
Updatedmf-utilities@^0.5.10