2026.9.24 • Published 20h ago
spekvet
Licence
—
Version
2026.9.24
Deps
0
Size
34 kB
Vulns
0
Weekly
0
spekvet
Spekvet is a backend-focused JavaScript validator with a compact, composable API. Its single small module suits serverless functions while supporting arbitrary executable schemas, including recursive ones. It keeps validation strict and transparent: schemas validate rather than transform, and callers control coercion and security limits.
Features
- One small, dependency-free module with no compilation
- Strict validation without coercion
- Synchronous predicates and fail-fast behavior
- Composable executable schemas
- Machine-readable
.diff()results and throwing.assert()checks
Example
import { spec } from 'spekvet';
const user = spec({
name: spec.string,
age: spec.number.min(0),
});
user.diff({ name: 42, age: 20 });
// { kind: 'type', expected: 'string', input: 42, path: ['name'] }
user.assert({ name: 'Ada', age: 36 });
// Returns the input unchanged.
See the walkthrough for the complete API, recursive validation, error shapes, and practical recipes.