flexdinesh/typy
Ver no GitHub[Feature] Include custom types in schema validation
Open
#17 aberto em 14 de jan. de 2019
enhancementhelp wanted
Métricas do repositório
- Stars
- (226 stars)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
Like so:
import { addCustomTypes } from 'typy';
addCustomTypes({
isFirstName: input => 3 <= input.length && input.length <= 15,
isLastName: input => 3 <= input.length && input.length <= 15
});
import t, { Schema } from 'typy';
const schema = {
firstName: Schema.isFirstName,
lastName: Schema.isLastName
}
t({
firstName: 'John',
lastName: 'Doe'
}, schema);