UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

20 lines (17 loc) 386 B
import { Validation } from './types'; export function compose(validations: Validation[]) { return (value: string) => { for (let v of validations) { let result = v(value); if (result) { return result; } } return null; }; } export function required(value: string) { if (value == null || value === '') { return 'Value is required!'; } }