0.1.12 • Published 3 years ago

@vudel/validations v0.1.12

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@vudel/validations

Vudel additions to add validation to the field set

Installation

NPM

  npm install --save @vudel/validations

Yarn

  yarn add @vudel/validations

Usage

The following is a simple usage of creating a field set and adding in some validations

  import { useFieldSet } from '@vudel/core';
  import { addValidation } from '@vudel/validations';

  // Create the field set
  const { fields, data } = useFieldSet({ foo: 'bar', bar: 'foo' });
  const { validations } = addValidation({ fields, data });

  // Add some fields for this field set
  fields.push({ name: 'foo', validations: { required: { } } });
  fields.push({ name: 'bar', validations: { required: { } } });

  // The original data is stored in the data property 
  data.foo = 'foo-bar';

  setTimeout(() => {
    console.log(validations.foo); // [] or empty array
    console.log(validations.bar); // ['Field is required']
  });

License

@vudel/validations is licensed under the MIT license.

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago