Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including url-tag with all npm packages installed. Try it out:

var urlTag = require("url-tag")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

url-tag v0.3.0

compare a url string or object to a url pattern spec to find matches


compare a url string or object to a url pattern spec to find matches.

Build Status
NPM browser support


npm install url-tag


npm test


var ut, spec, url, isMatch;

ut = require("url-tag");

spec = {
  pathname: {
    "/form-page": true
  query: {
    "appId": "123"

url = "";

isMatch = ut(url, spec);

// prints "true"


spec.pathname can have multiple pathname keys. the pathname of the parsed url must match ANY of the supplied keys to be satisfied. currently, the value for the pathname key carries no significance, though it should be truthy.

spec.query can have multiple key-value pairs. ALL pairs must be present and equal to be satisfied.


  • allow optional mode in which matching ANY of the supplied query pairs will satisfy the matcher.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free