Better HN
topnewbestaskshowjobs
Log inSign up

olamide203

29 karma · joined Aug 21, 2022 (4y ago) · 12 submissions

Submissions

comment 4y ago · link · parent

you got me there :)

comment 4y ago · link · parent

yeah having to type ${} everywhere makes the code a little bit messy.

comment 4y ago · link · parent

I'm glad you find it useful. thanks for the feedback

comment 4y ago · link · parent

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}`

comment 4y ago · link · parent

you can log it to the console if you want to see the Abstract syntax tree of an Expression object

comment 4y ago · link · parent

It can also be used in the browser as well as node.js or any other javascript runtime environment

comment 4y ago · link · parent

hyoka uses a full recursive descent parser to parse expressions into AST, then evaluates to get the final result. it is very secure for math expressions unlike the eval function which can run javascript code. you can try out a demo here https://codesandbox.io/s/naughty-chatterjee-kr3bsc

comment 4y ago · link · parent

I created a lightweight and precise math expression parser and evaluator for JavaScript and TypeScript. it can handle complex arithmetic expressions

9.

Hyoka(github.com ↗)

34 points · by olamide203 · 4y ago · 19 comments

comment 4y ago · link · parent

live site can be found at https://gittz.netify.live

comment 4y ago · link · parent

a web application which integrates with the github REST API making it easy for developers to share their projects on twitter

12.

Gittz(github.com ↗)

1 points · by olamide203 · 4y ago · 2 comments