querystring: remove name from stringify()

QueryString.stringify() allowed a fourth argument that was used as a
conditional in the return value, but was undocumented, not used by core
and always was always false/undefiend. So the argument and conditional
have been removed.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
Yorkie
2013-12-28 20:59:57 +08:00
committed by Trevor Norris
parent 96dffb1217
commit 8d3bc88bbe
2 changed files with 3 additions and 6 deletions

View File

@@ -125,7 +125,7 @@ var stringifyPrimitive = function(v) {
};
QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) {
QueryString.stringify = QueryString.encode = function(obj, sep, eq) {
sep = sep || '&';
eq = eq || '=';
if (util.isNull(obj)) {
@@ -145,10 +145,7 @@ QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) {
}).join(sep);
}
if (!name) return '';
return QueryString.escape(stringifyPrimitive(name)) + eq +
QueryString.escape(stringifyPrimitive(obj));
return '';
};
// Parse a key=val string.

View File

@@ -124,7 +124,7 @@ qsWeirdObjects.forEach(function(testCase) {
});
qsNoMungeTestCases.forEach(function(testCase) {
assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '=', false));
assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '='));
});
// test the nested qs-in-qs case