Socket
Socket
Sign inDemoInstall

validation-x

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    validation-x

[![npm package][npm-badge]][npm] ![npm-bundle-size] ![Module formats][module-formats] ![npm-download-count]


Version published
Maintainers
1
Install size
18.1 kB
Created

Readme

Source

validation-x

npm package npm-bundle-size Module formats npm-download-count

Simple chain validator for string, number, date input

String Validation

Options

NameTypeDescription
stringfunc(errorMessage:string)Type check
requiredfunc(errorMessage:string)isEmpty check
lenfunc(val: number, errorMessage:string)Exact length check for input
minfunc(val: number, errorMessage:string)Min length for input
maxfunc(val: number, errorMessage:string)Max length for input
matchesfunc(val: number, errorMessage:string)regex check
emailfunc(errorMessage:string)Email check with (/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/)
urlfunc(errorMessage:string)URL check with (/((([A-Za-z]{3,9}:(?://)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+
lowercasefunc(errorMessage:string)lowercase check
uppercasefunc(errorMessage:string)uppercase check
customfunc(func, errorMessage:string)check with provided custom function

Number Validation

Options

NameTypeDescription
numberfunc(errorMessage:string)Type check
minfunc(val: number, errorMessage:string)Min for input
maxfunc(val: number, errorMessage:string)Max for input
positivefunc(errorMessage:string)If input is positive number
negativefunc(errorMessage:string)If input is negative number
matchesfunc(val: number, errorMessage:string)regex check
customfunc(func, errorMessage:string)check with provided custom function

Date Validation

Options

NameTypeDescription
minfunc(val: Date, errorMessage:string)Min for input
maxfunc(val: Date, errorMessage:string)Max for input

License

This project is licensed under the MIT License - see the LICENCE.md file for details

Keywords

FAQs

Last updated on 19 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc