Refactor replaceOperators function to use chain methods
This commit is contained in:
parent
449673800d
commit
de8305e797
@ -4,13 +4,11 @@
|
|||||||
* @returns The expression with the replaced operators
|
* @returns The expression with the replaced operators
|
||||||
*/
|
*/
|
||||||
export function replaceOperators(expression: string): string {
|
export function replaceOperators(expression: string): string {
|
||||||
|
return expression
|
||||||
expression = expression.replaceAll(/\//g, "|");
|
.replaceAll(/\//g, "|")
|
||||||
expression = expression.replaceAll(/¬/g, "!");
|
.replaceAll(/¬/g, "!")
|
||||||
expression = expression.replaceAll(/\sOR\s/gi, " | ");
|
.replaceAll(/\sOR\s/gi, " | ")
|
||||||
expression = expression.replaceAll(/\sAND\s/gi, " & ");
|
.replaceAll(/\sAND\s/gi, " & ")
|
||||||
expression = expression.replaceAll(/\s(IMPLICATION|IMP)\s/gi, " -> ");
|
.replaceAll(/\s(IMPLICATION|IMP)\s/gi, " -> ")
|
||||||
expression = expression.replaceAll(/\sNOT\s/gi, " !");
|
.replaceAll(/\sNOT\s/gi, " !");
|
||||||
|
}
|
||||||
return expression;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user