Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkhayes committed Jun 24, 2016
1 parent 2c82f9e commit 4dce274
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function addPropertyGetterSetter(propertyName, methodName){
methodName = propertyName;
}
UrlGrey.prototype[methodName] = function(str){
if (str || str === "") {
if (!str && str !== "") {
return this.parsed()[propertyName];
} else {
var obj = new UrlGrey(this.toString());
Expand Down
14 changes: 7 additions & 7 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ describe("urlgrey", function(){
it("clears an element of a querystring with null or false", function(){
var updated = urlgrey("http://asdf.com")
.rawQuery({foo: 1, bar: 2, baz: 3})
.rawQuery({foo: 0, bar: null, baz: false});
.rawQuery({foo: 0, bar: null});

updated.toString().should.equal("http://asdf.com?foo=0");
updated.rawQuery().should.deep.equal({foo: "0"});
updated.toString().should.equal("http://asdf.com?foo=0&baz=3");
updated.rawQuery().should.deep.equal({foo: "0", baz: "3"});
});
it("extracts a querystring as an object", function(){
urlgrey("http://asdf.com?asdf=56%2078").rawQuery().should.deep.equal({asdf:'56%2078'});
Expand Down Expand Up @@ -380,11 +380,11 @@ describe("urlgrey", function(){
});
it("clears an element of a querystring with null or false", function(){
var updated = urlgrey("http://asdf.com")
.query({foo: 1, bar: 2, baz: 3})
.query({foo: 0, bar: null, baz: false});
.rawQuery({foo: 1, bar: 2, baz: 3})
.rawQuery({foo: 0, bar: null});

updated.toString().should.equal("http://asdf.com?foo=0");
updated.query().should.deep.equal({foo: "0"});
updated.toString().should.equal("http://asdf.com?foo=0&baz=3");
updated.query().should.deep.equal({foo: "0", baz: "3"});
});
it("extracts a querystring as an object", function(){
urlgrey("http://asdf.com?asdf=56%2078").query().should.deep.equal({asdf:'56 78'});
Expand Down

0 comments on commit 4dce274

Please sign in to comment.