{"slug": "show-hn-tiny-and-csp-safe-expression-language-for-javascript", "title": "Show HN: Tiny and CSP-safe expression language for JavaScript", "summary": "Robin van der Vleuten released xprsn, a 1.2 KB gzipped expression language library for JavaScript that is CSP-safe and designed for runtime evaluation of business logic. The package, extracted from a closed-source project, supports custom function extensions and uses a precedence climbing parser.", "body_md": "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).\n\nI 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).\n\nThe 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](https://github.com/robinvdvleuten/xprsn).\n\nNot 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 :)\n\nDespite some anti AI-slop people on HN, I wanted to share it here as I still think it would be useful to others.\n\nComments URL: [https://news.ycombinator.com/item?id=48945983](https://news.ycombinator.com/item?id=48945983)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-tiny-and-csp-safe-expression-language-for-javascript", "canonical_source": "https://github.com/robinvdvleuten/xprsn", "published_at": "2026-07-17 11:26:55+00:00", "updated_at": "2026-07-17 11:51:35.182142+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Robin van der Vleuten", "xprsn"], "alternates": {"html": "https://wpnews.pro/news/show-hn-tiny-and-csp-safe-expression-language-for-javascript", "markdown": "https://wpnews.pro/news/show-hn-tiny-and-csp-safe-expression-language-for-javascript.md", "text": "https://wpnews.pro/news/show-hn-tiny-and-csp-safe-expression-language-for-javascript.txt", "jsonld": "https://wpnews.pro/news/show-hn-tiny-and-csp-safe-expression-language-for-javascript.jsonld"}}