Skip to content

Commit 66a9805

Browse files
committed
fixed bug where value is null
1 parent 87145e3 commit 66a9805

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/arg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
if (!obj.hasOwnProperty(key)) continue;
147147
var val = obj[key];
148148

149-
if (typeof(key) === "undefined" || key.length === 0 || typeof(val) === "undefined" || val.length === 0) continue;
149+
if (typeof(key) === "undefined" || key.length === 0 || typeof(val) === "undefined" || val === null || val.length === 0) continue;
150150

151151
thisKey = keyPrefix ? keyPrefix+"."+key : key;
152152

test/spec/arg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ describe("Arg.stringify", function(){
498498
o["b"] = 1;
499499
o["c"] = un;
500500
o["d"] = "";
501-
expect(Arg.stringify({"a":o.un,"b":1,"c":o.un,"d":[]})).toEqual("b=1")
501+
expect(Arg.stringify({"a":o.un,"b":1,"c":o.un,"d":[],"e":undefined,"f":null})).toEqual("b=1")
502502
});
503503

504504
it("should ignore keyless values", function(){

0 commit comments

Comments
 (0)