validity-email

1.0.0 • Public • Published

validity-email

Validity style validator to ensure that a property is a valid email address.

As part of the modularisation of validity, this replaces the built-in validity.email.

build status dependency status

Installation

npm install --save validity-email

Usage

 
const schemata = require('schemata')
  , email = require('validity-email')
  , schema = schemata(
    { emailAddress:
      { validators: [ email ] }
    })
  , schemaWithCustomMessage = schemata(
    { emailAddress:
      { validators: [ email.setFailureMessage('#{name} not valid') ] }
    })
 
 
schema.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Email Address must be a valid email address'
})
 
schemaWithCustomMessage.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Email Address not valid'
})
 

Credits

Paul Serby

License

ISC

Readme

Keywords

none

Package Sidebar

Install

npm i validity-email

Weekly Downloads

29

Version

1.0.0

License

ISC

Last publish

Collaborators

  • microadam
  • serby
  • jack828