Skip to content

Suggestion: keepQueryParameters #172

@ozgurg

Description

@ozgurg

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'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions