jj.js 0.8.7 → 0.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/url.js +9 -8
  2. package/package.json +1 -1
package/lib/url.js CHANGED
@@ -55,14 +55,15 @@ class Url extends Context
55
55
  url = routes[url].url;
56
56
 
57
57
  if(~url.indexOf(':')) {
58
- url = url.replace(/\:([^./]+)/g, (match, key) => {
59
- key = key.split('(')[0];
60
- if(key in query) {
61
- const value = query[key];
62
- delete query[key];
63
- return querystring.escape(value);
64
- } else if(this.ctx.params && key in this.ctx.params) {
65
- return querystring.escape(this.ctx.params[key]);
58
+ url = url.replace(/\:([^/]+\(.*\)|[^/]+)/g, (match, key) => {
59
+ key = key.split(/[(.]/);
60
+ const k = key[0];
61
+ if(k in query) {
62
+ const value = query[k];
63
+ delete query[k];
64
+ return querystring.escape(value) + (!key[1] || ~key[1].indexOf(')') ? '' : '.' + key[1]);
65
+ } else if(this.ctx.params && k in this.ctx.params) {
66
+ return querystring.escape(this.ctx.params[k]);
66
67
  }
67
68
  return match;
68
69
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jj.js",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "A simple and lightweight MVC framework built on nodejs+koa2",
5
5
  "main": "jj.js",
6
6
  "scripts": {