Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mf-finder

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf-finder - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

42

lib/index.js

@@ -101,4 +101,4 @@ 'use strict';

* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {number} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}

@@ -471,4 +471,4 @@ * @param {function} [options.filter.callback] - a function to filter the MF

* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {number} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}

@@ -483,9 +483,31 @@ * @param {function} [options.filter.callback] - a function to filter the MF

function mfIncluded(target, range) {
let targetEM = new mfParser.MF(target).getInfo().monoisotopicMass;
/**
* @param {string} mf - the molecular formula to check
* @param {string} range - the range of MF to explore
* @param {object} [options={}]
* @param {number} [options.maxIterations=10000000] - Maximum number of iterations
* @param {boolean} [options.allowNeutral=true]
* @param {string} [options.ionizations=''] - string containing a comma separated list of modifications
* @param {object} [options.filter={}]
* @param {number} [options.filter.minCharge=-Infinity] - Minimal charge
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge
* @param {object} [options.filter.unsaturation={}]
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation
* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}
* @param {function} [options.filter.callback] - a function to filter the MF
* @returns {boolean}
*/
function mfIncluded(mf, range, options = {}) {
let targetEM = new mfParser.MF(mf).getInfo().monoisotopicMass;
let results = findMFsSync(targetEM, {
ranges: range,
allowNeutral: true,
precision: 0.0000001,
limit: 1,
...{ allowNeutral: true },
...options,
...{
ranges: range,
precision: 0.0000001,
limit: 1,
},
});

@@ -492,0 +514,0 @@ return results.mfs.length > 0;

{
"name": "mf-finder",
"version": "2.1.0",
"version": "2.2.0",
"description": "Find a molecular formula from a monoisotopic mass",

@@ -26,7 +26,7 @@ "types": "mfFinder.d.ts",

"chemical-elements": "^2.0.0",
"mf-matcher": "^2.0.0",
"mf-parser": "^2.0.0",
"mf-utilities": "^2.0.0"
"mf-matcher": "^2.0.1",
"mf-parser": "^2.1.0",
"mf-utilities": "^2.0.1"
},
"gitHead": "a251588b5e17f41fca3ae93ee65fea7b4e9f0e76"
"gitHead": "5dbfd516cc7f0aa51bca03f1e2384775b047db8a"
}

@@ -11,3 +11,18 @@ import { mfIncluded } from '..';

expect(mfIncluded('C2H6O', 'Me0-5(CH3O)0-5')).toBeTruthy();
expect(
mfIncluded('C2H6O', 'Me0-5(CH3O)0-5', {
filter: { unsaturation: { min: 0 } },
}),
).toBeTruthy();
expect(
mfIncluded('C2H6O', 'Me0-5(CH3O)0-5', {
filter: { unsaturation: { min: 1 } },
}),
).toBeFalsy();
expect(
mfIncluded('C2H6O', 'Me0-5(CH3O)0-5', {
filter: { unsaturation: { min: 1 } },
}),
).toBeFalsy();
expect(mfIncluded('C2H6O', 'Me0-5')).toBeFalsy();
});

@@ -19,4 +19,4 @@ import { findMFsSync } from './findMFsSync';

* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {number} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}

@@ -23,0 +23,0 @@ * @param {function} [options.filter.callback] - a function to filter the MF

@@ -27,4 +27,4 @@ import { atomSorter } from 'atom-sorter';

* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {number} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}

@@ -31,0 +31,0 @@ * @param {function} [options.filter.callback] - a function to filter the MF

@@ -5,11 +5,33 @@ import { MF } from 'mf-parser';

export function mfIncluded(target, range) {
let targetEM = new MF(target).getInfo().monoisotopicMass;
/**
* @param {string} mf - the molecular formula to check
* @param {string} range - the range of MF to explore
* @param {object} [options={}]
* @param {number} [options.maxIterations=10000000] - Maximum number of iterations
* @param {boolean} [options.allowNeutral=true]
* @param {string} [options.ionizations=''] - string containing a comma separated list of modifications
* @param {object} [options.filter={}]
* @param {number} [options.filter.minCharge=-Infinity] - Minimal charge
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge
* @param {object} [options.filter.unsaturation={}]
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation
* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation
* @param {boolean} [options.filter.unsaturation.onlyInteger=false] - Integer unsaturation
* @param {boolean} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation
* @param {object} [options.filter.atoms] - object of atom:{min, max}
* @param {function} [options.filter.callback] - a function to filter the MF
* @returns {boolean}
*/
export function mfIncluded(mf, range, options = {}) {
let targetEM = new MF(mf).getInfo().monoisotopicMass;
let results = findMFsSync(targetEM, {
ranges: range,
allowNeutral: true,
precision: 0.0000001,
limit: 1,
...{ allowNeutral: true },
...options,
...{
ranges: range,
precision: 0.0000001,
limit: 1,
},
});
return results.mfs.length > 0;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc