Quick-math
What is this
Implementation of shunting-yard algorithm to calculate string as mathematical expression.
How does this work?
While passing expression as infix mathematical expression QuickMath will parse it and transform into RPN. After this you can simply calculate result of RPN by calling calculate method. If your expression contains syntax errors class will throw exception.
Example
import { QuickMath } from 'quick-math';
const data = '5/2+25-3^2';
try {
const expression = new QuickMath(data);
console.log(expression.calculate() === QuickMath.calculate(data));
} catch (e) {
console.error(e);
}