An easy and powerful data validation code generator by JavaScript.
- TypeScript v5.0.x (or newer)
- ECMAScript 2017 (or newer)
Install by NPM:
npm i @litert/typeguard --saveimport { 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' })); // trueThis library is published under Apache-2.0 license.