Update the query param's value of the input URL.
Usage:
import { updateQueryParam } from "mazey";const ret1 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t3", "three");const ret2 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t4", "four");console.log(ret1);console.log(ret2); Copy
import { updateQueryParam } from "mazey";const ret1 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t3", "three");const ret2 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t4", "four");console.log(ret1);console.log(ret2);
Output:
http://example.com/?t1=1&t2=2&t3=three&t4=4 http://example.com/?t1=1&t2=2&t3=3&t4=four Copy
http://example.com/?t1=1&t2=2&t3=three&t4=4 http://example.com/?t1=1&t2=2&t3=3&t4=four
URL string.
Query param.
Param's value.
URL.
Update the query param's value of the input URL.
Usage:
Output: