valix

Simple and fast package to validate form data.

Usage no npm install needed!

<script type="module">
  import valix from 'https://cdn.skypack.dev/valix';
</script>

README

Valix Form Validator

Built for your efficiency...

With Valix Validator you can easy validate form data. For an example you can check if an email is an valid email or not

Current Features

  • Check if an email is valid or not
  • Check if a string is longer than 6 characters long. (Common for passwords)
  • Check if two string have same value. For example password and confirm password
  • Check if an string is empty

Installation

Valix requires Node.js v12.0.0+ to run.

$ npm i valix

Documentation

const valix = require('valix');
const email = 'nitschedev@gmail.com';

if (valix.isEmail(email)) {
    console.log(`rasmusnitsche@gmail.com is an valid email`);
} else {
    console.log('Email is not valid');
}
----------------------------------------------------------------
const valix = require('valix');
const username = 'NitscheDev';

if (valix.isEmptyl(username)) {
    console.log('Username is required');
} else {
    console.log('Username was given');
}
----------------------------------------------------------------
const valix = require('valix');
const password1 = 'test123';
const password2 = 'test1234';

if (valix.isEquall(password1, password2)) {
    console.log('Passwords matches');
} else {
    console.log('Passwords do not matches');
}
----------------------------------------------------------------
const valix = require('valix');
const password1 = 'test';

if (valix.isLength(password1)) {
    console.log('Passwords is longer than 6');
} else {
    console.log('Passwords is shorter than 6');
}