@arsema_tesfaye/validx
v1.0.0
Published
Simple & Secure Input Validation Toolkit
Maintainers
Readme
ValidX — Simple & Secure Input Validation Toolkit
Version: v1.0.0
License: MIT
Status: Stable Initial Release
ValidX is a lightweight, modular, and developer-friendly input validation library built with TypeScript.
It helps developers validate user input safely, consistently, and with clean, reusable functions.
🚀 Features
- ✔ String validation (min/max length, text checks, etc.)
- ✔ Security validation (email, phone, strong password)
- ✔ Number validation (range, integer check, etc.)
- ✔ Simple and intuitive API
- ✔ Zero external dependencies
- ✔ Fully written in TypeScript
- ✔ Unit-tested with Jest
- ✔ Lightweight and fast
- ✔ Supports ESM + CommonJS
Installation
npm install validxOr for Yarn:
yarn add validxProject Structure
validx/
├── src/
│ ├── validators/
│ │ ├── string.ts
│ │ ├── numbers.ts
│ │ ├── security.ts
│ ├── index.ts
├── tests/
│ ├── string.test.ts
│ ├── number.test.ts
│ └── security.test.ts
├── examples/
│ └── index.ts
├── package.json
└── README.mdUsage Examples
String Validators
import { minLength, maxLength, isString } from "validx";
minLength("Hello", 3); // true
maxLength("Hello", 10); // true
isString(100); // falseSecurity Validators
import { isEmail, isPhone, isStrongPassword } from "validx";
isEmail("[email protected]"); // true
isPhone("+251912345678"); // true
isStrongPassword("Aa@12345"); // trueNumber Validators
import { isNumber, inRange, isPositive } from "validx";
isNumber(12); // true
inRange(5, 1, 10); // true
isPositive(-1); // falseExample Project
Use the sample inside:
examples/basic-usage/index.tsExample:
import { isEmail, minLength } from "validx";
console.log(isEmail("[email protected]"));
console.log(minLength("World", 3));Run:
ts-node examples/basic-usage/index.tsRunning Tests
npm testTests are written using Jest, covering:
- Valid inputs
- Invalid inputs
- Edge cases
- Null/undefined
- Boundary values
Roadmap
- [ ] Add date validators
- [ ] Add URL validators
- [ ] Add schema-based object validator
- [ ] Add array validators
- [ ] Add async validators
- [ ] Add sanitizers (trim, escape, normalize)
Contributing
Contributions are always welcome!
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
License
MIT License — free to use, modify, and distribute.
Author
Group 3
AASTU — Software Engineering Students
