Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

properjs-matchroute

0.2.0 • Public • Published

MatchRoute

Handles wildcard route matching against urls with !num and !slug condition testing.

Installation

npm install properjs-matchroute --save-dev

Usage

var MatchRoute = require( "properjs-matchroute" ),
    matchroute = new MatchRoute([
        // Known route
        "some/route",
        
        // Unknown route
        "another/:slug",
        
        // Unknown route, enforce Number on last uri
        "also/:slug/:num!num"
    ]);
 
// Test url against routes
matchroute.test( url );
 
// Compare a route against a url
matchroute.compare( route, url );
 
// Parse a url against routes config
matchroute.parse( url, routes );
 
// Get params property from .parse()
matchroute.params( url );
 
// Set routes config
matchroute.config( routes );
 
// Wildcard any route that is non-external to your domain
var matchroute = new MatchRoute( ["*"] );

install

npm i properjs-matchroute

Downloadsweekly downloads

12

version

0.2.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar