is-relative-url
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

is-relative-url

Check if a URL is relative

Install

npm install is-relative-url

Usage

import isRelativeUrl from 'is-relative-url';

isRelativeUrl('foo/bar');
//=> true

isRelativeUrl('https://sindresorhus.com/foo/bar');
//=> false

isRelativeUrl('//sindresorhus.com');
//=> true

Related

See is-absolute-url for the inverse.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    55,555
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    55,555
  • 3.0.0
    355,970
  • 2.0.0
    21,940
  • 1.0.0
    16,341
  • 0.1.1
    1
  • 0.1.0
    0

Package Sidebar

Install

npm i is-relative-url

Weekly Downloads

449,807

Version

4.0.0

License

MIT

Unpacked Size

2.75 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus