Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Validity style validator which extends url to allow for non-tld urls
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.jshintignore
.jshintrc
.travis.yml
LICENSE
README.md
package.json
validator.js

README.md

validity-url-optional-tlds

Build Status

Validity style validator which extends url to allow for non-tld urls.

Installation

npm install validity-url-optional-tlds

Usage

Below is a simple example for usage with schemata:

var validity = require('validity')
  , schemata = require('schemata')
  , save = require('save')
  , createUrlValidator = require('validity-url-optional-tlds')

var schema = schemata(
    { url:
      { type: String
      , validators: { all: [ createUrlValidator() ] }
      }
    })

API

var validate = createUrlValidator()

Create a validate function.

validate(String:key, String:keyDisplayName, Object:object, Function:cb)

This is a validity compatible function, which in turn is used by schemata for schema validation.

The callback signature cb(err, errorMessage).

err is an Error object if something bad happened and null otherwise. errorMessage is a String if a validation error happened and undefined otherwise.

Licence

Licensed under the New BSD License

Something went wrong with that request. Please try again.