Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ Expression Evaluator

## Description

**This is a modern TypeScript port of the expr-eval library, completely rewritten with contemporary build tools and development practices.** Originally based on [expr-eval 2.0.2](http://silentmatt.com/javascript-expression-evaluator/), this version has been restructured with a modular architecture, TypeScript support, and comprehensive testing using Vitest.

Parses and evaluates mathematical expressions. It's a safer and more math-oriented alternative to using JavaScript's `eval` function for mathematical expressions.
A versatile expression evaluation library that goes beyond mathematical expressions. It parses and evaluates expressions that can manipulate strings, objects, and arrays, providing a safer alternative to JavaScript's `eval` function.
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated README description says the library goes beyond mathematical expressions (strings/objects/arrays), but the published docs still frame it as a mathematical expression evaluator (e.g., docs/index.md:5 and docs/index.md:11). This creates conflicting messaging for users. Consider updating the docs’ intro/tagline to match this new positioning, or rewording the README description to stay consistent with the existing docs until those are updated.

Suggested change
A versatile expression evaluation library that goes beyond mathematical expressions. It parses and evaluates expressions that can manipulate strings, objects, and arrays, providing a safer alternative to JavaScript's `eval` function.
A mathematical expression evaluation library for JavaScript. It parses and evaluates expressions with support for numbers, strings, objects, and arrays, providing a safer alternative to JavaScript's `eval` function.

Copilot uses AI. Check for mistakes.

It has built-in support for common math operators and functions. Additionally, you can add your own JavaScript functions. Expressions can be evaluated directly, or compiled into native JavaScript functions.

Expand All @@ -30,6 +28,14 @@ console.log(expr.evaluate({ x: 3 })); // 7
Parser.evaluate('6 * x', { x: 7 }); // 42
```

## Playground Example

Try out the expression evaluator and its language server capabilities directly in your browser at the [Playground](https://pro-fa.github.io/expr-eval/). The playground provides an interactive environment with:
- Live expression evaluation
- Code completions and IntelliSense
- Syntax highlighting
- Hover information for functions and variables

## Documentation

### For Expression Writers
Expand Down Expand Up @@ -75,14 +81,6 @@ If you're integrating expr-eval into your project:
- **Object Construction** - Create objects and arrays in expressions
- **Language Service** - IDE integration with completions, hover info, and highlighting

## Playground Example

Try out the expression evaluator and its language server capabilities directly in your browser at the [Playground](https://pro-fa.github.io/expr-eval/). The playground provides an interactive environment with:
- Live expression evaluation
- Code completions and IntelliSense
- Syntax highlighting
- Hover information for functions and variables

## Running Tests

```bash
Expand Down Expand Up @@ -135,6 +133,12 @@ mkdocs build

The static site will be generated in the `site/` directory.

## Origins

This library was originally based on [expr-eval 2.0.2](http://silentmatt.com/javascript-expression-evaluator/), but has been restructured with a modular architecture, TypeScript support, and comprehensive testing using Vitest.

While the original expr-eval was focused on mathematical expressions, this library aims to be a tool for evaluating expressions that can manipulate strings, objects, and arrays.

## License

See [LICENSE.txt](LICENSE.txt) for license information.