# silentmatt/expr-eval

Mathematical expression evaluator in JavaScript

Repository: https://github.com/silentmatt/expr-eval
Canonical: https://ross.abutalabs.com/products/expr-eval
Homepage: http://silentmatt.com/javascript-expression-evaluator/
Language: JavaScript
License: MIT
License Family: permissive
Topics: javascript, mathematical-expressions, math, parser, hacktoberfest
Last push: 2024-08-15T05:00:37+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 6276, "days_push": 748, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1351, forks 269 (observed 2026-08-28T04:04:28.285262+00:00)

## What it is
expr-eval is a JavaScript library that parses and evaluates mathematical expressions, designed as a safer, math-oriented alternative to JavaScript's eval. Expressions containing variables can be evaluated with bound values, substituted, simplified, inspected for symbols, or compiled into native JavaScript functions, with support for custom functions and operator configuration.

## Use cases
- evaluate user-typed math expressions safely in javascript without eval
- parse and calculate formulas with variables in node.js
- convert an expression string into a reusable javascript function
- evaluate spreadsheet-like formulas in the browser
- simplify or substitute variables in mathematical expressions
- allow custom operators and functions in a formula evaluator

## When to choose
- you need to safely evaluate arithmetic or math expressions supplied by users instead of using eval
- you want a lightweight npm dependency focused purely on math expression parsing and evaluation
- you need to compile expressions once and evaluate them many times with different variable values
- you want to extend an expression language with your own javascript functions or disable operators

## When to avoid
- you need a full computer algebra system with symbolic calculus or advanced algebra
- you need arbitrary code execution rather than pure math expressions
- you need heavy numerical computing, matrices, or units support better served by math.js or numeric libraries
- you are not working in a javascript runtime

## Facets
- artifact type: library
- maturity: stable
- function: parser, math, interpreter
- domain: mathematics, web-development, parsers
- platform: browser
- tags: expression-evaluator, expression-parser, formula-evaluation, safe-eval-alternative, javascript, npm, nodejs

## Member repositories
- silentmatt/expr-eval (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:28.285262+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:42:14.057973+00:00, confidence not recorded.
  - readme: https://github.com/silentmatt/expr-eval (fetched 2026-08-28T04:04:28.285262+00:00, sha b4b4aa09c63d)
  - homepage: http://silentmatt.com/javascript-expression-evaluator/ (fetched 2026-08-29T12:01:22.010257+00:00, sha eb95e76f0408)
  - site_page: https://silentmatt.com/about (fetched 2026-08-29T12:01:22.013030+00:00, sha 9f755aed89cd)
  - registry_npm: https://registry.npmjs.org/expr-eval (fetched 2026-08-29T12:01:22.014915+00:00, sha bf6329b55c35)
- Data as of 2026-08-30T08:39:29.467469+00:00.
