Matthew Crumley

Results 33 comments of Matthew Crumley

I apparently forgot that the `=` functionality was defined using a `binaryOps` function, so that's great! I had thought it was a special case, and obviously should have checked. Glad...

The expression language (unlike javascript) uses `||` for string concatenation (borrowed from SQL). `+` will always try to convert its operands to numbers first, which is why you're getting `NaN`....

Substituting the operator would be tricky, since the expressions don't store any type information, but you can override the `+` operator implementation by replacing the `parser.binaryOps['+']` function with your own....

It looks like you're using the parse and evaluate functions correctly, but you're getting a syntax error in the evaluated string (`storedValue`). Take a look at its value right before...

Yes, the scope object is optional, so you can call it like this: var instance = new Parser(); var exp = instance.parse('3+4'); console.log(exp.evaluate()); // prints 7 // Or, with variables...

That shouldn't affect anything, but you can avoid that by changing the script source to https://cdnjs.cloudflare.com/ajax/libs/expr-eval/2.0.2/bundle.js (bundle.js instead of bundle.min.js).

@starskyC's comment is generally how you would need to to it. There's no option to switch modes like a calculator might have, since the trig functions are mostly using the...

That's a good idea. I'm not a big fan of having multiple syntaxes for the same thing, but especially with JavaScript using `**`, that would align with people's expectations. We...

Unfortunately I have almost no experience with TypeScript. It's something I'm interested in learning more about but haven't gotten to it yet. I'll try to play around with it when...

The tokens property is visible mostly out of convenience since JavaScript doesn't have private properties, and as a debugging aid to view the output of the parser. There *could* be...