nice-is-url
v1.0.2
Published
Checks if a string is a valid url
Maintainers
Readme
nice-is-url
var valid = isUrl(val, [options])
Checks if a string is a valid url
val (string) - the string to check
[options] (object) - defaults to
{}options.requireProtocol {boolean} - set to true if you only want URLs with a protocol to be considered valid. Defaults to
falsereturns (boolean) valid -
trueif val is a valid url,falseotherwise
const isUrl = require('nice-is-url')
isUrl('http://localhost:3000') // true
isUrl('boom') // false