@framed/scrub
v0.0.1
Published
Object validation
Downloads
6
Readme
Jazz
Scrub
Scrub is a simple object validator.
import * as scrub from '@framed/scrub';
const personValidator = scrub.object({
name: scrub.string({ transformString: ['trim', 'title'] }),
age: scrub.number({ min: 18 }),
});
type PersonType = scrub.GetType<typeof personValidator>;
const validPerson: PersonType = {
name: 'Homer Simpson',
age: 39,
};
personValidator.validate(validPerson);
// { name: 'Homer Simpson', age: 39 }
Documentation
To install run npm i @framed/scrub
.
Please read the documentation at https://scrub.readthedocs.io/en/latest/.