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.

Package Sidebar

Install

npm i is-relative-url

Weekly Downloads

370,281

Version

4.0.0

License

MIT

Unpacked Size

2.75 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus