Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

domain-match

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domain-match

Matching URLs against domain names

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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 cardMatching URLsNon-matching URLs
*http://abc.com/
http://abc.def.com
http://abc.com/path/file
wild card TLDsMatching URLsNon-matching URLs
*.domain.comhttp://domain.com/http://niamod.com/
http://sub.domain.com
http://domain.com/path/file
wild card subdomainsMatching URLsNon-matching URLs
*.sub.domain.comhttp://sub.domain.com/http://domain.com/
http://sub.sub.domain.com/http://bus.domain.com/
http://sub.domain.com/path/file
specific TLDsMatching URLsNon-matching URLs
domain.comhttp://domain.com/http://niamod.com/
http://domain.com/path/filehttp://sub.domain.com
specific subdomainsMatching URLsNon-matching URLs
sub.domain.comhttp://sub.domain.com/http://sub.niamod.com/
http://sub.domain.com/path/filehttp://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

FAQs

Package last updated on 19 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts