Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options parameter reference is mutated by parse #207

Closed
seansfkelley opened this issue Apr 11, 2017 · 2 comments
Closed

options parameter reference is mutated by parse #207

seansfkelley opened this issue Apr 11, 2017 · 2 comments

Comments

@seansfkelley
Copy link

The reference passed into parse gets mutated, which is unexpected (especially when you, like I, use a file-level constant as the reference).

> options = {}
{}
> qs.parse('', options);
{}
> options
{"delimiter":"&","depth":5,"arrayLimit":20,"parseArrays":true,"allowDots":false,"plainObjects":false,"allowPrototypes":false,"parameterLimit":1000,"strictNullHandling":false}

The same is true of stringify, but to a lesser degree.

Neither parse nor stringify should modify any of their input parameters.

@ljharb
Copy link
Owner

ljharb commented Apr 11, 2017

I agree; this behavior is legacy.

@seansfkelley
Copy link
Author

Thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants