All files / forms/src validators.js

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                                                                               
/**
 * Coherent.js Forms - Validators
 *
 * Form validation utilities. `validators` and `createValidator` here are the
 * same as the ones `@coherent.js/forms` exports, with one calling convention:
 * a validator is `(value, formData) => error | null`, and each built-in is a
 * factory returning one (`validators.minLength(8)`). A built-in may be listed
 * uncalled (`[validators.required]`) and still accepts the older direct form
 * `validators.minLength(value, { min: 8 })`. See rules.js for details.
 *
 * @module forms/validators
 */
 
import {
  validators,
  validateField,
  validateForm,
  registerValidator,
  composeValidators
} from './rules.js';
import { createValidator } from './validation.js';
 
export {
  validators,
  validateField,
  validateForm,
  createValidator,
  registerValidator,
  composeValidators
};
 
export default {
  validators,
  validateField,
  validateForm,
  createValidator,
  registerValidator,
  composeValidators
};