qs
qs copied to clipboard
Access the browser's query string as a JavaScript object. No dependencies.
In case we have array of GET parameters like `?filters[showDeleted]=1,filters[hideInactive]=1` gs.get() will return encoded params with replaced special symbols ``` params = { "filters%5BshowDeleted%5D": 1, "filters%5BhideInactive%5D": 1, } ``` Problem...
Right now, qs just gets the query string (window.location.search). There may be a need/want for it to get other parts of the URL like... - protocol - domain - path...
While `qs.get()` gets the current query string, a `qs.set()` method could **set** the query string. It may work something like `qs.set({ post: '1234' });` or `qs.set('post', '1234')` or both.
Tests would be a huge benefit to this project. However, writing tests for the browser that work with the query string (`window.location.search`) appears to be difficult.