Skip to content

Commit

Permalink
Fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat Ryer committed Oct 1, 2013
1 parent 67e1568 commit 2ef7b97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Arg.js gives you quick and easy access to parameters in the URL.
* Added `Arg(key)` shorter interface as well as `Arg.get(key)`.
* Ignores undefined/empty keys and values.
* Cleans up edge cases (i.e. where paths are present in parse() calls etc).
* Added support for anchors in `Arg.url(path, params, anchorString)` (i.e. no longer assumes they're variables if it's a string)

##### v1.0.0

Expand Down
2 changes: 1 addition & 1 deletion src/arg.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
segs[0] = Arg._cleanPath(arguments[0]);
segs[1] = Arg.querySeperator;
segs.push(Arg.stringify(arguments[1]));
segs.push(Arg.hashQuerySeperator);
(typeof(arguments[2])==="string") ? segs.push(Arg.hashSeperator) : segs.push(Arg.hashQuerySeperator);
segs.push(Arg.stringify(arguments[2]));
}

Expand Down
4 changes: 4 additions & 0 deletions test/spec/arg.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ describe("Arg.url", function(){
expect(Arg.url("http://www.stretchr.com/?one=1&two=2", {three:3})).toEqual("http://www.stretchr.com/?one=1&two=2&three=3");
});

it("should use an anchor if a stirng is specified for the hash", function(){
expect(Arg.url("http://www.stretchr.com/", {name:"Mat"}, "anchor")).toEqual("http://www.stretchr.com/?name=Mat#anchor")
});

it("should work nicely with .all()", function(){

Arg = MakeArg();
Expand Down

0 comments on commit 2ef7b97

Please sign in to comment.