expr-eval
                                
                                 expr-eval copied to clipboard
                                
                                    expr-eval copied to clipboard
                            
                            
                            
                        Documentation for options
Hello,
Let me start of by saying thanking you for making expr-eval, it is a great tool .
I ran into an issue earlier today. I wanted to use the in keyword in an expression. I kept getting an
an error, something with EOF.
I finally looked through the tests and found that I was missing the following options:
new Parser({ operators: { 'in': true } })
Some operators seem to work without enabling them through options. It would be great if the documentation included something on which operators need enabling.
A bonus would be if the error could tell you that you are trying to use an operator that is not enabled.
I would like to submit a PR, but need a bit more info before doing so.
Thanks for bring this up. The documentation should definitely mention that it's not enabled by default.
I like your idea about making the error message more helpful. The one concern with that is that right now, when you try to use a disabled operator, it doesn't throw an error, it just continues parsing it as if the operator doesn't exist. Usually that would result in a syntax error, but there could be cases where the expression is still valid (but with a different meaning). For example, if you don't enable the in operator, it becomes a valid variable or function name. So we'd only want to throw the exception if the expression becomes invalid.
As a side note, the reason in is disabled by default is actually for that reason. It was added in the 1.1 release but disabled by default to keep it from breaking backward compatibility. In 2.0 when we can have breaking changes, it will be enabled by default.