josdejong / josdejong/mathjs

`calculateNecessaryParentheses` blows up cryptically when `getPrecedence` returns null

Open
#2,573 1 comment 0 reactions 0 assignees View on GitHub
Needs more information
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I accidentally created a node with the `fn` name `mult` instead of `multiply` i.e. `new OperatorNode('*', 'mult', [...])`, and when I went to tex-ify it I got the error `Cannot read property 'OperatorNode:mult' of undefined` which I found quite cryptic and took quite a bit of digging to figure out.

Is there a reason why `getPrecedence` returns `null` instead of throwing an error when precedence can't be determined? If so what would you recommend as a fix, if not could I change that?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.