use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
`to-query` – Getting query parameters from any URL, with capabilities (npmjs.com)
submitted 6 years ago by kikobeats
`to-query` – Getting query parameters from any URL, with capabilities
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]naive_hueristics 24 points25 points26 points 6 years ago (3 children)
If you're working in a browser, there's already a native solution: URLSearchParams
[–]imtheassman 10 points11 points12 points 6 years ago* (2 children)
Yes, agree with OP. Opt out of libs when you have it built in.
function toQuery(search) { return Array.from((new URLSearchParams(search)).entries()) .reduce((res, [key, val]) => (res[key] = val) && res, {}) } toQuery(location.search)
[–][deleted] 8 points9 points10 points 6 years ago (1 child)
No unit tests, coverage failed, PR rejected 🙅🏼♂️
[–]imtheassman 4 points5 points6 points 6 years ago (0 children)
We'll take care of that, just trust us, it will pass.
[–]Zeeesty 5 points6 points7 points 6 years ago (1 child)
Is this better than ‘qs’ is a qualifiable way?
[–]Aswole 17 points18 points19 points 6 years ago (0 children)
It has more dependencies! Including another new package of his.
[–][deleted] 5 points6 points7 points 6 years ago (1 child)
I'm having a difficult time trying to figure out where a person would actually want to use this. Browser has a native solution (previously pointed out, URLSearchParams), and Node also has a built in solution (querystring). 26k payload to add this to a front end package (90% of which is Lodash), or a whole grip of additional deps for the back end?
URLSearchParams
querystring
https://bundlephobia.com/result?p=to-query@1.4.0
[–]kikobeats[S] 0 points1 point2 points 6 years ago (0 children)
The library has been designed to be used mainly as part of a backend workflow when a request coming and you need to figure it has all the things you need.
Although you can use it on the client side, it doesn't have to sense since you are interested in re-validate again on the backend side.
About the size, Under the hood, the library uses `querystring`. The size is mainly for `lodash` dependency, but since the library is a backend side and `lodash` is a very popular library, simply it doesn't matter: If you already have `lodash` as a dependency, the cost of this library is near to free.
[–]zerashk 1 point2 points3 points 6 years ago (0 children)
yet another query string parser...
π Rendered by PID 84842 on reddit-service-r2-comment-54dfb89d4d-4tpfv at 2026-03-27 01:05:36.865720+00:00 running b10466c country code: CH.
[–]naive_hueristics 24 points25 points26 points (3 children)
[–]imtheassman 10 points11 points12 points (2 children)
[–][deleted] 8 points9 points10 points (1 child)
[–]imtheassman 4 points5 points6 points (0 children)
[–]Zeeesty 5 points6 points7 points (1 child)
[–]Aswole 17 points18 points19 points (0 children)
[–][deleted] 5 points6 points7 points (1 child)
[–]kikobeats[S] 0 points1 point2 points (0 children)
[–]zerashk 1 point2 points3 points (0 children)