node package manager
Stop wasting time. Easily manage code sharing 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',
]