Add validator - "typeof" #31
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
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
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
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
Docs
should add documentation in Form -> Validators -> Build in validators:
https://yahoo.github.io/jafar/docs/validators.html#built-in-validators
CHANGELOG
https://github.com/yahoo/jafar/blob/master/CHANGELOG.md
The text was updated successfully, but these errors were encountered: