Open buschtoens opened 10 years ago
Would close #1.
-1 to global options, that would mess with other libs, I think we can close #1, not very useful
Ah, yeah. I see, but maybe the user is really interested in doing so because of reasons? Haha.
The user would be left with two options: Carrying a temporary options object around and including it in every call or (the better way) building custom functions around qs.
var myqs = {};
myqs.parse = function(str) { qs.parse(str, { /* ... */ }); };
Still, if you're in an environment where you need to change, let's say, the delimeter, this would most likely apply to all other libs accessing qs and you'd want them to use the same qs you do.
Libs that really want to access the defaults, because they know what they're doing, could qs.parse("blah", false)
which we could interpret as "use the defaults" or pass in the specific options they require to be set in a certain way. However, this is not backwards compatible. When users start using global options, they could break other libs, if both access the same version (never use "*", guys!).
Still -1 on global options? Then we'll go along with the second parameter only and recommend custom functions in the docs.