@clocklimited/validity-url

1.0.1 • Public • Published

validity-url

Validity style validator to ensure that a property is a valid URL.

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

build status dependency status

Installation

npm install --save validity-url

Usage

const schemata = require('schemata')
  , url = require('validity-url')
  , schema = schemata(
    { webAddress:
      { validators: [ url ] }
    })
  , schemaWithCustomMessage = schemata(
    { webAddress:
      { validators: [ url.setFailureMessage('#{name} not valid') ] }
    })

schema.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Web Address must be a valid URL'
})

schemaWithCustomMessage.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Web Address not valid'
})

Credits

Paul Serby

License

ISC

/@clocklimited/validity-url/

    Package Sidebar

    Install

    npm i @clocklimited/validity-url

    Weekly Downloads

    81

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    4.61 kB

    Total Files

    5

    Last publish

    Collaborators

    • mrstebo
    • scott-clock
    • clock-release-bot
    • steepnicki
    • asheboy