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

mf-parser

Package Overview
Dependencies
Maintainers
4
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf-parser - npm Package Compare versions

Comparing version 1.3.5 to 1.4.0

src/util/subSuperscript.js

6

package.json
{
"name": "mf-parser",
"version": "1.3.5",
"version": "1.4.0",
"description": "Parse a molecular formula",

@@ -22,3 +22,3 @@ "main": "src/index.js",

"atom-sorter": "^1.1.9",
"chemical-elements": "^1.1.13",
"chemical-elements": "^1.2.0",
"chemical-groups": "^1.2.1"

@@ -29,3 +29,3 @@ },

},
"gitHead": "3357658b99069e3a03c06471bc374c5effb919d8"
"gitHead": "b044512a459c82c7bb816c52d0e90d48b8ffeae3"
}

@@ -220,4 +220,5 @@ 'use strict';

let newMF = mf.toMF();
expect(newMF).toBe('O4S(-2)');
expect(mf.toMF()).toBe('O4S(-2)');
expect(mf.toText()).toBe('⁺SO₄⁺⁻²₂');
expect(mf.toCanonicText()).toBe('O₄S⁻²');

@@ -274,4 +275,5 @@ let neutralMF = mf.toNeutralMF();

let newMF = mf.toMF();
expect(newMF).toBe('C[13C]N4[15N]2');
expect(mf.toMF()).toBe('C[13C]N4[15N]2');
expect(mf.toText()).toBe('NC¹³C¹⁵N₂NN₂');
expect(mf.toCanonicText()).toBe('C¹³CN₄¹⁵N₂');
});

@@ -320,4 +322,4 @@

let newMF = mf.toMF();
expect(newMF).toBe('CC{50,50}H');
expect(mf.toMF()).toBe('CC{50,50}H');
expect(mf.toText()).toBe('HC⁽⁵⁰˙⁵⁰⁾C');

@@ -338,4 +340,3 @@ let info = mf.getInfo();

let newMF = mf.toMF();
expect(newMF).toBe('H');
expect(mf.toMF()).toBe('H');

@@ -356,4 +357,3 @@ let info = mf.getInfo();

let newMF = mf.toMF();
expect(newMF).toBe('C10H20');
expect(mf.toMF()).toBe('C10H20');

@@ -374,5 +374,5 @@ let info = mf.getInfo();

let newMF = mf.toMF();
expect(newMF).toBe('H6N2 . H2Cl2');
expect(mf.toMF()).toBe('H6N2 . H2Cl2');
expect(mf.toText()).toBe('2NH₃ • 2HCl');
});
});

@@ -17,2 +17,4 @@ 'use strict';

const { subscript, superscript } = require('./util/subSuperscript');
module.exports = {

@@ -27,3 +29,5 @@ Kind: require('./Kind'),

parseToHtml,
subscript,
superscript,
MF: require('./MF'),
};

@@ -14,2 +14,3 @@ 'use strict';

const toParts = require('./util/toParts');
const toText = require('./util/toText');

@@ -38,2 +39,17 @@ class MF {

toText() {
if (!this.cache.text) {
this.toDisplay();
this.cache.text = toText(this.cache.displayed);
}
return this.cache.text;
}
toCanonicText() {
if (!this.cache.canonicText) {
this.cache.canonicText = new MF(this.toMF()).toText(this.cache.displayed);
}
return this.cache.canonicText;
}
toParts(options) {

@@ -48,3 +64,3 @@ if (!this.cache.parts) {

* Returns an object with the global MF, global charge, monoisotopic mass and mass
* as well as the same informations for all the parts
* as well as the same information for all the parts
* @param {object} [options={}] options

@@ -51,0 +67,0 @@ */

'use strict';
const toDisplay = require('../toDisplay');
let tests = [

@@ -110,4 +112,2 @@ {

const toDisplay = require('../toDisplay');
test.each(tests)('toDisplay', (aTest) => {

@@ -114,0 +114,0 @@ let display = toDisplay(aTest.parsed);

@@ -6,3 +6,3 @@ 'use strict';

module.exports = function getHtml(lines) {
module.exports = function toHtml(lines) {
let html = [];

@@ -9,0 +9,0 @@ for (let line of lines) {

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