gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
389 stars 7 forks source link

Support for multiple arguments in arrow functions #62

Closed dav-garcia closed 6 months ago

dav-garcia commented 11 months ago

The math.map() callback supports up to three parameters: value, index and the array itself. Currently, only the first argument is accepted (without parenthesis). So, if I try to do this:

Result = sum(map(Numbers, (v, i) => v * i))

I get "SyntaxError: Parenthesis ) expected".

Thanks very much.

dav-garcia commented 11 months ago

Forget it. I've seen this is fully delegated to the math.js parser and it has support for defining custom functions: https://mathjs.org/docs/expressions/syntax.html#functions

Sorry for the noise!