-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REQUEST - support user defined functions #25
Comments
That could be a killer feature, I like that ! |
Thanks for using the library! I've thought about adding support for this before, but never did it because I generally found that any function I could want to call could just as easily be called before the expression was evaluated, with the result passed as a parameter. However, I know that may not be feasible for some advanced use cases, and your example of something that aggregates data within the expression was pretty compelling. Also, like three people all voted for this at once (which I think makes this the most popular issue on the project 😛 ), so I sat down and implemented it as of db7388b . |
thanks for the quick turnaround, will try out very soon. Does it support nested user-defined function? |
There's some explanation on usage in the readme - but yes, it does support nesting. You can give a function any number of arguments, and include any other operations you like. For example; the following expression is perfectly valid and will work like expected (assuming the proper function/parameters are passed in): // returns the largest of the three parameters. The middle gets the absolute value of 'anotherValue'
"max(someValue, abs(anotherValue), 10 * lastValue)" |
this is great, many thanks. |
Good day .... |
hi, this library is great. User defined parameters/variables is very welcome. Is there any chance you can add user defined functions as well (ideally nested user defined functions).
example:
"(requests_made("5m") * requests_succeeded("5m") / 100) >= 90"
The text was updated successfully, but these errors were encountered: