node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

sort-routes

sort-routes

var bySpecificity = require('sort-routes');
var routes = [
    '/characters/:id',
    '/characters',
    '/characters/new',
];
 
routes.sort(bySpecificity);
[
    '/characters',
    '/characters/new',
    '/characters/:id',
]