Comparing version 1.5.0 to 2.0.0
{ | ||
"name": "mf-parser", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"description": "Parse a molecular formula", | ||
"main": "src/index.js", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"files": [ | ||
"src" | ||
"src", | ||
"lib" | ||
], | ||
@@ -19,7 +21,8 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/cheminfo/mass-tools/tree/master/packages/mf-parser#readme", | ||
"homepage": "https://github.com/cheminfo/mass-tools/tree/main/packages/mf-parser#readme", | ||
"dependencies": { | ||
"atom-sorter": "^1.2.0", | ||
"chemical-elements": "^1.3.0", | ||
"chemical-groups": "^1.3.0" | ||
"atom-sorter": "^2.0.0", | ||
"chemical-elements": "^2.0.0", | ||
"chemical-groups": "^2.0.0", | ||
"mf-utilities": "^2.0.0" | ||
}, | ||
@@ -29,3 +32,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "ade929b07af4e2f0f8b3fe1aaf0df70c50f4b2db" | ||
"gitHead": "c6ebfbd64c711f8839a02a43c5708e71a379885b" | ||
} |
@@ -1,5 +0,4 @@ | ||
'use strict'; | ||
// import { capitalizeMF as ensureCase } from '../util/capitalizeMF.js'; | ||
import { ensureCase } from '../ensureCase.js'; | ||
const ensureCase = require('../ensureCase'); | ||
test('ensureCase', () => { | ||
@@ -6,0 +5,0 @@ expect(ensureCase('ch3cooh')).toBe('CH3COOH'); |
@@ -1,9 +0,7 @@ | ||
'use strict'; | ||
import { toMatchCloseTo } from 'jest-matcher-deep-close-to'; | ||
const toMatchCloseTo = require('jest-matcher-deep-close-to').toMatchCloseTo; | ||
import { MF } from '../MF'; | ||
expect.extend({ toMatchCloseTo }); | ||
let MF = require('../MF'); | ||
test('getEA', () => { | ||
@@ -10,0 +8,0 @@ expect(new MF('C').getEA()).toMatchCloseTo( |
@@ -1,9 +0,7 @@ | ||
'use strict'; | ||
import { toMatchCloseTo } from 'jest-matcher-deep-close-to'; | ||
const toMatchCloseTo = require('jest-matcher-deep-close-to').toMatchCloseTo; | ||
import { MF } from '..'; | ||
expect.extend({ toMatchCloseTo }); | ||
let MF = require('../MF'); | ||
test('getElements', () => { | ||
@@ -10,0 +8,0 @@ expect(new MF('C2').getElements()).toStrictEqual([ |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { MF } from '../MF'; | ||
let MF = require('../MF'); | ||
test('getIsotopesInfo from C{50,50}[13C]H2', () => { | ||
@@ -6,0 +4,0 @@ let mf = new MF('[13C]3CC{50,50}((2+))2'); |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { MF } from '..'; | ||
const MF = require('../MF'); | ||
describe('MF', () => { | ||
@@ -6,0 +4,0 @@ it('C', () => { |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { parse } from '../parse'; | ||
const parse = require('../parse'); | ||
let tests = { | ||
@@ -6,0 +4,0 @@ C10: [ |
@@ -1,6 +0,6 @@ | ||
'use strict'; | ||
import { elementsObject } from 'chemical-elements'; | ||
const elements = Object.keys( | ||
require('chemical-elements/src/elementsAndStableIsotopesObject.js'), | ||
).sort((a, b) => b.length - a.length); | ||
const elements = Object.keys(elementsObject).sort( | ||
(a, b) => b.length - a.length, | ||
); | ||
@@ -13,3 +13,3 @@ /** | ||
function capitalize(mf) { | ||
export function ensureCase(mf) { | ||
for (let i = 0; i < mf.length; i++) { | ||
@@ -40,8 +40,6 @@ if (mf.charCodeAt(i) > 64 && mf.charCodeAt(i) < 91) { | ||
j++; | ||
} else if (elements.includes(one)) { | ||
newPart += one; | ||
} else { | ||
if (elements.includes(one)) { | ||
newPart += one; | ||
} else { | ||
return mf; | ||
} | ||
return mf; | ||
} | ||
@@ -55,3 +53,1 @@ } | ||
} | ||
module.exports = capitalize; |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
/** | ||
@@ -7,3 +5,3 @@ * Defines static variables corresponding to the various formatting possibilities | ||
module.exports = { | ||
export const Format = { | ||
SUBSCRIPT: 'subscript', | ||
@@ -10,0 +8,0 @@ SUPERSCRIPT: 'superscript', |
@@ -1,30 +0,10 @@ | ||
'use strict'; | ||
const parse = require('./parse'); | ||
const { subscript, superscript } = require('./util/subSuperscript'); | ||
const toDisplay = require('./util/toDisplay'); | ||
const toHtml = require('./util/toHtml'); | ||
/** | ||
* Parse a molecular formula and converts it to an HTML code | ||
* @param {String} mf String containing the molecular formula | ||
*/ | ||
function parseToHtml(mf) { | ||
let parsed = parse(mf); | ||
let display = toDisplay(parsed); | ||
return toHtml(display); | ||
} | ||
module.exports = { | ||
Kind: require('./Kind'), | ||
Format: require('./Format'), | ||
Style: require('./Style'), | ||
parse: require('./parse'), | ||
ensureCase: require('./ensureCase'), | ||
toDisplay, | ||
toHtml, | ||
parseToHtml, | ||
subscript, | ||
superscript, | ||
MF: require('./MF'), | ||
}; | ||
export * from './parse.js'; | ||
export * from './util/subSuperscript.js'; | ||
export * from './util/toDisplay.js'; | ||
export * from './util/toHtml.js'; | ||
export * from './Kind.js'; | ||
export * from './Format.js'; | ||
export * from './Style.js'; | ||
export * from './ensureCase.js'; | ||
export * from './MF.js'; | ||
export * from './parseToHtml.js'; |
@@ -1,2 +0,1 @@ | ||
'use strict'; | ||
/** | ||
@@ -6,3 +5,3 @@ * Define static variable corresponding to the various Kinds of a molecular formula part. | ||
module.exports = { | ||
export const Kind = { | ||
BEGIN: 'begin', | ||
@@ -9,0 +8,0 @@ ATOM: 'atom', |
@@ -1,17 +0,18 @@ | ||
'use strict'; | ||
import { ensureCase } from './ensureCase'; | ||
import { parse } from './parse'; | ||
import { getEA } from './util/getEA'; | ||
import { getElements } from './util/getElements'; | ||
import { getInfo } from './util/getInfo'; | ||
import { getIsotopesInfo } from './util/getIsotopesInfo'; | ||
import { partsToDisplay } from './util/partsToDisplay'; | ||
import { partsToMF } from './util/partsToMF'; | ||
import { toDisplay } from './util/toDisplay'; | ||
import { toHtml } from './util/toHtml'; | ||
import { toParts } from './util/toParts'; | ||
import { toText } from './util/toText'; | ||
const ensureCase = require('./ensureCase'); | ||
const parse = require('./parse'); | ||
const getEA = require('./util/getEA'); | ||
const getElements = require('./util/getElements'); | ||
const getInfo = require('./util/getInfo'); | ||
const getIsotopesInfo = require('./util/getIsotopesInfo'); | ||
const partsToDisplay = require('./util/partsToDisplay'); | ||
const partsToMF = require('./util/partsToMF'); | ||
const toDisplay = require('./util/toDisplay'); | ||
const toHtml = require('./util/toHtml'); | ||
const toParts = require('./util/toParts'); | ||
const toText = require('./util/toText'); | ||
class MF { | ||
/** | ||
* Class allowing to deal with molecular formula and derived information | ||
*/ | ||
export class MF { | ||
constructor(mf, options = {}) { | ||
@@ -135,3 +136,1 @@ if (options.ensureCase) { | ||
} | ||
module.exports = MF; |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { Kind } from './Kind'; | ||
import { parseCharge } from './util/parseCharge'; | ||
const Kind = require('./Kind'); | ||
const parseCharge = require('./util/parseCharge'); | ||
/** | ||
@@ -11,5 +9,5 @@ * Parse a mf to an array of kind / value | ||
module.exports = function parse(mf) { | ||
export function parse(mf) { | ||
return new MFParser().parse(mf); | ||
}; | ||
} | ||
@@ -59,14 +57,12 @@ class MFParser { | ||
this.result[this.result.length - 1].value = value.from; | ||
} else if (value.to) { | ||
this.result.push({ | ||
kind: Kind.MULTIPLIER_RANGE, | ||
value: { | ||
from: Math.min(value.from, value.to), | ||
to: Math.max(value.from, value.to), | ||
}, | ||
}); | ||
} else { | ||
if (value.to) { | ||
this.result.push({ | ||
kind: Kind.MULTIPLIER_RANGE, | ||
value: { | ||
from: Math.min(value.from, value.to), | ||
to: Math.max(value.from, value.to), | ||
}, | ||
}); | ||
} else { | ||
this.result.push({ kind: Kind.MULTIPLIER, value: value.from }); | ||
} | ||
this.result.push({ kind: Kind.MULTIPLIER, value: value.from }); | ||
} | ||
@@ -73,0 +69,0 @@ continue; |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = { | ||
export const Style = { | ||
SUPERIMPOSE: | ||
@@ -5,0 +3,0 @@ 'flex-direction: column;display: inline-flex;justify-content: center;text-align: left;vertical-align: middle;', |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { capitalizeMF } from '../capitalizeMF'; | ||
const capitalizeMF = require('../capitalizeMF'); | ||
const tests = [ | ||
@@ -6,0 +4,0 @@ ['triethylamine', 'triethylamine'], |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { formatCharge } from '../formatCharge'; | ||
const formatCharge = require('../formatCharge'); | ||
test('formatCharge', () => { | ||
@@ -6,0 +4,0 @@ expect(formatCharge(-2)).toBe('-2'); |
@@ -1,13 +0,11 @@ | ||
'use strict'; | ||
import { parseCharge } from '../parseCharge'; | ||
const getCharge = require('../parseCharge'); | ||
test('getCharge', () => { | ||
expect(getCharge('---')).toBe(-3); | ||
expect(getCharge('+++')).toBe(3); | ||
expect(getCharge('---++')).toBe(-1); | ||
expect(getCharge('(-3)')).toBe(-3); | ||
expect(getCharge('(+1)')).toBe(1); | ||
expect(getCharge('(---)')).toBe(-3); | ||
expect(getCharge('(++)')).toBe(2); | ||
test('parseCharge', () => { | ||
expect(parseCharge('---')).toBe(-3); | ||
expect(parseCharge('+++')).toBe(3); | ||
expect(parseCharge('---++')).toBe(-1); | ||
expect(parseCharge('(-3)')).toBe(-3); | ||
expect(parseCharge('(+1)')).toBe(1); | ||
expect(parseCharge('(---)')).toBe(-3); | ||
expect(parseCharge('(++)')).toBe(2); | ||
}); |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { toDisplay } from '../toDisplay'; | ||
const toDisplay = require('../toDisplay'); | ||
let tests = [ | ||
@@ -6,0 +4,0 @@ { |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { parse } from '../../parse'; | ||
import { toParts } from '../toParts'; | ||
const parse = require('../../parse'); | ||
const toParts = require('../toParts'); | ||
let tests = [ | ||
@@ -7,0 +5,0 @@ { mf: 'C', result: [[{ kind: 'atom', value: 'C', multiplier: 1 }]] }, |
@@ -1,8 +0,5 @@ | ||
'use strict'; | ||
import { elementsObject } from 'chemical-elements'; | ||
import { groupsObject } from 'chemical-groups'; | ||
import { isMF } from 'mf-utilities'; | ||
const elements = require('chemical-elements').elementsObject; | ||
const groups = require('chemical-groups').getGroupsObject(); | ||
const isMF = require('../../../mf-utilities/src/isMF'); | ||
/** | ||
@@ -12,3 +9,3 @@ * Try to capitalize a molecular formula based on what end users 'would' expect | ||
module.exports = function capitalizeMF(mf) { | ||
export function capitalizeMF(mf) { | ||
if (!mf.match(/^[0-9a-zA-Z ]+/)) return mf; | ||
@@ -38,7 +35,7 @@ if (isMF(mf)) return mf; | ||
return newMF; | ||
}; | ||
} | ||
function getCasedLabel(label) { | ||
if (elements[label]) return label; | ||
if (groups[label]) return label; | ||
if (elementsObject[label]) return label; | ||
if (groupsObject[label]) return label; | ||
@@ -49,4 +46,4 @@ if (label === '') return label; | ||
label.substr(0, 1).toUpperCase() + label.substr(1).toLowerCase(); | ||
if (elements[label]) return casedLabel; | ||
if (groups[label]) return casedLabel; | ||
if (elementsObject[label]) return casedLabel; | ||
if (groupsObject[label]) return casedLabel; | ||
@@ -53,0 +50,0 @@ // we would like to cover chcl3, ch2o, ch2cl2, ccl4 |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = function formatCharge(charge) { | ||
export function formatCharge(charge) { | ||
if (charge === 1) return '+'; | ||
@@ -8,2 +6,2 @@ if (charge > 1) return `+${charge}`; | ||
return ''; | ||
}; | ||
} |
@@ -1,11 +0,11 @@ | ||
'use strict'; | ||
import { | ||
isotopesObject as isotopes, | ||
elementsObject as elements, | ||
} from 'chemical-elements'; | ||
import { groupsObject as groups } from 'chemical-groups'; | ||
const elements = require('chemical-elements').elementsObject; | ||
const groups = require('chemical-groups/src/groupsObject.js'); | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
import { getIsotopeRatioInfo } from './getIsotopeRatioInfo'; | ||
const getIsotopeRatioInfo = require('./getIsotopeRatioInfo'); | ||
const isotopes = require('./getIsotopesObject'); | ||
/** | ||
@@ -16,3 +16,3 @@ * | ||
*/ | ||
module.exports = function getEA(parts) { | ||
export function getEA(parts) { | ||
let results = {}; | ||
@@ -76,3 +76,3 @@ for (let part of parts) { | ||
return eas; | ||
}; | ||
} | ||
@@ -79,0 +79,0 @@ function addMass(results, atom, mass) { |
@@ -1,10 +0,5 @@ | ||
'use strict'; | ||
import { elementsObject, elementsAndIsotopesObject } from 'chemical-elements'; | ||
const { | ||
elementsObject, | ||
elementsAndIsotopesObject, | ||
} = require('chemical-elements'); | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
/** | ||
@@ -15,3 +10,3 @@ * | ||
*/ | ||
module.exports = function getElements(parts) { | ||
export function getElements(parts) { | ||
const elements = []; | ||
@@ -55,3 +50,3 @@ for (const part of parts) { | ||
return elements; | ||
}; | ||
} | ||
@@ -58,0 +53,0 @@ function addElement(elements, newElement) { |
@@ -1,15 +0,15 @@ | ||
'use strict'; | ||
import { | ||
ELECTRON_MASS, | ||
unsaturationsObject as unsaturations, | ||
elementsAndIsotopesObject as elements, | ||
isotopesObject as isotopes, | ||
} from 'chemical-elements'; | ||
import { groupsObject as groups } from 'chemical-groups'; | ||
const { ELECTRON_MASS } = require('chemical-elements/src/constants'); | ||
const elements = require('chemical-elements/src/elementsAndIsotopesObject.js'); | ||
const unsaturations = require('chemical-elements/src/unsaturationsObject.js'); | ||
const groups = require('chemical-groups/src/groupsObject.js'); | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
import { getIsotopeRatioInfo } from './getIsotopeRatioInfo'; | ||
import { partToAtoms } from './partToAtoms'; | ||
import { partToMF } from './partToMF'; | ||
const getIsotopeRatioInfo = require('./getIsotopeRatioInfo'); | ||
const isotopes = require('./getIsotopesObject'); | ||
const partToAtoms = require('./partToAtoms'); | ||
const partToMF = require('./partToMF'); | ||
/** | ||
@@ -20,3 +20,3 @@ * | ||
*/ | ||
module.exports = function getInfo(parts, options = {}) { | ||
export function getInfo(parts, options = {}) { | ||
let { customUnsaturations = {} } = options; | ||
@@ -43,3 +43,3 @@ if (parts.length === 0) return {}; | ||
return result; | ||
}; | ||
} | ||
@@ -46,0 +46,0 @@ function getProcessedPart(part, customUnsaturations) { |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { elementsAndStableIsotopesObject as elements } from 'chemical-elements'; | ||
const elements = require('chemical-elements').elementsAndStableIsotopesObject; | ||
function getIsotopeRatioInfo(value) { | ||
export function getIsotopeRatioInfo(value) { | ||
let result = { mass: 0, monoisotopicMass: 0 }; | ||
@@ -30,3 +28,1 @@ let element = elements[value.atom]; | ||
} | ||
module.exports = getIsotopeRatioInfo; |
@@ -1,9 +0,8 @@ | ||
'use strict'; | ||
import { | ||
elementsAndStableIsotopesObject as elements, | ||
isotopesObject as isotopes, | ||
} from 'chemical-elements'; | ||
const elements = require('chemical-elements/src/elementsAndStableIsotopesObject.js'); | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
const isotopes = require('./getIsotopesObject'); | ||
/** | ||
@@ -14,3 +13,3 @@ * | ||
*/ | ||
module.exports = function getIsotopesInfo(parts) { | ||
export function getIsotopesInfo(parts) { | ||
if (parts.length === 0) return []; | ||
@@ -22,3 +21,3 @@ if (parts.length > 1) { | ||
return getProcessedPart(parts[0]); | ||
}; | ||
} | ||
@@ -25,0 +24,0 @@ function getProcessedPart(part) { |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
/** | ||
@@ -9,3 +7,3 @@ * Parse a string to extract the charge | ||
module.exports = function parseCharge(charge) { | ||
export function parseCharge(charge) { | ||
charge = charge.replace(/[()]/g, ''); | ||
@@ -26,2 +24,2 @@ let chargeNumber = 0; | ||
return chargeNumber; | ||
}; | ||
} |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
const toDisplay = require('./toDisplay'); | ||
import { toDisplay } from './toDisplay.js'; | ||
/** | ||
@@ -11,3 +9,3 @@ * Converts an array of mf elements to an array of formatting information | ||
module.exports = function partsToDisplay(parts) { | ||
export function partsToDisplay(parts) { | ||
let lines = []; | ||
@@ -28,2 +26,2 @@ for (let part of parts) { | ||
return toDisplay(lines); | ||
}; | ||
} |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { partToMF } from './partToMF'; | ||
const partToMF = require('./partToMF'); | ||
module.exports = function partsToMF(parts, options) { | ||
export function partsToMF(parts, options) { | ||
let mf = []; | ||
@@ -11,2 +9,2 @@ for (let part of parts) { | ||
return mf.join(' . '); | ||
}; | ||
} |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
import { Kind } from '../Kind.js'; | ||
const Kind = require('../Kind'); | ||
/** | ||
@@ -11,3 +9,3 @@ * Convert a MF part to an array of atoms | ||
module.exports = function partToAtoms(part) { | ||
export function partToAtoms(part) { | ||
let atoms = {}; | ||
@@ -37,2 +35,2 @@ for (let line of part) { | ||
return atoms; | ||
}; | ||
} |
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
module.exports = function partToMF(part, options = {}) { | ||
export function partToMF(part, options = {}) { | ||
let mf = []; | ||
@@ -40,2 +38,2 @@ for (let line of part) { | ||
return mf.join(''); | ||
}; | ||
} |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
const superscript = { | ||
export const superscript = { | ||
0: '⁰', | ||
@@ -24,3 +22,3 @@ 1: '¹', | ||
const subscript = { | ||
export const subscript = { | ||
0: '₀', | ||
@@ -43,6 +41,1 @@ 1: '₁', | ||
}; | ||
module.exports = { | ||
superscript, | ||
subscript, | ||
}; |
@@ -1,14 +0,12 @@ | ||
'use strict'; | ||
import { Format } from '../Format'; | ||
import { Kind } from '../Kind'; | ||
const Format = require('../Format'); | ||
const Kind = require('../Kind'); | ||
import { formatCharge } from './formatCharge.js'; | ||
const formatCharge = require('./formatCharge'); | ||
/** | ||
* Converts an array of mf elements to an array of formatting information | ||
* @param {Array<Object>} result of the parse method | ||
* @param {object[]} lines of the parse method | ||
*/ | ||
module.exports = function convertForDisplay(lines) { | ||
export function toDisplay(lines) { | ||
let results = []; | ||
@@ -103,2 +101,2 @@ let result = {}; | ||
return results; | ||
}; | ||
} |
@@ -1,7 +0,5 @@ | ||
'use strict'; | ||
import { Format } from '../Format'; | ||
import { Style } from '../Style'; | ||
const Format = require('../Format'); | ||
const Style = require('../Style'); | ||
module.exports = function toHtml(lines) { | ||
export function toHtml(lines) { | ||
let html = []; | ||
@@ -31,2 +29,2 @@ for (let line of lines) { | ||
return html.join(''); | ||
}; | ||
} |
@@ -1,8 +0,6 @@ | ||
'use strict'; | ||
import { atomSorter } from 'atom-sorter'; | ||
import { groupsObject } from 'chemical-groups'; | ||
const atomSorter = require('atom-sorter'); | ||
const groups = require('chemical-groups/src/groupsObject.js'); | ||
import { Kind } from '../Kind'; | ||
const Kind = require('../Kind'); | ||
/** | ||
@@ -12,7 +10,7 @@ * | ||
* @param {object} [options={}] | ||
* @param {boolean} [options.expand=true] - Should we expand the groups | ||
* @param {boolean} [options.expand=true] - Should we expand the groupsObject | ||
*/ | ||
module.exports = function toParts(lines, options = {}) { | ||
const { expand: shouldExpandGroups = true } = options; | ||
export function toParts(lines, options = {}) { | ||
const { expand: shouldExpandgroupsObject = true } = options; | ||
let parts = []; | ||
@@ -28,3 +26,3 @@ let currentPart = createNewPart(); | ||
case Kind.CHARGE: | ||
currentPart.lines.push(Object.assign({}, line, { multiplier: 1 })); | ||
currentPart.lines.push({ ...line, multiplier: 1 }); | ||
break; | ||
@@ -60,5 +58,5 @@ case Kind.OPENING_PARENTHESIS: | ||
globalPartMultiplier(currentPart); | ||
if (shouldExpandGroups) expandGroups(parts); | ||
if (shouldExpandgroupsObject) expandgroupsObject(parts); | ||
return combineAtomsIsotopesCharges(parts); | ||
}; | ||
} | ||
@@ -121,3 +119,3 @@ function createNewPart() { | ||
function expandGroups(parts) { | ||
function expandgroupsObject(parts) { | ||
for (let part of parts) { | ||
@@ -128,3 +126,3 @@ let expanded = false; | ||
if (line.kind === Kind.ATOM) { | ||
let group = groups[line.value]; | ||
let group = groupsObject[line.value]; | ||
@@ -175,8 +173,6 @@ if (group) { | ||
} | ||
} else if (currentKey !== key.key) { | ||
result.push(key.value); | ||
} else { | ||
if (currentKey !== key.key) { | ||
result.push(key.value); | ||
} else { | ||
result[result.length - 1].multiplier += key.value.multiplier; | ||
} | ||
result[result.length - 1].multiplier += key.value.multiplier; | ||
} | ||
@@ -183,0 +179,0 @@ currentKey = key.key; |
@@ -1,8 +0,6 @@ | ||
'use strict'; | ||
import { Format } from '../Format'; | ||
const Format = require('../Format'); | ||
import { superscript, subscript } from './subSuperscript'; | ||
const { superscript, subscript } = require('./subSuperscript'); | ||
module.exports = function toText(lines) { | ||
export function toText(lines) { | ||
let text = []; | ||
@@ -62,2 +60,2 @@ for (let line of lines) { | ||
return text.join(''); | ||
}; | ||
} |
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
109720
41
3687
4
+ Addedmf-utilities@^2.0.0
+ Addedatom-sorter@2.2.0(transitive)
+ Addedchemical-elements@2.2.0(transitive)
+ Addedchemical-groups@2.2.2(transitive)
+ Addedmf-parser@2.3.1(transitive)
+ Addedmf-utilities@2.0.5(transitive)
- Removedatom-sorter@1.2.0(transitive)
- Removedchemical-elements@1.3.0(transitive)
- Removedchemical-groups@1.3.0(transitive)
- Removedpapaparse@5.4.1(transitive)
Updatedatom-sorter@^2.0.0
Updatedchemical-elements@^2.0.0
Updatedchemical-groups@^2.0.0