@lacspace/validate
A tiny, typed schema validator — the ergonomics of zod (parse/safeParse, object/array/enum/union, coercion, type inference) in a zero-dependency, isomorphic package. Great for forms, API bodies, env and query strings.
npm i @lacspace/validateUsage
import { v, type Infer } from "@lacspace/validate";
const User = v.object({
name: v.string().min(2).trim(),
email: v.string().email().toLowerCase(),
age: v.coerce.number().int().min(0).optional(),
role: v.enum(["admin", "user"]).default("user"),
tags: v.array(v.string()).max(10).default([]),
});
type User = Infer<typeof User>;
// ^ { name: string; email: string; role: "admin" | "user"; tags: string[]; age?: number }
User.parse(input); // ✅ returns typed data, or throws ValidationError
User.safeParse(input); // ✅ { success: true, data } | { success: false, error }Exports 7
BooleanSchemaNumberSchemaObjectSchemaSchemaStringSchemaValidationErrorvKeywords
More in App & Utils Kit
A tiny in-memory cache — LRU eviction, per-entry TTL and stale-while-revalidate, plus wrap()/memoize() to cache any async function with in-flight de-duplication. Zero-dependency, isomorphic.
@lacspace/caseConvert strings between cases — camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, Sentence case. Handles acronyms & numbers. Zero-dependency, isomorphic.
@lacspace/colorParse, convert, manipulate and check colours — hex/rgb/hsl, lighten/darken/mix/alpha, and WCAG contrast for accessible palettes. Zero-dependency, isomorphic.
@lacspace/envTyped, validated environment variables — declare a schema, validate process.env at boot, get a typed frozen object or a clear fail-fast error. A zero-dependency t3-env / envalid alternative.
@lacspace/flagsFeature flags & A/B experiments with no SaaS and no infrastructure — deterministic bucketing (same user always gets the same result), targeting rules, percentage rollouts and weighted variants. Synchronous, zero-dependency, isomorphic.
@lacspace/formEnd-to-end form handling for the server — turn FormData into typed, validated data with a honeypot + timing spam guard, and get back your data or per-field errors ready to re-render. Shaped for Next.js Server Actions. Zero-dependency, isomorphic.