1.0.2 • Published 6 years ago

form-field-validator v1.0.2

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
6 years ago

#form-field-validator

Node module written in typescript for common form field validation rules returning FieldValidationResponse valid status and validation message

The following field types are supported

Installation

A simple form field validator library using Typescript

npm install form-field-validator

This is a client or server side script

If using it client side you'll need to include the fields-validation-bundle.js file

Re-compiling fields-validation-bundle.js can be done by calling

npm run browserify

Usage

Basic IBAN validation check

formFieldValidator.newInstance().getFieldValidationResponse('IBAN', 'IE 94IPBS 990643 24173574');

This will return the following validation response

{
    valid: true, 
    message: '', 
    type: 'IBAN'
}

Confirm validation check with emails coming from 2 separate fields

formFieldValidator.newInstance().getFieldValidationResponse('CONFIRM', 'valid@email.check', 'valid@email.check');

This will return the following validation response

{
    valid: true, 
    message: '', 
    type: 'CONFIRM'
}

An invalid validation response will look something like this

{
    valid: false, 
    message: 'This is not a valid iban', 
    type: 'IBAN'
}

Unit Testing

npm run build

npm run test

Unit Test Code Coverage Report

npm run check-coverage
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago