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

    properjs-matchroutepublic

    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

    18

    version

    0.2.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar