wildcard.js

wildcard match

Usage no npm install needed!

<script type="module">
  import wildcardJs from 'https://cdn.skypack.dev/wildcard.js';
</script>

README

Wildcard matching shit.

How to use?

npm install --save wildcard.js
let match = require('wildcard.js');
if(match('bar.foo.com', '**.com')) {
    ...
}

What can you match?

  • *.foo.com

    • matches
      • a.foo.com
      • example.foo.com
    • not match
      • foo.com
      • a.b.c.foo.com
  • **.foo.com

    • matches
      • foo.com
      • this.is.an.example.foo.com
  • /path/**

    • matches
      • /path/foo
      • /path/bar
      • /path/any/thing
  • /hello/**/world

    • matches
      • /hello/world
      • /hello/you/shit/world
    • not match
      • /hello/worl/d