https://github.com/litert/type-guard
An easy and powerful data validation code generator by JavaScript.
https://github.com/litert/type-guard
check data types validation
Last synced: 3 months ago
JSON representation
An easy and powerful data validation code generator by JavaScript.
- Host: GitHub
- URL: https://github.com/litert/type-guard
- Owner: litert
- License: apache-2.0
- Created: 2018-04-15T16:45:24.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2026-04-01T15:35:05.000Z (3 months ago)
- Last Synced: 2026-04-01T20:36:39.210Z (3 months ago)
- Topics: check, data, types, validation
- Language: TypeScript
- Homepage: https://litert.org/projects/typeguard.js/
- Size: 1.15 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# LiteRT/TypeGuard
[](https://www.npmjs.com/package/@litert/typeguard "Stable Version")
[](https://github.com/litert/typeguard/blob/master/LICENSE)
[](https://nodejs.org/)
[](https://github.com/litert/type-guard/issues)
[](https://github.com/litert/type-guard/releases "Stable Release")
An easy and powerful data validation code generator by JavaScript.
## Requirement
- TypeScript v5.0.x (or newer)
- ECMAScript 2017 (or newer)
## Installation
Install by NPM:
```sh
npm i @litert/typeguard --save
```
## Quick Usage
```ts
import { createInlineCompiler } from '@litert/typeguard';
const compiler = createInlineCompiler();
const isUser = compiler.compile<{ id: number; name: string }>({
rule: {
id: 'uint32',
name: 'string(1,64)'
}
});
console.log(isUser({ id: 1, name: 'Alice' })); // true
```
## Document
- [English (en-US)](https://litert.org/projects/typeguard.js)
- [简体中文](./docs/zh-CN/README.md)
## License
This library is published under [Apache-2.0](./LICENSE) license.