Validify

A simple validation JS library.

View the Project on GitHub shivkanthb/ValidifyJS

Generic validation library in javascript

Can be used as both an npm module and also on the browser.

Installation

Node :

npm install validifyjs

Browser :

<script type="text/javascript" src=“validify.js” ></script>

Usage

Browser

Add html attribute "data-validify" to the element to be validated. The value of the attribute would decide what validation is to be done.

npm module

Individual methods and validateForm(formElements) can be called for validation, as mentioned in the case for the browser.

Methods:

  • isEmpty()
  • isZipCode() (only for codes in the US)
  • isMDDYYYYDate()
  • isDDMMYYYYDate()
  • is24HourTime()
  • is12HourTime()
  • isHtml()
  • isHexColor()
  • isUrl()
  • isEmail()
  • isNumber()
  • isInteger()
  • isPositive()
  • isNegative()
  • isIpv4()
  • isIPv6()

  • Tests

    npm test

    Contributing

    In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.