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

2.0.0 • Public • Published

is-url-relative-without-domain

Build Status Coverage Status Known Vulnerabilities

Node.js module. Checks if a URL is relative without domain

Version 2 requires Node.js >= 6.13.

Install

Package domains included

# NPM 
$ npm install is-url-relative-without-domain
 
# Yarn 
$ yarn add is-url-relative-without-domain

Without package domains

# NPM 
$ npm install is-url-relative-without-domain --no-optional
 
# Yarn 
$ yarn add is-url-relative-without-domain --ignore-optional
 

Usage

var isUrlRelativeWithoutDomain = require('is-url-relative-without-domain');
 
isUrlRelativeWithoutDomain('/show/must?go=on');
//=> true
 
isUrlRelativeWithoutDomain('index.php');
//=> true
 
isUrlRelativeWithoutDomain('https://site.com/index.php');
//=> false
 
isUrlRelativeWithoutDomain('site.com/show/must?go=on');
//=> false

By default package using optional dependency domains. But, if you want to using your own list of domains, you can install without optional dependencies and specify code like this:

isUrlRelativeWithoutDomain('site.com/foo/bar', ['com', 'рф', '世界']);

In second argument you can add your own array of domains in Unicode.

License

MIT © 2016-2019 Nikita Bystrov (Arttse)

Package Sidebar

Install

npm i is-url-relative-without-domain

Weekly Downloads

75

Version

2.0.0

License

MIT

Unpacked Size

6.2 kB

Total Files

5

Last publish

Collaborators

  • arttse