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

Suggestion: keepQueryParameters #172

Closed
ozgurg opened this issue Aug 27, 2022 · 0 comments · Fixed by #173
Closed

Suggestion: keepQueryParameters #172

ozgurg opened this issue Aug 27, 2022 · 0 comments · Fixed by #173

Comments

@ozgurg
Copy link
Contributor

ozgurg commented Aug 27, 2022

Hi. I have a new option suggestion.
When we set removeQueryParameters to an array, the package remove query parameters that matches any of the provided strings or regexes. But it would be great if we could reverse this. We will set keepQueryParameters to an array, and the package will only keep that matches any of the provided strings or regexes.

removeQueryParameters:

normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
	removeQueryParameters: ['ref']
});
//=> 'http://sindresorhus.com/?foo=bar'

My suggestion:

normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
	keepQueryParameters: ['ref']
});
//=> 'http://sindresorhus.com/?ref=test_ref'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants