For a feature on project I was working on, I needed a simple way to have some business logic like "expressions" evaluated at runtime. I only found a handfull packages either very old (e.g. expr-eval) or very Math oriented (e.g. Mathjs). I wanted a way to have a very simple core "compile then evaluate" package that I could easily extend with custom functions needed for the project (so in theory I could support a full Math suite).
The result is this tiny xprsn package, and is somewhere around 1.2kb gzipped, extracted from the closed-source project. See https://github.com/robinvdvleuten/xprsn.
Not gonna lie here, as it is mostly Fable5 effort (you probably will notice by the terse, not very human-readable precedence climbing parser. But the point was to get a tiny working package, not some heavy brain exercise of myself :)
Despite some anti AI-slop people on HN, I wanted to share it here as I still think it would be useful to others.
Comments URL: [https://news.ycombinator.com/item?id=48945983](https://news.ycombinator.com/item?id=48945983)
Points: 1