jQuery.unparam plugin

6th Dec 2011

jQuery.unparam plugin

I have just created a simple jQuery plugin to add the opposite functionality to the jQuery.param function. It will turn a set of url parameters back in to an object. Here's the usage at the moment.

it("should get basic query string vars from full url", function() { expect(jQuery.unparam('https://davetayls.me/?foo=one&bar=two')) .toEqual({ foo: "one", bar: "two" }); }); it("should get basic query string vars from just query params", function() { expect(jQuery.unparam('foo=one&bar=two')) .toEqual({ foo: "one", bar: "two" }); });

You can get hold of it on the Github repo