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

Make rules syntax user-friendly #4

Open
samirketema opened this issue Jan 21, 2018 · 1 comment
Open

Make rules syntax user-friendly #4

samirketema opened this issue Jan 21, 2018 · 1 comment

Comments

@samirketema
Copy link
Owner

Proposed syntax:

["length", "field", "password", "GREATER_THAN", "4"]
  1. Keep evaluating operands left to right until a value is reduced from a group of strings (in this case, "length", "field", "password" all represent one value).
  2. Once operands are reduced to values, apply operators to values:
  • Comparisons: [value1, EQUAL_TO, value2] -> value1 === value2
  • Regular expressions: [value1, REGEX, value2 ] -> new RegExp(value1).test(value2)
  • Length: [LENGTH, value1] -> length(value1)
@samirketema
Copy link
Owner Author

This proposal is for infix notation, which would be harder to parse. Reducing to an array of prefix or postfix would make it easier to parse.

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

1 participant