Skip to content

Replace eval() with math expression library (e.g., Math.js) #8032

@coderabbitai

Description

@coderabbitai

Description

The current implementation of mathematical expression evaluation in number widgets uses eval() to parse and evaluate user input expressions. This should be replaced with a dedicated math expression library for better security and functionality.

Context

  • Current implementation: evaluateInput() function in src/lib/litegraph/src/utils/widget.ts
  • Previous testing was done with expr-eval
  • Math.js is suggested as a potentially better option

Related

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions