More than just an object validator.
This class holds the current object being validated and provides methods to modify it.
It also holds the path to the key that is currently being validated in this.param
.
Name | Description |
---|---|
path |
path of the object key that is currently being validated |
Name | Args | Description |
---|---|---|
get |
(path, $default=undefined) |
get path of the object being validated, if not exists returns $default |
has |
(path) |
check if the object being validated has path , returns boolean |
set |
(path, value) |
set value of path in the object being validated. |
setThis |
(value) |
sets value using this.path as path in the object being validated. |
unset |
(path) |
unset path in the object being validated. |
unsetThis |
- | unset path in the object being validated using this.path . |
new Validator('someValidator', (val, opt, obj)=>{
// obj is an instance of ObjectOnValidation
})