make parse support nest structure#5
Conversation
alsotang
commented
Apr 28, 2014
|
这改动也太大了吧, 加了 nest structure, 要加这么多东西? |
|
我把目录结构拆了下,主要是 lib/parse.js 这个文件是新增内容。 |
|
嵌套的 querystring 还会有这种东西的 |
There was a problem hiding this comment.
我修修这些奇怪的地方,这些代码是从 node-querystirng 拷来的。
There was a problem hiding this comment.
我们不是 node-querystring, 没必要去照抄, 原来的代码能work, 没必要去修改.
There was a problem hiding this comment.
原来的代码不是不支持嵌套的结构吗?
On 2014年4月28日, at 14:40, fengmk2 notifications@github.com wrote:
In lib/parse.js:
- * Object#toString() ref for stringify().
- /
+
+var toString = Object.prototype.toString;
+
+/*- * Object#hasOwnProperty ref
- /
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/*- * Array#indexOf shim.
- */
+
+var indexOf = typeof Array.prototype.indexOf === 'function'
我们不是 node-querystring, 没必要去照抄, 原来的代码能work, 没必要去修改.—
Reply to this email directly or view it on GitHub.
|
我把那些 shim functions 都去掉了。可能是因为 node-querystring 要支持前端所以搞了这些 shim 吧。 |
|
我先将代码拉下来本地看看 |
|
lib/index.js 引用了 lib/parse.js , lib/parse.js 又引用了 lib/index.js ? |
|
现在按 node-querystring 怎么感觉那么复杂? 之前我是按 https://github.com/joyent/node/blob/master/lib/querystring.js 来写的, 代码挺简单的. |
|
我觉得应该给 https://github.com/visionmedia/node-querystring 提交pr, 让它支持自定义 encode 和 decode 方法, 就ok了, 没必要重现实现一个. |
|
@alsotang 我起了一个头, 给 node 的 querystring 提交了一个 pr |
|
@alsotang �有动静了么? |
|
不好意思哈,前几天没动电脑。 |
|
我前两天刚帮 tj 的 superagent 提了个 charset 方面的代码,直接被关闭了。。不知道是不是外国人不愿意趟字符编码的浑水 |
|
我等等看你那边 querystring 的动静再帮 tj 提吧。官方的 qs 是 tj 的 qs 的一个功能子集,不支持嵌套。 |
|
@alsotang node已经合并了,给tj提吧,urlencode就不干这事了 |
|
好的。 |