Validity style validator which extends url to allow for non-tld urls.
npm install validity-url-optional-tlds
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() ] }
}
})
Create a validate function.
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.
Licensed under the New BSD License