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

Create more useful validators #3

Open
cezarsmpio opened this issue Sep 29, 2016 · 3 comments
Open

Create more useful validators #3

cezarsmpio opened this issue Sep 29, 2016 · 3 comments

Comments

@cezarsmpio
Copy link
Owner

Hi guys, today the boss-validator has 27 valid validators. Day to day, many developers need to solve many issues on its jobs. That's why the purpose of this lib is help the most in their everyday situations.

I created this lib for create custom validators easily. So, what's is your idea?

Thanks!

@hkwu
Copy link

hkwu commented Sep 30, 2016

Conditional validators which depend on the value of other fields in the form is a possibility.

@cezarsmpio
Copy link
Owner Author

Hi @hkwu, how are you?

It's a great idea! We will definitely implement! Can you give a mockup example how do you imagine using it?

Thanks!

@hkwu
Copy link

hkwu commented Sep 30, 2016

A simple one would be required_if.

const rules = {
  foo: {},
  bar: {
    required_if: 'foo',
  },
};

The validator then checks if a value was provided for foo. If so, a value must also exist for bar.

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

No branches or pull requests

2 participants