Number
Example
Section titled “Example”import * as p from '@vbudovski/paseri';
const schema = p.number();const data = 123;
const result = schema.safeParse(data);if (result.ok) { // result.value typed as `number`.}
Playground
Section titled “Playground”Validators
Section titled “Validators”Greater than or equal to value
.
p.string().gte(5);
Greater than value
.
p.string().gt(5);
Less than or equal to value
.
p.string().lte(5);
Less than value
.
p.string().lt(5);
A valid integer.
p.string().int();
finite
Section titled “finite”A finite number, excluding Number.NEGATIVE_INFINITY
and Number.POSITIVE_INFINITY
.
p.string().int();
A valid integer between Number.MIN_SAFE_INTEGER
and Number.MAX_SAFE_INTEGER
.
p.string().int();