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

Add validator - "typeof" #31

Open
galhavivi opened this issue Feb 20, 2020 · 0 comments
Open

Add validator - "typeof" #31

galhavivi opened this issue Feb 20, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@galhavivi
Copy link
Member

Add a new validator to packages/form/src/validators.js file of "typeof".

Motivation
Fields can define a validation of their value type, to be verified when field value changes. For example to verify that the value of the field is "string".

Code

  • args (and defaultArgs) should include:
  • "type" - default undefined
  • func: checks if : typeof value === args.type

  • message: should have a matching error message depend on the args of
    'Invalid type. Expected type of "{args.type}"'

Tests

Docs
should add documentation in Form -> Validators -> Build in validators:
https://yahoo.github.io/jafar/docs/validators.html#built-in-validators

CHANGELOG

@galhavivi galhavivi added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant