@uvalidation/plain v0.9.3
uvalidaiton
javascript validation library for different runtimes
Features
Imagine such data structure
Or it's another view
const a = {
b: {
e: null
},
c: {
f: null,
g: null,
},
d: {
h: {
i: null
}
},
}
As the author I have had some requirements which this library should cover:
1. Validity of a field can depend on that field own value. E.g:
1. Validity of b
depends on b
value
2. Validity of e
depends on e
value
2. Validity of a field can depend on any other field value. E.g:
1. Validity of e
depends on i
and g
values.
3. Each field can have own error messages.
4. Adding validation should not make me crazy.
5. Validation can be Sync/Async
6. Sync/Async validation can be run separately
Pros and cons
So main concern which this library addresses is complexity
.
Currently I don't care about perfomance
. It even wasn't measured.
Pros:
1. Almost any(?) validation rule can be added.
2. Validators / Relations are very flexible to configuration.
3. Easy to write unit tests.
4. Doesn't have additional dependencies.
5. Can be used in different runtimes - nodejs
or browser
.
6. Different bundles:
umd
withes5
commonjs
withes6
esm
withes6
Cons: 1. Sophisticated usage. 2. No built-in validators / relations. 3. No built-in functionality to display errors in form (for browser).
Examples
There are multiple drivers:
- Plain
- RxJs TBD