npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

maxvalid

v1.1.0

Published

Comprehensive data validation functions for common data types

Downloads

5

Readme

MaxValid

MaxValid is an npm package that provides a comprehensive set of validation functions for common data types. It offers easy-to-use functions to validate email addresses, URLs, phone numbers, credit card numbers, and more. The package is designed to be customizable and extensible to accommodate different validation requirements.

Installation

You can install MaxValid using npm:

npm install maxvalid

Usage

CommonJS (Node.js) Usage

const { validateEmail, validateURL } = require('maxvalid');

const email = '[email protected]';
const isValidEmail = validateEmail(email);

console.log(`Email ${email} is valid: ${isValidEmail}`);

const url = 'https://www.example.com';
const isValidURL = validateURL(url);

console.log(`URL ${url} is valid: ${isValidURL}`);

React Usage

import React from 'react';
import { validateEmail } from 'maxvalid';

function App() {
  const email = '[email protected]';
  const isValidEmail = validateEmail(email);

  return (
    <div>
      <h1>MaxValid React Example</h1>
      <p>Email {email} is valid: {isValidEmail.toString()}</p>
    </div>
  );
}

export default App;

Vue.js Usage

<template>
  <div>
    <h1>MaxValid Vue.js Example</h1>
    <p>Email {{ email }} is valid: {{ isValidEmail.toString() }}</p>
  </div>
</template>

<script>
import { validateEmail } from 'maxvalid';

export default {
  data() {
    return {
      email: '[email protected]',
      isValidEmail: false,
    };
  },
  mounted() {
    this.isValidEmail = validateEmail(this.email);
  },
};
</script>

Angular Usage

import { Component } from '@angular/core';
import { validateEmail } from 'maxvalid';

@Component({
  selector: 'app-root',
  template: `
    <h1>MaxValid Angular Example</h1>
    <p>Email {{ email }} is valid: {{ isValidEmail.toString() }}</p>
  `,
})
export class AppComponent {
  email = '[email protected]';
  isValidEmail = validateEmail(this.email);
}

Vanilla JavaScript Usage

<!DOCTYPE html>
<html>
<head>
  <title>MaxValid Vanilla JavaScript Example</title>
</head>
<body>
  <h1>MaxValid Vanilla JavaScript Example</h1>
  <script src="path/to/maxvalid.js"></script>
  <script>
    const email = '[email protected]';
    const isValidEmail = MaxValid.validateEmail(email);

    const emailElement = document.createElement('p');
    emailElement.textContent = `Email ${email} is valid: ${isValidEmail.toString()}`;
    document.body.appendChild(emailElement);
  </script>
</body>
</html>

Make sure to replace 'path/to/maxvalid.js' with the actual path to the MaxValid library file.

Available Validation Functions

MaxValid provides a wide range of validation functions for various data types. Here are some of the available functions:

  • validateEmail: Validates an email address.
  • validateURL: Validates a URL.
  • validatePhoneNumber: Validates a phone number.
  • validateCreditCardNumber: Validates a credit card number.
  • validateUsername: Validates a username.
  • validatePassword: Validates a password.

validateDate: Validates a date.

  • validateIPAddress: Validates an IP address.
  • validateColorCode: Validates a hexadecimal color code.
  • validateSSN: Validates a social security number (SSN).
  • validatePostalCode: Validates a postal code.
  • validatePassportNumber: Validates a passport number.
  • validateCurrency: Validates a currency.
  • validateHexadecimalNumber: Validates a hexadecimal number.
  • validateMACAddress: Validates a MAC address.
  • validateIBAN: Validates an IBAN (International Bank Account Number).
  • validateCVV: Validates a credit card CVV (Card Verification Value) code.
  • validateISBN: Validates an ISBN (International Standard Book Number).
  • validateUUID: Validates a UUID (Universally Unique Identifier).
  • validateSocialMediaUsername: Validates a social media username.
  • And more...

Please refer to the documentation for the full list of available validation functions.

Contributing

Contributions are welcome! If you have any suggestions, improvements, or additional validation functions to add, feel free to open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.