1.0.4 • Published 6 months ago

cgc-validator v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Input validator

Validador de formularios implementando reglas de validación independientes para cada campo por tipo de dato.

Installation

Install cgc-validator with npm or yarn.

NPM
npm install cgc-validator
YARN
yarn add cgc-validator

Usage/Examples

import validator from "cgc-validator";

function App() {
  const postData = () => {
    const params = { numericInput: "213jdjd", stringInput: "Hola mundo" };

    const rules = {
      numericInput: "required;type=number;alias=área",
      stringInput: "required;type=string;alias=mensaje",
    };

    const validation = validator(params, rules);

    if (validation.success) {
      // DO POST REQUEST
    } else {
      // SEND SOME MESSAGE
    }
  };

  return <Component />;
}

Documentation

Badges

MIT License

1.0.4

6 months ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago