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.3.0 to 2.4.0

22

lib/index.js

@@ -14,12 +14,26 @@ 'use strict';

*/
class TargetMassCache {
/**
* @param {number} targetMass
* @param {Array} possibilities
* @param {object} [options={}]
* @param {boolean} [options.allowNeutral=false]
* @param {number} [options.charge=0]
* @param {number} [options.precision=100]
* @param {object} [options.filter={}]
* @param {number} [options.filter.minCharge=Number.MIN_SAFE_INTEGER]
* @param {number} [options.filter.maxCharge=Number.MAX_SAFE_INTEGER]
* @returns
*/
constructor(targetMass, possibilities, options = {}) {
const {
allowNeutral = false, // msem because em in this case !
minCharge = Number.MIN_SAFE_INTEGER,
maxCharge = Number.MAX_SAFE_INTEGER,
filter = {},
charge = 0,
precision = 100,
} = options;
const {
minCharge = Number.MIN_SAFE_INTEGER,
maxCharge = Number.MAX_SAFE_INTEGER,
} = filter;

@@ -179,3 +193,3 @@ if (!possibilities || possibilities.length === 0) return;

...options,
...{ charge: ionization.charge },
charge: ionization.charge,
});

@@ -182,0 +196,0 @@

8

package.json
{
"name": "mf-finder",
"version": "2.3.0",
"version": "2.4.0",
"description": "Find a molecular formula from a monoisotopic mass",

@@ -27,6 +27,6 @@ "types": "mfFinder.d.ts",

"mf-matcher": "^2.1.0",
"mf-parser": "^2.2.1",
"mf-utilities": "^2.0.3"
"mf-parser": "^2.3.0",
"mf-utilities": "^2.0.4"
},
"gitHead": "d309de1c7a86730c8e4f0bd836896e1a16c95cb7"
"gitHead": "2f92cd4423018e7dad9594565f1fae4557de0ca3"
}

@@ -35,2 +35,22 @@ import { findMFs } from '..';

it('basic case with negative charge and wrong parameters', async () => {
let result = await findMFs(24 + 35.5, {
ranges: [{ mf: 'C', min: 1, max: 2 }],
minCharge: 1, // this is a mistake, it should not be at this level
precision: 1e5,
ionizations: 'Cl-',
});
expect(result.mfs).toHaveLength(1);
});
it('basic case with negative charge', async () => {
let result = await findMFs(24 + 35.5, {
ranges: [{ mf: 'C', min: 1, max: 2 }],
filter: { minCharge: 1 }, // this is a mistake, it should not be at this level
precision: 1e5,
ionizations: 'Cl-',
});
expect(result.mfs).toHaveLength(0);
});
it('basic case with charge and extreme error', async () => {

@@ -37,0 +57,0 @@ let result = await findMFs(24, {

@@ -31,4 +31,3 @@ import { preprocessRanges } from 'mf-utilities';

let cache = new TargetMassCache(100, possibilities, {
minCharge: -1,
maxCharge: 2,
filter: { minCharge: -1, maxCharge: 2 },
});

@@ -42,4 +41,3 @@ expect(cache.minCharge).toBe(-1);

let cache = new TargetMassCache(100, possibilities, {
minCharge: -1,
maxCharge: 2,
filter: { minCharge: -1, maxCharge: 2 },
precision: 1000,

@@ -58,4 +56,3 @@ allowNeutral: true,

let cache = new TargetMassCache(100, possibilities, {
minCharge: -1,
maxCharge: 2,
filter: { minCharge: -1, maxCharge: 2 },
precision: 1000,

@@ -81,4 +78,3 @@ });

let cache = new TargetMassCache(100, possibilities, {
minCharge: -1,
maxCharge: 1,
filter: { minCharge: -1, maxCharge: 1 },
allowNeutral: false,

@@ -106,4 +102,3 @@ precision: 1e6,

charge: 1,
minCharge: -1,
maxCharge: 1,
filter: { minCharge: -1, maxCharge: 1 },
allowNeutral: false,

@@ -110,0 +105,0 @@ precision: 1e6,

@@ -104,3 +104,3 @@ import { atomSorter } from 'atom-sorter';

...options,
...{ charge: ionization.charge },
charge: ionization.charge,
});

@@ -107,0 +107,0 @@

@@ -6,12 +6,26 @@ import { ELECTRON_MASS } from 'chemical-elements';

*/
export class TargetMassCache {
/**
* @param {number} targetMass
* @param {Array} possibilities
* @param {object} [options={}]
* @param {boolean} [options.allowNeutral=false]
* @param {number} [options.charge=0]
* @param {number} [options.precision=100]
* @param {object} [options.filter={}]
* @param {number} [options.filter.minCharge=Number.MIN_SAFE_INTEGER]
* @param {number} [options.filter.maxCharge=Number.MAX_SAFE_INTEGER]
* @returns
*/
constructor(targetMass, possibilities, options = {}) {
const {
allowNeutral = false, // msem because em in this case !
minCharge = Number.MIN_SAFE_INTEGER,
maxCharge = Number.MAX_SAFE_INTEGER,
filter = {},
charge = 0,
precision = 100,
} = options;
const {
minCharge = Number.MIN_SAFE_INTEGER,
maxCharge = Number.MAX_SAFE_INTEGER,
} = filter;

@@ -18,0 +32,0 @@ if (!possibilities || possibilities.length === 0) return;

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