mf-generator
Advanced tools
Comparing version 1.3.8 to 1.3.9
{ | ||
"name": "mf-generator", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "b044512a459c82c7bb816c52d0e90d48b8ffeae3" | ||
"gitHead": "095f36ed651b5cbc026f1169ebaf4f146d6bbc29" | ||
} |
@@ -156,5 +156,29 @@ 'use strict'; | ||
let result = generateMFs(mfsArray, { canonizeMF: true })[0]; | ||
expect(JSON.stringify(result)).toBe( | ||
'{"charge":0,"em":96,"mw":96.08588717388199,"ionization":{"mf":"","em":0,"charge":0},"unsaturation":9,"atoms":{"C":8},"ms":{"ionization":"","em":0,"charge":0},"parts":["C",null,"C5(C)2"],"mf":"C8"}', | ||
); | ||
expect(result).toMatchInlineSnapshot(` | ||
Object { | ||
"atoms": Object { | ||
"C": 8, | ||
}, | ||
"charge": 0, | ||
"em": 96, | ||
"ionization": Object { | ||
"charge": 0, | ||
"em": 0, | ||
"mf": "", | ||
}, | ||
"mf": "C8", | ||
"ms": Object { | ||
"charge": 0, | ||
"em": 0, | ||
"ionization": "", | ||
}, | ||
"mw": 96.08588717388199, | ||
"parts": Array [ | ||
"C", | ||
, | ||
"C5(C)2", | ||
], | ||
"unsaturation": 9, | ||
} | ||
`); | ||
}); | ||
@@ -161,0 +185,0 @@ |
@@ -241,6 +241,2 @@ 'use strict'; | ||
let match = matcher(result, filter); | ||
if (!match) continue; | ||
result.ms = match.ms; | ||
result.ionization = match.ionization; | ||
result.parts = []; | ||
@@ -261,10 +257,18 @@ result.mf = ''; | ||
} | ||
if (comments.length > 0) { | ||
result.comment = comments.join(' '); | ||
} | ||
let match = matcher(result, filter); | ||
if (!match) continue; | ||
result.ms = match.ms; | ||
result.ionization = match.ionization; | ||
if (canonizeMF) { | ||
result.mf = new MF(result.mf).toMF(); | ||
} | ||
if (comments.length > 0) { | ||
result.comment = comments.join(' '); | ||
} | ||
results.push(result); | ||
} | ||
} |
19408
470