Novices Plagiarizing Mozart
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

domain-match

1.0.0 • Public • Published

domain-match

Check if a given url matches against simple domain name patterns.

NPM version Build Status Coverage Status

Installation

Install via npm

$ npm install domain-match

Description

Use this function to test a URL matches a domain name pattern.

The domain name patterns can optionally followed by path prefix.

wild card Matching URLs Non-matching URLs
* http://abc.com/
http://abc.def.com
http://abc.com/path/file
wild card TLDs Matching URLs Non-matching URLs
*.domain.com http://domain.com/ http://niamod.com/
http://sub.domain.com
http://domain.com/path/file
wild card subdomains Matching URLs Non-matching URLs
*.sub.domain.com http://sub.domain.com/ http://domain.com/
http://sub.sub.domain.com/ http://bus.domain.com/
http://sub.domain.com/path/file
specific TLDs Matching URLs Non-matching URLs
domain.com http://domain.com/ http://niamod.com/
http://domain.com/path/file http://sub.domain.com
specific subdomains Matching URLs Non-matching URLs
sub.domain.com http://sub.domain.com/ http://sub.niamod.com/
http://sub.domain.com/path/file http://abc.domain.com

Usage

var domainMatch = require('domain-match'); 
var matched = domainMatch('*.abc.com/prefix/path', 'http://www.abc.com/prefix/path/filename.ext');
// matched == true

License

MIT

Keywords

none

install

npm i domain-match

Downloadsweekly downloads

652

version

1.0.0

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability