Array
Example
import * as p from '@vbudovski/paseri';
const schema = p.array(p.number());const data = [1, 2, 3];
const result = schema.safeParse(data);if (result.ok) { // result.value typed as `number[]`.}
Playground
Validators
min
Consists of at least length
elements.
p.array(p.number()).min(3);
max
Consists of at most length
elements.
p.array(p.number()).max(3);
length
Consists of exactly length
elements.
p.array(p.number()).length(3);