Comparing version 0.5.2 to 0.5.8
{ | ||
"name": "mf-parser", | ||
"version": "0.5.2", | ||
"version": "0.5.8", | ||
"description": "", | ||
@@ -21,6 +21,6 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"atom-sorter": "^0.5.2", | ||
"chemical-elements": "^0.5.2", | ||
"mf-utilities": "^0.5.2" | ||
"atom-sorter": "^0.5.8", | ||
"chemical-elements": "^0.5.8", | ||
"mf-utilities": "^0.5.8" | ||
} | ||
} |
@@ -35,4 +35,8 @@ 'use strict'; | ||
'(CH(CH3)2)3N.2HCl': [{ kind: 'openingParenthesis', value: '(' }, { kind: 'atom', value: 'C' }, { kind: 'atom', value: 'H' }, { kind: 'openingParenthesis', value: '(' }, { kind: 'atom', value: 'C' }, { kind: 'atom', value: 'H' }, { kind: 'multiplier', value: 3 }, { kind: 'closingParenthesis', value: ')' }, { kind: 'multiplier', value: 2 }, { kind: 'closingParenthesis', value: ')' }, { kind: 'multiplier', value: 3 }, { kind: 'atom', value: 'N' }, { kind: 'salt', value: '.' }, { kind: 'preMultiplier', value: 2 }, { kind: 'atom', value: 'H' }, { kind: 'atom', value: 'Cl' }], | ||
'C.C2.C3': [{ kind: 'atom', value: 'C' }, { kind: 'salt', value: '.' }, { kind: 'atom', value: 'C' }, { kind: 'multiplier', value: 2 }, { kind: 'salt', value: '.' }, { kind: 'atom', value: 'C' }, { kind: 'multiplier', value: 3 }], | ||
'C10.C20.C30': [{ kind: 'atom', value: 'C' }, { kind: 'multiplier', value: 10 }, { kind: 'salt', value: '.' }, { kind: 'atom', value: 'C' }, { kind: 'multiplier', value: 20 }, { kind: 'salt', value: '.' }, { kind: 'atom', value: 'C' }, { kind: 'multiplier', value: 30 }], | ||
'C.0.5H2O.0.6HCl': [{ kind: 'atom', value: 'C' }, { kind: 'salt', value: '.' }, { kind: 'preMultiplier', value: 0.5 }, { kind: 'atom', value: 'H' }, { kind: 'multiplier', value: 2 }, { kind: 'atom', value: 'O' }, { kind: 'salt', value: '.' }, { kind: 'preMultiplier', value: 0.6 }, { kind: 'atom', value: 'H' }, { kind: 'atom', value: 'Cl' }], | ||
}; | ||
test('parse molecular formula', function () { | ||
@@ -39,0 +43,0 @@ for (var key of Object.keys(tests)) { |
@@ -50,3 +50,2 @@ 'use strict'; | ||
// it must be in a salt | ||
} else if (ascii > 64 && ascii < 91) { // an uppercase = new atom | ||
@@ -118,3 +117,5 @@ let value = this.getAtom(ascii); | ||
let number = ''; | ||
let previous; | ||
do { | ||
previous = ascii; | ||
number += String.fromCharCode(ascii); | ||
@@ -125,3 +126,5 @@ this.i++; | ||
// we need to deal with the case there is a from / to | ||
if (previous === 46) this.i--; | ||
let indexOfDash = number.indexOf('-', 1); | ||
if (indexOfDash > -1) { | ||
@@ -128,0 +131,0 @@ return { from: Number(number.substr(0, indexOfDash)), to: Number(number.substr(indexOfDash + 1)) }; |
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
54230
1393
Updatedatom-sorter@^0.5.8
Updatedchemical-elements@^0.5.8
Updatedmf-utilities@^0.5.8