urlpattern解析入门使用以下命令安装模块:


npm install li-urlpattern


var pattern = require('li-urlpattern');

// -> /users/1000

pattern.parse('/users/:id', { id: 1000 });

文档即将推出。例子如下:


var pattern = require('li-urlpattern');

// => /users/1000

pattern.parse('/users/:id', { id: 1000 });

// => /users/1000?type=1

pattern.parse('/users/:id', { id: 1000, type: 1 });

// => /users/1000.j