Package Exports
- @bytelab.studio/schemify
Readme
Schemify
Schemify is a modular, type-safe, and tree-shakable schema validation library designed for JavaScript and TypeScript. It allows you to build powerful validation schemas with minimal overhead, while ensuring dead code elimination for unused validators.
โจ Features
- ๐ฆ Tree-shakable โ Unused validators are removed from the bundle.
- ๐งฉ Modular design โ Import only what you need.
- ๐ Type-safe โ Infers TypeScript types from your schemas automatically.
- ๐ Extensible โ Easily create and attach custom validators.
- ๐งช Fully tested with Vitest.
๐ฆ Installation
npm install @bytelab.studio/schemify
# or
yarn add @bytelab.studio/schemify๐ Usage
import * as Schema from "@bytelab.studio/schemify";
const schema = Schema.object({
name: Schema.string(),
age: Schema.number({min: 18})
});
type User = Schema.InferType<typeof schema>;
schema.validate({name: "Alice", age: 21}); // โ
valid
schema.validate({name: "Bob", age: 15}); // โ throws๐ Documentation
See Documentation for a list of all built-in validators grouped by module.
๐งช Testing
npm test๐ License
This project is licensed under the MIT License - see the LICENSE file for details.