wildcard-domain-matcher

1.0.0 • Public • Published

node-wildcard-domain-matcher

This module is only for wildcard domain matching and may not work fine with invalid domain name characters or other usage for efficient reason.

class Matcher(opt)

  • test([string]domain,[string]pattern,[bool]leadingWildCardSubdomainOnly=false)
  • match([string]domain[array],patterns,[bool]leadingWildCardSubdomainOnly=false)

See the examples for usage

examples

var Matcher=require("wildcard-domain-matcher");
 
var matcher=new Matcher();
//patterns are cached as regexp in the object,if you don't want that use
var matcher=new Matcher({noCache:true);
 
matcher.test("luojia.me","*.luojia.me");
//true
 
//leading *. will only match subdomains if leadingWildCardSubdomainOnly=true
matcher.test("luojia.me","*.luojia.me",true);
//false
 
//return the first pattern matched in the list
matcher.match("luojia.me",["*.luojia.me","luojia.me","*"],true);
//"luojia.me"
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    24
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    24

Package Sidebar

Install

npm i wildcard-domain-matcher

Weekly Downloads

11

Version

1.0.0

License

MIT

Unpacked Size

3.54 kB

Total Files

4

Last publish

Collaborators

  • luojia