input-refacter
v0.0.0
Published
Input validation for javascript.
Downloads
6
Maintainers
Readme
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);
}