Skip to content

Number

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`.
}
Schema
Data
Result

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();

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();