Skip to content
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

Adding custom token type #19

Closed
techjewel opened this issue Aug 11, 2020 · 2 comments
Closed

Adding custom token type #19

techjewel opened this issue Aug 11, 2020 · 2 comments

Comments

@techjewel
Copy link

I am trying add a formula token like

max(1,2,3,4,5) which will show 5
or min(2,5,6,8,1) which will show 1

Any way to implement these types of tokens.

@bugwheels94
Copy link
Owner

Only One function with 2 argument is supported right now. I have added a test case on how to find maximum of 5 numbers


    a.addToken([{
      type: 8,
      token: "maxof2",
      show: "maxof2",
      value: function (a, b, c) {
        return Math.max(a, b)
      }
    }])
    assert.equal(a.eval("maxof2(1,maxof2(maxof2(maxof2(maxof2(2,3),5),6),7))"), 7);

@bugwheels94
Copy link
Owner

Feel free to open Issue if you want function with 5 parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants