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

mf-parser

Package Overview
Dependencies
Maintainers
6
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 0.6.2 to 0.6.3

8

package.json
{
"name": "mf-parser",
"version": "0.6.2",
"version": "0.6.3",
"description": "",

@@ -21,6 +21,6 @@ "main": "src/index.js",

"dependencies": {
"atom-sorter": "^0.6.2",
"chemical-elements": "^0.6.2",
"mf-utilities": "^0.6.2"
"atom-sorter": "^0.6.3",
"chemical-elements": "^0.6.3",
"mf-utilities": "^0.6.3"
}
}

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

* @param {*} parts
* @param {*} options
* @param {*} [options={}]
*/

@@ -19,0 +19,0 @@ module.exports = function getInfo(parts, options = {}) {

@@ -15,5 +15,3 @@ 'use strict';

module.exports = function toParts(lines, options = {}) {
const {
expand: shouldExpandGroups = true
} = options;
const { expand: shouldExpandGroups = true } = options;
let parts = [];

@@ -53,2 +51,4 @@

break;
case Kind.TEXT:
break;
default:

@@ -84,4 +84,9 @@ throw new Error(`Can not process mf having: ${line.kind}`);

if (currentPart.currentMultiplier !== 1) {
for (let i = currentPart.currentMultiplier.fromIndex; i < currentPart.lines.length; i++) {
currentPart.lines[i].multiplier *= currentPart.currentMultiplier.value;
for (
let i = currentPart.currentMultiplier.fromIndex;
i < currentPart.lines.length;
i++
) {
currentPart.lines[i].multiplier *=
currentPart.currentMultiplier.value;
}

@@ -96,3 +101,7 @@ }

function globalPartMultiplier(currentPart) {
for (let i = currentPart.multipliers[0].fromIndex; i < currentPart.lines.length; i++) {
for (
let i = currentPart.multipliers[0].fromIndex;
i < currentPart.lines.length;
i++
) {
currentPart.lines[i].multiplier *= currentPart.multipliers[0].value;

@@ -105,6 +114,11 @@ }

// need to apply to everything till the previous parenthesis
for (let i = currentPart.currentMultiplier.fromIndex; i < currentPart.lines.length; i++) {
for (
let i = currentPart.currentMultiplier.fromIndex;
i < currentPart.lines.length;
i++
) {
currentPart.lines[i].multiplier *= value;
}
} else { // just applies to the previous element
} else {
// just applies to the previous element
currentPart.lines[currentPart.lines.length - 1].multiplier *= value;

@@ -154,3 +168,4 @@ }

} else {
result[result.length - 1].value += key.value.value * key.value.multiplier;
result[result.length - 1].value +=
key.value.value * key.value.multiplier;
}

@@ -161,3 +176,4 @@ } else {

} else {
result[result.length - 1].multiplier += key.value.multiplier;
result[result.length - 1].multiplier +=
key.value.multiplier;
}

@@ -203,3 +219,3 @@ }

switch (line.kind) {
case (Kind.CHARGE):
case Kind.CHARGE:
break;

@@ -223,2 +239,1 @@ default:

}
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