I am using query-string(version 5) and wondering is there away to remove a query string with it?
results?condition=Used
I want to remove condition
completely from the url.
If not any alternative way?
I am using query-string(version 5) and wondering is there away to remove a query string with it?
results?condition=Used
I want to remove condition
completely from the url.
If not any alternative way?
To process url, I prefer to use url package. For you case, I will do
const url = require('url');
const targetUrl = 'results?condition=Used&year=2010';
const parsedUrl = url.parse(targetUrl, true);
delete parsedUrl.search; // need to delete it so we can construct new query
delete parsedUrl.query.condition; // delete "condition"
console.log(url.format(parsedUrl)); // results?year=2010