Comparing version 0.5.4 to 0.5.5
@@ -5,3 +5,3 @@ { | ||
"description": "query-string parser / stringifier with nesting support", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"keywords": ["querystring", "query", "parser"], | ||
@@ -8,0 +8,0 @@ "scripts": ["index.js"], |
0.5.5 / 2013-03-20 | ||
================== | ||
* output key= for null or undefined values. Closes #52 | ||
0.5.4 / 2013-03-15 | ||
@@ -3,0 +8,0 @@ ================== |
11
index.js
@@ -198,6 +198,9 @@ | ||
key = keys[i]; | ||
if (null == obj[key]) continue; | ||
ret.push(stringify(obj[key], prefix | ||
? prefix + '[' + encodeURIComponent(key) + ']' | ||
: encodeURIComponent(key))); | ||
if (null == obj[key]) { | ||
ret.push(encodeURIComponent(key) + '='); | ||
} else { | ||
ret.push(stringify(obj[key], prefix | ||
? prefix + '[' + encodeURIComponent(key) + ']' | ||
: encodeURIComponent(key))); | ||
} | ||
} | ||
@@ -204,0 +207,0 @@ |
{ | ||
"name": "qs", | ||
"description": "querystring parser", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"keywords": ["query string", "parser", "component"], | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -20,3 +20,3 @@ | ||
{ str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}}, | ||
{ str: 'foo=bar', obj: { foo: 'bar', baz: null, raz: undefined }} | ||
{ str: 'foo=bar&baz=&raz=', obj: { foo: 'bar', baz: null, raz: undefined }} | ||
], | ||
@@ -23,0 +23,0 @@ 'escaping': [ |
382598
12603