Keep the + sign in the URL
I saw the issue: https://github.com/sindresorhus/query-string/issues/305 And I understand the concept but is it possible to add a flag to the queryString.parse options that will keep the + sign and will not replace them with a space? something like:
const paramsUrl = queryString.parse(decodeURIComponent(location.search), {
parseBooleans: true,
ignorePlus: true
arrayFormatSeparator: "|",
arrayFormat: "bracket-separator",
})
What's the word on this?
I don't plan to add an option for this. By standard (application/x-www-form-urlencoded) and by URLSearchParams, + in the query is a space; libraries should match the platform, not invent a new dialect. If you need a literal plus, encode it as %2B (use stringify() or URLSearchParams.append). If you’re parsing untrusted, non-conformant input and must preserve raw +, use parse(..., {decode:false}) and do selective decoding yourself. Also: don’t pre-decode, pass location.search directly to parse().