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

validator360

v1.1.1

Published

Validator360 is a robust validation package that ensures data integrity by checking required fields, such as strings, objects, arrays, numbers, and more, to ensure they are not null, undefined, or empty. It also validates specific formats for emails, pass

Downloads

13

Readme

Validotor360

Validotor360 is a robust validation package that ensures data integrity by checking required fields, such as strings, objects, arrays, numbers, and more, to ensure they are not null, undefined, or empty. It also validates specific formats for emails, passwords, and phone numbers.

Installation

To install the package, run:

npm install validotor360

Validotor360 Service

| NameOfService | All Service | |---------------------|------------------------------------------------------------------------------------------------------| | customValidation | addCustomValidator, validateWithCustom | | emptyValidation | singleEmptyValidation, validateAllFields | | filetypeValidation | validateSingleFileSize, validateFileSize, validateSingleMimeType, validateMimeTypes | | regexFormatValidation | validateEmail, validatePhone, validateURL, validatePassword, validateDate, validateCreditCard |

Usage

You can import any of these functions based on your needs:

const { 
  customValidation, 
  emptyValidation, 
  filetypeValidation, 
  regexFormatValidation, 
} = require('validator360');

// Example: Using regexValidation
const { validateEmail } = regexValidation;
// Example: Using fileValidation
const {validateSingleFileSize , validateSingleMimeType} = fileValidation

Alternatively, you can use direct imports:

const { validateEmail } = require('validator360/regexFormatValidation');
const { singleEmptyValidation } = require('validator360/emptyValidation');

Function Descriptions

| Function Name | Purpose | Input | Example | Output | |--------------------------|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | singleEmptyValidation | Validates if a single field is empty, null, or undefined. | - value (the value to check)- fieldName (the name of the field)- customMessage (Optional) | const response = singleEmptyValidation(value, "fieldName", "customMessage"); | - Returns: "{fieldName} is required" if empty.- Returns: null if valid. | | validateAllFields | Validates all fields in an object, checking if any are empty, null, or undefined. | - data (an object with key-value pairs)- customMessage (Optional) | const data = { stringFieldName: "someValue", arrayFieldName: [1, 2, 3], numberFieldName: 123 };<br>const response = validateAllFields(data, "customMessage"); | - Returns an object with errors like:{ fieldName1: "fieldName1 is required", fieldName2: "fieldName2 is required" } | | validateEmail | Validates the format of an email address. | - email (the email address to validate)- userRegix (Optional) | const response = validateEmail(email, userRegix); | - Returns: true if correct format.- Returns: false if incorrect format. | | validatePhone | Validates if the phone number format is correct. | - phone (the phone number to validate)- userRegix (Optional) | const response = validatePhone(phone, userRegix); | - Returns: true if correct format.- Returns: false if incorrect format. | | validateURL | Validates if the URL format is correct. | - url (the URL to validate)- userRegix (Optional) | const response = validateURL(url, userRegix); | - Returns: true if correct format.- Returns: false if incorrect format. | | validatePassword | Validates if the password format meets the required criteria (e.g., length, special characters). | - password (the password to validate)- userRegix (Optional) | const response = validatePassword(password, userRegix); | - Returns: true if correct format.- Returns: false if incorrect format. | | validateDate | Validates if the date format is correct. | - date (the date to validate)- userRegix (Optional) | const response = validateDate(date, userRegix); | - Returns: true if correct format.- Returns: false if incorrect format. | | validateSingleMimeType | Validates if a single file's MIME type is allowed. | - file (the file to check)- allowedTypes (an array of allowed MIME types) | const isValid = validateSingleMimeType(file, ['image/jpeg', 'image/png']); | - Returns: true if MIME type is allowed.- Returns: false if MIME type is not allowed. | | validateMimeTypes | Validates the MIME types of multiple files. | - files (an array of files)- allowedTypes (an array of allowed MIME types) | const response = validateMimeTypes(files, ['image/jpeg', 'image/png']); | - Returns an object with filenames and validity status:{ filename1: true, filename2: false } | | validateSingleFileSize | Validates if a single file's size is within the allowed limit. | - file (the file to check)- maxSizeMB (maximum allowed file size in MB) | const isValid = validateSingleFileSize(file, 5); | - Returns: true if file size is within limit.- Returns: false if file size exceeds limit. | | validateFileSize | Validates the sizes of multiple files. | - files (an array of files)- maxSizeMB (maximum allowed file size in MB) | const response = validateFileSize(files, 5); | - Returns an object with filenames and validity status:{ filename1: true, filename2: false } | | addCustomValidator | Adds a custom validation function to the store. | - name (name of the custom validator)- validatorFunction (function to validate) | addCustomValidator('customName', customFunction); | - No return value. Adds a custom validator to the store. | | validateWithCustom | Validates a value using a custom validator from the store. | - name (name of the custom validator)- value (value to validate)- ...args (additional arguments) | const response = validateWithCustom('customName', value, ...args); | - Returns the result of the custom validator function.