stretchr / arg.js

Lightweight URL argument and parameter parser
Other
1.06k stars 47 forks source link

Fixed issues in parse causing improperly parsed complex query strings #11

Closed joshschumacher closed 11 years ago

joshschumacher commented 11 years ago

Re-wrote Arg._access method

matryer commented 11 years ago

Wow that looks sexy.

Sent from my iPhone

On 2 Oct 2013, at 16:11, Josh Schumacher notifications@github.com wrote:

Re-wrote Arg._access method

Will now optionally coerce a native type out of value if possible (ie Number, Boolean, undefined, etc). To not coerce, set Arg.coerceMode = false Better handling of complex objects that have mixed nested objects/arrays. See new test case added to test/spec/arg.js for an example object that was failing and is no longer failing. Removed the need for boolean shouldSet value passed to Arg._access. Now assumes if value is undefined that you are in get mode and shouldSet = false. You can merge this Pull Request by running

git pull https://github.com/joshschumacher/arg.js master Or view, comment on, or merge it at:

https://github.com/stretchr/arg.js/pull/11

Commit Summary

Fixed issues in parse causing improperly parsed complex query strings File Changes

M src/arg.js (90) M test/spec/arg.js (105) Patch Links:

https://github.com/stretchr/arg.js/pull/11.patch https://github.com/stretchr/arg.js/pull/11.diff