Validate with Pema
Pema stands for Primate schema. Use Pema for type-safe validation of data. See the complete Pema reference for every schema family and method.
Pema provides composable validators for common types.
import p from "pema";
const Schema = p({
name: p.string.min(1),
age: p.number.min(0),
});
const data = Schema.parse({ name: "John", age: 30 });import p from "pema";
const EmailSchema = p.string.min(1).max(255).email();
const AgeSchema = p.uint.max(150);try {
Schema.parse(input);
} catch (error) {
console.log(error.issues); // structured issues and paths
}