node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org ยป


A simple and focused javascript library which supports basic URL parsing and 'url prefix' testing.

The first feature of urlmatch is its ability to parse a url into components:

    "directory": "/",
    "path": "/",
    "relative": "/",
    "host": "",
    "authority": "",
    "scheme": "http",
    "source": ""

urlmatch can also validate urls:

$ URLParse("httpe://").validate();
Error: invalid url: unsupported scheme: httpe

can also normalize urls:

$ URLParse("").normalize();

And finally, urlmatch can combine all of these features to support robust url prefix matching:

$ URLParse("").contains("");
$ URLParse("").contains("");