{"_id":"@abhinav943/zynex","_rev":"4-1cdc60b6caf97d78550fae968c128555","name":"@abhinav943/zynex","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@abhinav943/zynex","version":"1.0.0","keywords":["validator","email","password","url","validation","typescript"],"author":{"name":"Abhinav"},"license":"ISC","_id":"@abhinav943/zynex@1.0.0","maintainers":[{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"}],"dist":{"shasum":"9bca3ca2b8b0b73db6cebb5777f0583c4c0078b4","tarball":"https://registry.npmjs.org/@abhinav943/zynex/-/zynex-1.0.0.tgz","fileCount":35,"integrity":"sha512-h0Yv6omxeAnTQZMgLFq+1OkGpY6MU8+1EC3/9Ax1lHT6L8ppE86UdaEKKPakWTm0ueKw3JjsbTHqkzKYP+Mvrg==","signatures":[{"sig":"MEYCIQDnuFhd783bNlQJ9adkrQJvx3ycI41DcKFU+4OVK9y1qQIhAL4ttgQd/newtByXNszRgkl94k5VaT4jeUoxZporSSc+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28994},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"effceb39b5983ff5532fe25df3970f700377e7b5","scripts":{"dev":"tsx watch sandbox.ts","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"},"_npmVersion":"11.11.0","description":"A zero-dependency, detailed validation engine for Emails, Passwords, and URLs.","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^6.0.3","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/zynex_1.0.0_1777664230588_0.6471579500897606","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@abhinav943/zynex","version":"1.0.1","keywords":["validator","email","password","url","validation","typescript"],"author":{"name":"Abhinav"},"license":"ISC","_id":"@abhinav943/zynex@1.0.1","maintainers":[{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"}],"dist":{"shasum":"89763988565f710d66565ef18ce3fca91b7a096e","tarball":"https://registry.npmjs.org/@abhinav943/zynex/-/zynex-1.0.1.tgz","fileCount":37,"integrity":"sha512-wyY8EsFJoD3r5DtzWiRJ1r2ea8V+8y5sCn9GXj2kWIHHmCetU6E5XKniUmDgNKKNLeWN/r3Z7N+TaOya2AkqUw==","signatures":[{"sig":"MEYCIQDYwzRuiw6sPfy4oM7uiNLRpjoOF19l0sP7qVs5cCulBgIhALK+RZvxzesm5sI19Mr1aZgMhnKEH+6/g+I78WWhH2Ls","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37143},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"1ee3602b0761357a577f226abd2bcef23b12be6e","scripts":{"dev":"tsx watch sandbox.ts","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"},"_npmVersion":"11.11.0","description":"A zero-dependency, detailed validation engine for Emails, Passwords, and URLs.","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^6.0.3","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/zynex_1.0.1_1777665994126_0.3233241839972276","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@abhinav943/zynex","version":"1.0.3","keywords":["validator","email","password","url","validation","typescript"],"author":{"name":"Abhinav"},"license":"ISC","_id":"@abhinav943/zynex@1.0.3","maintainers":[{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"}],"dist":{"shasum":"ff14cb48d2ea28a0bd4cd5a2d6b3874dc4753ec0","tarball":"https://registry.npmjs.org/@abhinav943/zynex/-/zynex-1.0.3.tgz","fileCount":37,"integrity":"sha512-NvKf6uKis3TWi6Jwn6u4WuMjBJusbDN5bMju3z7R/e+u0XQsySDGIos8/7hpX0qPOXMvwM3zW5biCgOrHdjuYA==","signatures":[{"sig":"MEQCIAomMQuavIp1l6etAPk+mfUsPcZ5UeOulPA44w/w6vk0AiBJIai/KNsmRDyc84LYvRYtIH29aEskKdOzod46Hy+zFw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37591},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"8335850c481da3d5c60eca31b39d0b52649ac4fe","scripts":{"dev":"tsx watch sandbox.ts","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"},"_npmVersion":"11.11.0","description":"A zero-dependency, detailed validation engine for Emails, Passwords, and URLs.","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^6.0.3","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/zynex_1.0.3_1777705528466_0.2850472524093348","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@abhinav943/zynex","version":"1.0.4","description":"A zero-dependency, detailed validation engine for Emails, Passwords, and URLs.","type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"dev":"tsx watch sandbox.ts","build":"tsc","typecheck":"tsc --noEmit","test":"vitest run"},"keywords":["validator","email","password","url","validation","typescript"],"author":{"name":"Abhinav"},"license":"ISC","devDependencies":{"@types/node":"^25.6.0","tsx":"^4.21.0","typescript":"^6.0.3","vitest":"^4.1.5"},"gitHead":"c372c8438d8a3adfdf46a355cc76da9f89beda8f","_id":"@abhinav943/zynex@1.0.4","_nodeVersion":"20.19.0","_npmVersion":"11.11.0","dist":{"integrity":"sha512-Ec3Ifq+NfARyC/eHqZ1tBAK4AwnCZIVZTnsyRpf9IWBeFIzKtn+9hnUSOqtSsOHPjWxJex0tH2ZIzKySCH9o3w==","shasum":"368979f9ecd1434818c38a79c094dd1d427238ed","tarball":"https://registry.npmjs.org/@abhinav943/zynex/-/zynex-1.0.4.tgz","fileCount":37,"unpackedSize":38653,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEk+mV4COQM5xNtl9h7rAAwMZhDbCjK3hmpSQc4ZJMcsAiA5Wf3WBEzjtCrGdjGxgt80KMf40GgqNDTiexSvuuSfPQ=="}]},"_npmUser":{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"},"directories":{},"maintainers":[{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zynex_1.0.4_1778105986212_0.018732317796277043"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-01T19:37:10.475Z","modified":"2026-05-06T22:19:46.446Z","1.0.0":"2026-05-01T19:37:10.758Z","1.0.1":"2026-05-01T20:06:34.267Z","1.0.3":"2026-05-02T07:05:28.614Z","1.0.4":"2026-05-06T22:19:46.336Z"},"author":{"name":"Abhinav"},"license":"ISC","keywords":["validator","email","password","url","validation","typescript"],"description":"A zero-dependency, detailed validation engine for Emails, Passwords, and URLs.","maintainers":[{"name":"abhinav943","email":"abhinav09prajapati@gmail.com"}],"readme":"<div align=\"center\">\n\n# Zynex\n\n**A zero-dependency, detailed validation engine for Node.js and TypeScript.**\n\n[![npm version](https://img.shields.io/npm/v/@abhinav943/zynex.svg?style=flat-square)](https://www.npmjs.com/package/@abhinav943/zynex)\n[![npm downloads](https://img.shields.io/npm/dm/@abhinav943/zynex.svg?style=flat-square)](https://www.npmjs.com/package/@abhinav943/zynex)\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg?style=flat-square)](https://www.typescriptlang.org/)\n[![License: ISC](https://img.shields.io/badge/License-ISC-green.svg?style=flat-square)](https://opensource.org/licenses/ISC)\n[![minzipped size](https://badgen.net/bundlephobia/minzip/@abhinav943/zynex)](https://bundlephobia.com/package/@abhinav943/zynex)\n[![dependency count](https://badgen.net/bundlephobia/dependency-count/@abhinav943/zynex)](https://bundlephobia.com/package/@abhinav943/zynex)\n[![tree-shaking](https://badgen.net/bundlephobia/tree-shaking/@abhinav943/zynex)](https://bundlephobia.com/package/@abhinav943/zynex)\n[![View on GitHub](https://img.shields.io/badge/GitHub-Zynex-blue?logo=github)](https://github.com/Abhinav943/Zynex)\n[![Tests](https://img.shields.io/badge/tests-31%20passed-brightgreen.svg?style=flat-square)](https://github.com/Abhinav943/Zynex/actions)\n\nZynex replaces messy Regex blocks with a fluent, chainable API. Instead of just returning `false` when a validation fails, Zynex returns a structured array of detailed errors, allowing you to tell your users exactly *why* their input was rejected.\n\n</div>\n\n---\n\n## Table of Contents\n- [Why Zynex?](#-why-zynex)\n- [Installation](#-installation)\n- [Core Concept](#-core-concept)\n- [Usage Examples](#-usage-examples)\n  - [Email Validation](#1-email-validation)\n  - [Password Validation](#2-password-validation)\n  - [URL Validation](#3-url-validation)\n- [API Reference](#-api-reference)\n- [TypeScript Support](#-typescript-support)\n- [License](#-license)\n\n---\n\n## Why Zynex?\n\n- **Chainable & Fluent API:** Build complex validation rules exactly how you think about them.\n- **Graceful Error Stacking:** Zynex does *not* throw exceptions. It safely accumulates errors and returns them in a structured format, perfect for UI feedback.\n- **Async Network Checks:** Go beyond basic syntax. Run active DNS and MX record queries to ensure emails and URLs actually exist on the internet.\n- **Zero Dependencies:** Extremely lightweight. Keeps your `node_modules` tiny and secure.\n- **100% Type-Safe:** Written entirely in TypeScript for first-class autocompletion and strict type definitions out of the box.\n\n---\n\n## Installation\n\nInstall Zynex using your preferred package manager:\n\n```bash\n# Using npm\nnpm install @abhinav943/zynex\n\n# Using yarn\nyarn add @abhinav943/zynex\n\n# Using pnpm\npnpm add @abhinav943/zynex\n```\n\n---\n\n## Core Concept\n\nEvery validator in Zynex follows a simple three-step lifecycle:\n\n1. **Initialize:** Call the validator with the target string (e.g., `checkPassword('myPass')`).\n2. **Chain Rules:** Attach your desired conditions (e.g., `.min(8).requireUppercase()`).\n3. **Execute:** Call `.execute()` for purely synchronous rules, or `.executeAsync()` if your chain includes network checks (like DNS/MX lookups).\n\nThe final execution always returns a consistent `ValidationResult` object:\n\n```typescript\n{\n  isValid: boolean;\n  value: string; // The inputted (or normalized) string\n  errors: Array<{\n    type: string;\n    message: string;\n  }>;\n}\n```\n\n---\n\n## 🛡️ Battle-Tested\n\nZynex is built with reliability as the top priority. The engine is fully tested using **Vitest**, covering both synchronous logic and asynchronous network checks (DNS/MX lookups). \n\nWe ensure that every validation rule, custom error message, and async fallback behaves predictably before any release.\n\n---\n\n## Usage Examples\n\n### 1. Email Validation\n\nGo beyond regex. Check for syntax, block disposable emails (like Mailinator), and query actual mail servers.\n\n```typescript\nimport { checkEmail } from '@abhinav943/zynex';\n\nasync function validateUserRegistration(emailInput: string) {\n  // Normalization (trimming and lowercasing) happens automatically!\n  const result = await checkEmail(emailInput)\n    .checkSyntax()                // Validates standard email formatting\n    .checkDisposable()            // Blocks temporary/burner emails\n    .checkRoleBased()             // Blocks admin@, support@, etc.\n    .checkTypos()                 // Suggests 'gmail.com' if user typed 'gmial.com'\n    .checkDNS()                   // [ASYNC] Verifies the domain can actually receive mail\n    .executeAsync();\n\n  console.log(result);\n}\n```\n\n### 2. Password Validation\n\nEnforce strong security policies while giving users exact feedback on what they are missing.\n\n```typescript\nimport { checkPassword } from '@abhinav943/zynex';\n\nfunction validateNewPassword(passwordInput: string) {\n  // Purely synchronous checks use .execute()\n  const result = checkPassword(passwordInput)\n    .minLength(8)\n    .hasUppercase()\n    .hasLowercase()\n    .hasNumber()\n    .hasSpecialChar()\n    .hasNoSpaces()\n    .execute();\n\n  if (!result.isValid) {\n    result.errors.forEach(err => console.error(`[${err.type}]: ${err.message}`));\n  } else {\n    console.log(`Password Strength: ${result.strength.label} (${result.strength.score}/5)`);\n  }\n}\n```\n\nExample output for a weak password:\n\n```json\n{\n  \"isValid\": false,\n  \"value\": \"weak\",\n  \"errors\": [\n    { \"type\": \"MIN_LENGTH\", \"message\": \"Password must be at least 8 characters long.\" },\n    { \"type\": \"UPPERCASE_REQUIRED\", \"message\": \"Password must contain at least one uppercase letter.\" },\n    { \"type\": \"NUMBER_REQUIRED\", \"message\": \"Password must contain at least one number.\" }\n  ]\n}\n```\n\n### 3. URL Validation\n\nValidate links, ensure secure protocols, and verify domain reachability.\n\n```typescript\nimport { checkURL } from '@abhinav943/zynex';\n\nasync function validateProfileLink(urlInput: string) {\n  const result = await checkURL(urlInput)\n    .isValid()\n    .requireHTTPS()\n    .allowedDomains(['github.com', 'linkedin.com']) // Restrict to specific hosts\n    .checkDNS() // [ASYNC] Verifies the host resolves on the network\n    .executeAsync();\n\n  console.log(result);\n}\n```\n\n---\n\n## API Reference\n\n*Tip: Almost every method in Zynex accepts an optional customMessage string as its final argument so you can override the default error text!*\n\n### `checkEmail(email: string)`\n\n| Method | Type | Description |\n|---|---|---|\n| `.checkSyntax()` | Sync | Validates standard email formatting using RFC-compliant logic. |\n| `.checkDisposable()` | Sync | Fails if the domain belongs to known temporary email providers. |\n| `.checkRoleBased()` | Sync | Fails if the local part is a generic role (e.g., admin, info). |\n| `.checkTypos()` | Sync | Returns a suggested domain if a common typo is detected (e.g., gamil.com). |\n| `.checkDNS()` | Async | Performs a DNS lookup to verify the domain has active Mail Exchange records. |\n*(Note: Normalization, such as trimming and lowercasing, is handled automatically upon initialization).*\n\n### `checkPassword(password: string)`\n\n| Method | Type | Description |\n|---|---|---|\n| `.minLength(length: number)` | Sync | Enforces a minimum character length. |\n| `.hasUppercase()` | Sync | Requires at least one uppercase letter (A-Z). |\n| `.hasLowercase()` | Sync | Requires at least one lowercase letter (a-z). |\n| `.hasNumber()` | Sync | Requires at least one numeric digit (0-9). |\n| `.hasSpecialChar()` | Sync | Requires at least one special character (e.g., @, #, !). |\n| `.hasNoSpaces()` | Sync | Fails if the password contains spaces. |\n\n### `checkURL(url: string)`\n\n| Method | Type | Description |\n|---|---|---|\n| `.isValid()` | Sync | Parses the string to ensure it is a structurally valid URL. |\n| `.requireHTTPS()` | Sync | Fails if the protocol is not `https:`. |\n| `.allowedDomains(list)` | Sync | Restricts the URL to an array of specific hostnames. |\n| `.checkDNS()` | Async | Performs a network lookup to ensure the hostname actually resolves. |\n\n---\n\n## TypeScript Support\n\nZynex exports its core interfaces so you can strongly type your functions and UI components:\n\n```typescript\nimport type { \n  ValidationError,\n  PasswordError,\n  URLError,\n  EmailValidator,\n  PasswordValidator,\n  URLValidator\n} from '@abhinav943/zynex';\n```\n---\n\n## 🤝 Contributing\n\nWe welcome community contributions! Whether you want to add a new zero-dependency validator, fix a bug, or improve the documentation, we'd love your help.\n\nTo ensure a smooth process, we have standardized our testing and Pull Request submission rules. Please read our [Contributing Guide](CONTRIBUTING.md) before opening a PR to see how to run the test suite and format your code.\n\n---\n\n## License\n\nThis project is open-source and available under the [ISC License](LICENSE). Feel free to use it in your personal and commercial projects!","readmeFilename":"README.md"}