is-relative-url

Check if an URL is relative

Usage no npm install needed!

<script type="module">
  import isRelativeUrl from 'https://cdn.skypack.dev/is-relative-url';
</script>

README

is-relative-url Build Status

Check if an URL is relative

Install

$ npm install is-relative-url

Usage

const isRelativeUrl = require('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.

License

MIT © Sindre Sorhus