New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

algebra-latex

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algebra-latex - npm Package Compare versions

Comparing version

to
1.1.7

10

lib/lexers/LexerLatex.js

@@ -111,2 +111,12 @@ 'use strict';

if (this.current_char() == '[') {
this.increment();
return { type: 'bracket', open: true, value: '[' };
}
if (this.current_char() == ']') {
this.increment();
return { type: 'bracket', open: false, value: ']' };
}
if (this.current_char() == '+') {

@@ -113,0 +123,0 @@ this.increment();

77

lib/Parser.js

@@ -160,2 +160,6 @@ 'use strict';

if (kwd == 'sqrt') {
return this.sqrt();
}
if (_functions2.default.includes(kwd.toLowerCase())) {

@@ -172,2 +176,53 @@ return this.function();

}, {
key: 'sqrt',
value: function sqrt() {
// sqrt : SQRT (L_SQUARE_BRAC NUMBER R_SQUARE_BRAC)? GROUP
(0, _logger.debug)('sqrt');
this.eat('keyword');
if (this.current_token.value != 'sqrt') {
this.error('Expected sqrt found ' + JSON.stringify(this.current_token));
}
if (this.peek().value != '[') {
var content = this.group();
return {
type: 'function',
value: 'sqrt',
content: content
};
}
this.eat('bracket');
if (this.current_token.value != '[') {
this.error('Expected "[" bracket, found ' + JSON.stringify(this.current_token));
}
var base = this.number();
this.eat('bracket');
if (this.current_token.value != ']') {
this.error('Expected "]" bracket, found ' + JSON.stringify(this.current_token));
}
var value = this.group();
return {
type: 'operator',
operator: 'exponent',
lhs: value,
rhs: {
type: 'operator',
operator: 'divide',
lhs: {
type: 'number',
value: 1
},
rhs: base
}
};
}
}, {
key: 'fraction',

@@ -289,17 +344,9 @@ value: function fraction() {

};
} /* else if (op.type == 'bracket' && op.open == true) {
let rhs = this.group()
return {
type: 'operator',
operator: 'multiply',
lhs,
rhs,
}
}*/else if (op.type != 'operator' || op.value != 'multiply' && op.value != 'divide') {
(0, _logger.debug)('term only left side');
return lhs;
} else {
// Operator token
this.next_token();
}
} else if (op.type != 'operator' || op.value != 'multiply' && op.value != 'divide') {
(0, _logger.debug)('term only left side');
return lhs;
} else {
// Operator token
this.next_token();
}

@@ -306,0 +353,0 @@ (0, _logger.debug)('op mul right');

2

package.json
{
"name": "algebra-latex",
"version": "1.1.6",
"version": "1.1.7",
"scripts": {

@@ -5,0 +5,0 @@ "build": "rm -rf ./lib && babel src -d lib",