Hyoka
11–20 of 20 posts
Re: Hyoka
#12Does the name have any special meaning?
Re: Hyoka
#13I created a lightweight and precise math expression parser and evaluator for JavaScript and TypeScript. it can handle complex arithmetic expressions
Re: Hyoka
#14Earlier quoted context omitted.
I would show examples in README on use of it along with string interpolation, as it's not too useful with only constants. Eg. const a = 3; const b = 2; const expression = new Expression(`${a}*${b}(6/3(5--2))`); const result = expression.evaluate(); document.getElementById("app").innerHTML = `a*b( 6 / 3( 5 - - 2 ) )= ${result}`; Edit: formating
Nice tip, i'm planning to add an identifier node class so that you can pass a scope with the values to be used during evaluation. Eg. const a = 2; const b = 6; const c = 3 const expression = new Expression('a \ b * c') const result = expression.scope({a, b, c}).evaluate(); document.getElementById("app").innerHTML `${a} \ ${b} * ${c}= ${result}`
Re: Hyoka
#15Does the name have any special meaning?
Re: Hyoka
#16I created a lightweight and precise math expression parser and evaluator for JavaScript and TypeScript. it can handle complex arithmetic expressions
Damn that's pretty sweet, I've had to pretty much just make anything that needs extreme decimal precision work out on server side. Cool to know someone came up with a way to do it on frontend too, thanks!
Re: Hyoka
#17Earlier quoted context omitted.
Nice tip, i'm planning to add an identifier node class so that you can pass a scope with the values to be used during evaluation. Eg. const a = 2; const b = 6; const c = 3 const expression = new Expression('a \ b * c') const result = expression.scope({a, b, c}).evaluate(); document.getElementById("app").innerHTML `${a} \ ${b} * ${c}= ${result}`
Very welcome solution. String interpolation makes it possible, but it's bad DX.
Re: Hyoka
#18Does the name have any special meaning?
It means “evaluate”, but in the sense of evaluating a piece of artwork, so my guess is that the author justed ran the word through Google Translate.