Gozala / querystring

Node's querystring module for all engines.
MIT License
287 stars 72 forks source link

Handle leading `?` #33

Closed benjaminhoffman closed 6 years ago

benjaminhoffman commented 6 years ago

This one is curious for me because it seems so obvious that sure I am missing something. My apologies in advance if I am misunderstanding.

I want to be able to do decode(document.location.search) but when I do, I get:

{
  ?utm_source: something,
  utm_content: somethingElse
}

That leading ? is causing issues.

I would assume that this module would handle this very common situation already, no? If not, then maybe we can pass in an optional setting removeLeadingQuestionMark or something?

Great first issue! cc @isaacchien @rickbier @LitoMore :)

tyler-hoffman commented 6 years ago

@benjaminhoffman Hey fellow hoffman - I came here for the same problem. Since it looks like this repo isn't being maintained, you might want to check out https://github.com/sindresorhus/query-string. Cheers!

Gozala commented 6 years ago

@benjaminhoffman This library intentionally matches the API of node's built-in querystring which does behave as your issue describes.