data-validation-tool

1.1.0 • Public • Published

Data Validator

A simple and flexible data validation library for JavaScript.

Installation

npm install data-validator


# Usage

const Validator = require('data-validator');

const validator = new Validator();

const rules = {
  name: 'required|string',
  age: 'required|number|min:18',
  email: 'required|email',
};

const data = {
  name: 'John Doe',
  age: 25,
  email: 'john@example.com',
};

const result = validator.validate(rules, data);

if (result.valid) {
  console.log('Validation passed');
} else {
  console.log('Validation failed', result.errors);
}

Readme

Keywords

none

Package Sidebar

Install

npm i data-validation-tool

Weekly Downloads

0

Version

1.1.0

License

ISC

Unpacked Size

4.16 kB

Total Files

5

Last publish

Collaborators

  • moturiphil