Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 625 Bytes

README.md

File metadata and controls

37 lines (30 loc) · 625 Bytes

Input Refacter

Input validation for javascript.

Get Started

Install Input Refacter to your project.

pnpm install input-refacter

Example

Simple login validation example.

import refacter from "input-refacter";

// define validation schema
const schema = {
  name: refacter("username", "example", {
    min: 4,
    small: true
  }),
  password: refacter("password", "Example123@", {
    min: 4,
    small: true,
    special: true
  })
};

if (schema.name.valid && schema.password.valid) {
 console.log("You are great!");
} else {
  console.log(.name.first);
  console.log(.password.first);
}