Comments (3)
I'll disagree with your disagreement. That no other implementations don't do it is a poor argument. This could be made part of the options object passed to the parse function. If you don't want it to be the default, fine but it should be an options. It's obvious that querystring parameters are not case sensitive and any querystring parser should handle them as such.
Anyway, I've change my local version to this
return Object.keys(ret).sort().reduce(function (result, key) {
var val = ret[key];
//Lowercase the key
key = key.toLowerCase();
if (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {
// Sort object keys, not values
result[key] = keysSorter(val);
} else {
result[key] = val;
}
return result;
}, Object.create(null));
from query-string.
I disagree and none of the other querystring implementations do this either.
I want to follow URLSearchParams
as much as possible:
x = new URLSearchParams('FOO=1&foo=2');
console.log(Array.from(x.keys()));
//=> ["FOO", "foo"]
from query-string.
You never know if a user or some other system is going to provide a querystring parameter in the same case that you expect.
https://github.com/sindresorhus/lowercase-keys
from query-string.
Related Issues (20)
- Decode-uri-component requirement forces CommonJS HOT 5
- Any reason for dropping `null` from the types for `ParsedQueryString` HOT 1
- named imports under v8 HOT 3
- Can no longer import specific exports in TypeScript HOT 2
- when update to version 8 broke my application HOT 19
- Query string containing & breaks response object HOT 1
- Optional chaining operator (?.) is not supported in IE and other old browsers HOT 2
- Stringify Array of Object URL HOT 1
- query-string not supported on typescript HOT 2
- require() of ES Module HOT 4
- why function parse โreplace(/\+/g, ' ')โ HOT 1
- Keep the + sign in the URL
- You may need an additional loader to handle the result of these loaders. HOT 3
- About tree-shaking HOT 3
- SyntaxError with importing queryString module HOT 2
- Expected behavior of `stringifyUrl` with `fragmentIdentifier: ''`
- `key=null` parsing to `null`, not the string "null" HOT 1
- Error on compile NESTJS HOT 1
- 'colon-list-separator' - array with one key and multiple values instead of multiple keys with one value
- 'arrayFormatSeparator' without URL Encode will be abnormal in iOS 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from query-string.