tj / node-querystring

querystring parser for node and the browser - supporting nesting (used by Express, Connect, etc)
MIT License
455 stars 66 forks source link

Added Custom Delimiter Support #36

Closed mal closed 11 years ago

mal commented 12 years ago

Implements GH-1 - this time taking style tips from the coerce branch.

This will allow one additional single character delimiter to be used in conjunction with the existing syntax, allowing support for querystrings such as:

foo.bar[0].boing[he.llo].world.rawr=rawk.txt

To be parsed correctly with the . delimiter as:

{ foo: { bar: [ { boing: { 'he.llo': { world: { rawr: 'rawk.txt' } } } } ] } }

Found this behavior mentioned on mcavage/node-restify#94 which lead me to GH-1, figured I'd give it a whirl; feedback welcome.

tj commented 12 years ago

personally I dont see the point, everyone else on the planet uses foo[bar]=baz and it's really not that bad, people already know what it is and how it's parsed

mal commented 12 years ago

I agree that [] isn't that bad, but that's not the same as no room for improvement. After all it was in the issues list, so at some point its inclusion must have made sense.

tj commented 12 years ago

the main reason was because the original node one supported it before they took out nesting support, aside from disliking some of the characters there's no real reason to support it IMO

mal commented 12 years ago

I see, well it's not on by default, so it shouldn't go breaking any existing use cases. Maybe given the option people will prefer and migrate back to the dot notation (personally I think it suits node better), or maybe it won't get used at all. I'll leave its inclusion to your best guess at what the people want :)

tj commented 12 years ago

for better or for worse the only thing I've actually seen used in practice (other than paypal haha) is the [] notation. Not saying that's my favorite or anything but it's definitely what people have adopted

mal commented 11 years ago

No interest in this feature for now, so closing the PR to get to PR-0 for new year ;D