url-validator
v2.0.3
Published
Loosely validate a URL
Downloads
155
Readme
url validator
Opinionated URL validator.
- Does not support raw domains like
github.com
, though I wish there was a smart way to do so - Defaults protocol-less URLs like
//github.com/
to HTTPs likehttps://github.com/
- Domains will always have trailing slashes
- Encode components
API
var url = validate(url)
var validate = require('url-validator')
var url = validate('//github.com')
// => 'https://github.com/'
If the url is invalid, then url
will be false