1.5.0 • Published 4 years ago

open-form-validators v1.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

OpenForm - Validators

Validator library for OpenForm. It supports several validators such as minValue, maxValue, minLength, maxLength, minDate, maxDate, earliestToday, email and also combinations.

Usage

import { validate } from 'open-form-validators';

const result = validate('100', 'minValue60,maxValue100');

If you want to use the validationKeys to write your validation predicate:

import { validate, VALIDATION_KEYS } from 'open-form-validators';

const result = validate(
  '100',
  `${VALIDATION_KEYS.MIN_VALUE}60,${VALIDATION_KEYS.MAX_VALUE}100`
);