node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

is-relative-url

is-relative-url Build Status

Check if an URL is relative

Install

$ npm install --save is-relative-url

Usage

const isRelativeUrl = require('is-relative-url');
 
isRelativeUrl('foo/bar');
//=> true 
 
isRelativeUrl('http://sindresorhus.com/foo/bar');
//=> false 
 
isRelativeUrl('//sindresorhus.com');
//=> true 

Related

See is-absolute-url for the inverse.

License

MIT © Sindre Sorhus