npm.io
1.0.3 • Published 3 years ago

be-url

Licence
MIT
Version
1.0.3
Deps
0
Size
6 kB
Vulns
0
Weekly
0

be-url

Check whether a string is a URL.

Installation

npm install be-url

API

Usage
import isUrl from 'be-url'

const valid = isUrl('https://www.example.com/test.html')
isUrl(string, opt)

Returns a Boolean indicating whether string is a URL.

opt

Example: consider example.com as invalid url

{
  exclude: {
    domain: 'example.com',
  }
}

Example: consider undefined in path as invalid url

{
  exclude: {
    path: 'undefined',
  }
}

License

MIT

Credit to is-url

This library is inspired by is-url, but with more options, please refer to is-url at https://github.com/segmentio/is-url

Keywords