mf-generator
Advanced tools
Comparing version 0.5.2 to 0.5.3
{ | ||
"name": "mf-generator", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "", | ||
@@ -23,3 +23,3 @@ "main": "src/index.js", | ||
"mf-finder": "^0.5.2", | ||
"mf-matcher": "^0.5.2", | ||
"mf-matcher": "^0.5.3", | ||
"mf-parser": "^0.5.2", | ||
@@ -26,0 +26,0 @@ "mf-utilities": "^0.5.2", |
@@ -8,3 +8,4 @@ 'use strict'; | ||
var result = generateMFs(mfsArray); | ||
expect(result[0].mf).toBe('HCl$YY'); | ||
expect(result[0].mf).toBe('HCl'); | ||
expect(result[0].comment).toBe('YY'); | ||
expect(result).toHaveLength(4); | ||
@@ -136,3 +137,4 @@ }); | ||
var result = generateMFs(mfsArray); | ||
expect(result[0].mf).toBe('CO$1>10 D2>20'); | ||
expect(result[0].mf).toBe('CO'); | ||
expect(result[0].comment).toBe('1>10 D2>20'); | ||
}); | ||
@@ -139,0 +141,0 @@ |
@@ -12,2 +12,3 @@ 'use strict'; | ||
* for each of them the monoisotopic mass and observed moniisotopic mass (m/z) | ||
* In the molecular formula there may be a comment after the '$' symbol | ||
* | ||
@@ -36,3 +37,2 @@ * @param keys | ||
module.exports = function generateMFs(keys, options = {}) { | ||
@@ -193,3 +193,2 @@ let { | ||
if (key) { | ||
result.parts[i] = key; | ||
if (key.indexOf('$') > -1) { | ||
@@ -199,2 +198,3 @@ comments.push(key.replace(/^[^$]*\$/, '')); | ||
} | ||
result.parts[i] = key; | ||
result.mf += key; | ||
@@ -208,6 +208,7 @@ } | ||
if (comments.length > 0) result.mf += `$${comments.join(' ')}`; | ||
if (comments.length > 0) { | ||
result.comment = comments.join(' '); | ||
} | ||
results.push(result); | ||
} | ||
} | ||
@@ -214,0 +215,0 @@ |
17055
415
Updatedmf-matcher@^0.5.3