js.spec
js.spec copied to clipboard
Docs for spec.or() don't match actual usage
The docs for "or" look like this:
or (name, ...specs) <-- Looks like you can pass in a bunch of specs like and()
Data must conform to at least one provided spec. The order in which they are validated is not defined. conform returns matched branches along with input data.
const big_or_even = spec.or("big or even", {
'even': spec.even,
'big': nr => nr > 1000
})```
Perhaps or should be:
or(name, {key1: spec, key2: spec...})