<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Ahsan Raza</title>
    <description>The latest articles on DEV Community by Muhammad Ahsan Raza (@muhammad-ahsan-raza).</description>
    <link>https://dev.to/muhammad-ahsan-raza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3131106%2F9eaf882e-0a0a-4970-854a-8518ffd8ad79.jpg</url>
      <title>DEV Community: Muhammad Ahsan Raza</title>
      <link>https://dev.to/muhammad-ahsan-raza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammad-ahsan-raza"/>
    <language>en</language>
    <item>
      <title>Introducing One-Linear-Validator: A Lightweight JavaScript Validation Library</title>
      <dc:creator>Muhammad Ahsan Raza</dc:creator>
      <pubDate>Tue, 06 May 2025 21:50:59 +0000</pubDate>
      <link>https://dev.to/muhammad-ahsan-raza/introducing-one-linear-validator-a-lightweight-javascript-validation-library-d48</link>
      <guid>https://dev.to/muhammad-ahsan-raza/introducing-one-linear-validator-a-lightweight-javascript-validation-library-d48</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hey, Devs!&lt;/strong&gt; 👋&lt;/p&gt;

&lt;p&gt;I’m excited to announce the release of one-linear-validator, a minimalist and dependency-free JavaScript validation library that provides simple, one-liner functions for validating common data types like emails, phone numbers, URLs, hex colors, dates, and strong passwords.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why One-Linear-Validator?&lt;/strong&gt;&lt;br&gt;
In modern web development, data validation is crucial to ensure that the data users enter is correct and secure. However, sometimes, we just need a quick and efficient solution without bloating our projects with unnecessary dependencies. That’s exactly what one-linear-validator offers – a lightweight solution to validate your data in a clean, simple, and fast manner.&lt;/p&gt;

&lt;p&gt;I created this package with the goal of providing an easy-to-use validation library that doesn't require complex setups or external dependencies. Whether you need to validate a user’s email, check the strength of a password, or confirm a valid hex color, one-linear-validator has got you covered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;br&gt;
Email Validation: Check if an email follows the correct format.&lt;/p&gt;

&lt;p&gt;Phone Number Validation: Validate international phone numbers.&lt;/p&gt;

&lt;p&gt;URL Validation: Ensure URLs are properly formatted.&lt;/p&gt;

&lt;p&gt;Hex Color Validation: Verify if the input is a valid hex color code.&lt;/p&gt;

&lt;p&gt;Date Validation: Validate dates in the YYYY-MM-DD format.&lt;/p&gt;

&lt;p&gt;Strong Password Validation: Ensure the password meets certain strength criteria like minimum length, uppercase letters, numbers, and special characters.&lt;/p&gt;

&lt;p&gt;No Dependencies: The library is 100% dependency-free, ensuring that your project stays lightweight and fast.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;
You can install one-linear-validator from npm using the following command:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;npm install one-linear-validator&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Or with yarn:&lt;/strong&gt;&lt;br&gt;
yarn add one-linear-validator&lt;br&gt;
&lt;strong&gt;How to Use&lt;/strong&gt;&lt;br&gt;
The usage is pretty simple! After installation, you can use the validation functions directly by importing them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email Validation:&lt;/strong&gt;&lt;br&gt;
import { isEmail } from 'one-linear-validator';&lt;/p&gt;

&lt;p&gt;console.log(isEmail('&lt;a href="mailto:example@example.com"&gt;example@example.com&lt;/a&gt;')); // { valid: true }&lt;br&gt;
console.log(isEmail('invalid-email'));      // { valid: false, error: 'Invalid email format' }&lt;br&gt;
&lt;strong&gt;Password Strength Check:&lt;/strong&gt;&lt;br&gt;
import { isStrongPassword } from 'one-linear-validator';&lt;/p&gt;

&lt;p&gt;const options = {&lt;br&gt;
  minLength: 8,&lt;br&gt;
  uppercase: true,&lt;br&gt;
  number: true,&lt;br&gt;
  specialChar: true,&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;console.log(isStrongPassword('P@ssw0rd', options)); // { valid: true }&lt;br&gt;
console.log(isStrongPassword('weakpassword'));     // { valid: false, error: 'Password must contain an uppercase letter' }&lt;br&gt;
&lt;strong&gt;Phone Number Validation:&lt;/strong&gt;&lt;br&gt;
import { isPhoneNumber } from 'one-linear-validator';&lt;/p&gt;

&lt;p&gt;console.log(isPhoneNumber('+1234567890')); // { valid: true }&lt;br&gt;
console.log(isPhoneNumber('123456'));      // { valid: false, error: 'Invalid phone number format' }&lt;br&gt;
&lt;strong&gt;Hex Color Validation:&lt;/strong&gt;&lt;br&gt;
import { isHexColor } from 'one-linear-validator';&lt;/p&gt;

&lt;p&gt;console.log(isHexColor('#ff5733')); // { valid: true }&lt;br&gt;
console.log(isHexColor('123abc'));  // { valid: true }&lt;br&gt;
console.log(isHexColor('gggggg'));  // { valid: false, error: 'Invalid hex color' }&lt;br&gt;
&lt;strong&gt;Why Build This?&lt;/strong&gt;&lt;br&gt;
As developers, we often need to validate user input in forms, APIs, or web applications. Instead of writing custom validation functions every time, one-linear-validator allows us to save time and effort by providing simple, one-liner validation functions that are quick to use and easy to integrate.&lt;/p&gt;

&lt;p&gt;It's lightweight, dependency-free, and solves a common problem that many developers face. Whether you're building a small project or working with large-scale applications, this library is simple to implement and offers consistent, reliable results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contributing&lt;/strong&gt;&lt;br&gt;
If you’d like to contribute to the project, feel free to fork the repository and create a pull request. If you encounter any bugs or have feature requests, please raise an issue on the GitHub repository.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
