mf-utilities
Advanced tools
Comparing version 1.4.2 to 1.5.0
{ | ||
"name": "mf-utilities", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "Small utilities dealing with molecular formula", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"main": "src/index.js", | ||
"files": [ | ||
"src", | ||
"lib" | ||
"src" | ||
], | ||
@@ -21,9 +19,9 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/cheminfo/mass-tools/tree/main/packages/mf-utilities#readme", | ||
"homepage": "https://github.com/cheminfo/mass-tools/tree/master/packages/mf-utilities#readme", | ||
"dependencies": { | ||
"chemical-elements": "^1.2.4", | ||
"chemical-groups": "^1.2.2", | ||
"mf-parser": "^1.4.8" | ||
"chemical-elements": "^1.3.0", | ||
"chemical-groups": "^1.3.0", | ||
"mf-parser": "^1.5.0" | ||
}, | ||
"gitHead": "bd2c06e05f2196c5f9c6ff011cf3ef41e1b6a0f9" | ||
"gitHead": "ade929b07af4e2f0f8b3fe1aaf0df70c50f4b2db" | ||
} |
@@ -1,3 +0,5 @@ | ||
import { getEutrophicationPotential } from '../getEutrophicationPotential'; | ||
'use strict'; | ||
const getEutrophicationPotential = require('../getEutrophicationPotential'); | ||
describe('getEutrophicationPotential', () => { | ||
@@ -4,0 +6,0 @@ it('result for C5 H10 O2 P N3', () => { |
@@ -1,3 +0,5 @@ | ||
import { getMsInfo } from '../getMsInfo'; | ||
'use strict'; | ||
const getMsInfo = require('../getMsInfo'); | ||
test('getMsInfo', () => { | ||
@@ -4,0 +6,0 @@ let mf = { |
@@ -1,3 +0,5 @@ | ||
import { getRangesForFragment } from '../getRangesForFragment'; | ||
'use strict'; | ||
const getRangesForFragment = require('../getRangesForFragment'); | ||
describe('getRangesForFragment', () => { | ||
@@ -4,0 +6,0 @@ it('Phe (CH2) C0-2 H0-2', () => { |
@@ -1,3 +0,5 @@ | ||
import { isMF } from '../isMF'; | ||
'use strict'; | ||
const isMF = require('../isMF'); | ||
const tests = [ | ||
@@ -4,0 +6,0 @@ ['triethylamine', false], |
@@ -1,3 +0,5 @@ | ||
import { mfDiff } from '../mfDiff'; | ||
'use strict'; | ||
const mfDiff = require('../mfDiff'); | ||
const tests = [ | ||
@@ -4,0 +6,0 @@ ['C10', 'C5', 'C5'], |
@@ -1,3 +0,5 @@ | ||
import { preprocessIonizations } from '../preprocessIonizations'; | ||
'use strict'; | ||
const preprocessIonizations = require('../preprocessIonizations'); | ||
describe('preprocessIonizations', () => { | ||
@@ -4,0 +6,0 @@ it('check ionizations', () => { |
@@ -1,3 +0,5 @@ | ||
import { preprocessRanges } from '../preprocessRanges'; | ||
'use strict'; | ||
const preprocessRanges = require('../preprocessRanges'); | ||
describe('preprocessRanges', () => { | ||
@@ -4,0 +6,0 @@ it('check the result and the order', () => { |
@@ -1,3 +0,5 @@ | ||
import { processRange } from '../processRange'; | ||
'use strict'; | ||
const processRange = require('../processRange'); | ||
const tests = [ | ||
@@ -4,0 +6,0 @@ ['C1-3', ['C', 'C2', 'C3']], |
@@ -1,4 +0,6 @@ | ||
import { MF } from 'mf-parser'; | ||
'use strict'; | ||
export function getEutrophicationPotential(mfString) { | ||
const MF = require('mf-parser').MF; | ||
function getEutrophicationPotential(mfString) { | ||
let parsed = new MF(mfString); | ||
@@ -38,1 +40,3 @@ let info = parsed.getInfo(); | ||
} | ||
module.exports = getEutrophicationPotential; |
@@ -1,4 +0,6 @@ | ||
import { ELECTRON_MASS } from 'chemical-elements'; | ||
'use strict'; | ||
export function getMsem(em, charge) { | ||
const { ELECTRON_MASS } = require('chemical-elements/src/constants'); | ||
module.exports = function getMsem(em, charge) { | ||
if (charge > 0) { | ||
@@ -11,2 +13,2 @@ return em / charge - ELECTRON_MASS; | ||
} | ||
} | ||
}; |
@@ -1,3 +0,5 @@ | ||
import { getMsem } from './getMsem'; | ||
'use strict'; | ||
const getMsem = require('./getMsem'); | ||
/** | ||
@@ -9,3 +11,3 @@ * Returns an object containing: | ||
export function getMsInfo(entry, options = {}) { | ||
module.exports = function getMsInfo(entry, options = {}) { | ||
const { | ||
@@ -41,2 +43,2 @@ allowNeutralMolecules, | ||
}; | ||
} | ||
}; |
@@ -1,4 +0,7 @@ | ||
import { Kind, parse } from 'mf-parser'; | ||
'use strict'; | ||
export function getRangesForFragment(ranges) { | ||
const Kind = require('mf-parser/src/Kind'); | ||
const parse = require('mf-parser/src/parse'); | ||
function getRangesForFragment(ranges) { | ||
ranges = JSON.parse(JSON.stringify(ranges)); | ||
@@ -89,1 +92,3 @@ if (typeof ranges === 'string') { | ||
} | ||
module.exports = getRangesForFragment; |
@@ -1,9 +0,13 @@ | ||
export * from './getEutrophicationPotential.js'; | ||
export * from './getMsem.js'; | ||
export * from './getMsInfo.js'; | ||
export * from './mfDiff.js'; | ||
export * from './isMF.js'; | ||
export * from './preprocessIonizations.js'; | ||
export * from './preprocessRanges.js'; | ||
export * from './getRangesForFragment.js'; | ||
export * from './processRange.js'; | ||
'use strict'; | ||
module.exports = { | ||
getEutrophicationPotential: require('./getEutrophicationPotential.js'), | ||
getMsem: require('./getMsem.js'), | ||
getMsInfo: require('./getMsInfo.js'), | ||
mfDiff: require('./mfDiff.js'), | ||
isMF: require('./isMF.js'), | ||
preprocessIonizations: require('./preprocessIonizations.js'), | ||
preprocessRanges: require('./preprocessRanges.js'), | ||
getRangesForFragment: require('./getRangesForFragment.js'), | ||
processRange: require('./processRange.js'), | ||
}; |
@@ -1,9 +0,11 @@ | ||
import { elementsObject } from 'chemical-elements'; | ||
import { groupsObject } from 'chemical-groups'; | ||
'use strict'; | ||
export function isMF(mf) { | ||
let elements = require('chemical-elements').elementsObject; | ||
let groups = require('chemical-groups').getGroupsObject(); | ||
function isMF(mf) { | ||
let tmpMF = mf.replace(/[^a-zA-Z]/g, ''); | ||
let parts = tmpMF.replace(/([A-Za-z])(?=[A-Z])/g, '$1 ').split(' '); | ||
for (let i = 0; i < parts.length; i++) { | ||
if (!elementsObject[parts[i]] && !groupsObject[parts[i]]) { | ||
if (!elements[parts[i]] && !groups[parts[i]]) { | ||
return false; | ||
@@ -15,1 +17,3 @@ } | ||
} | ||
module.exports = isMF; |
@@ -1,4 +0,6 @@ | ||
import { MF } from 'mf-parser'; | ||
'use strict'; | ||
export function mfDiff(mfString1, mfString2) { | ||
const MF = require('mf-parser').MF; | ||
function mfDiff(mfString1, mfString2) { | ||
let mf1 = new MF(mfString1).getInfo().atoms; | ||
@@ -17,1 +19,3 @@ let mf2 = new MF(mfString2).getInfo().atoms; | ||
} | ||
module.exports = mfDiff; |
@@ -1,6 +0,8 @@ | ||
import { MF } from 'mf-parser'; | ||
'use strict'; | ||
import { processRange } from './processRange'; | ||
const MF = require('mf-parser/src/MF'); | ||
export function preprocessIonizations(ionizationsString = '') { | ||
const processRange = require('./processRange'); | ||
module.exports = function preprocessIonizations(ionizationsString = '') { | ||
if (Array.isArray(ionizationsString)) return ionizationsString; | ||
@@ -27,2 +29,2 @@ let ionizations = ionizationsString.split(/ *[.,;\t\r\n]+ */); | ||
return results; | ||
} | ||
}; |
@@ -1,4 +0,8 @@ | ||
import { Kind, MF, parse } from 'mf-parser'; | ||
'use strict'; | ||
export function preprocessRanges(ranges) { | ||
const Kind = require('mf-parser/src/Kind'); | ||
const MF = require('mf-parser/src/MF'); | ||
const parse = require('mf-parser/src/parse'); | ||
module.exports = function preprocessRanges(ranges) { | ||
ranges = JSON.parse(JSON.stringify(ranges)); | ||
@@ -180,2 +184,2 @@ if (typeof ranges === 'string') { | ||
return possibilities; | ||
} | ||
}; |
@@ -1,2 +0,4 @@ | ||
export function processRange(string, comment, options = {}) { | ||
'use strict'; | ||
function processRange(string, comment, options = {}) { | ||
const { limit } = options; | ||
@@ -106,1 +108,3 @@ let results = []; | ||
} | ||
module.exports = processRange; |
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
24918
21
755
Updatedchemical-elements@^1.3.0
Updatedchemical-groups@^1.3.0
Updatedmf-parser@^1.5.0