validity-url-optional-tlds
Validity style validator which extends url to allow for non-tld urls
Last updated 7 years ago by confuser .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install validity-url-optional-tlds 
SYNC missed versions from official npm registry.

validity-url-optional-tlds

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

Current Tags

  • 0.2.0                                ...           latest (7 years ago)

2 Versions

  • 0.2.0                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |