new DynamicURL(
url):DynamicURL
string
DynamicURL
resolve():
string
Resolves and returns the final URL as a string.
string
const url = new DynamicURL("https://example.com/{citizen}/{hero}");
url.setRouteParams({ citizen: "robespierre", hero: "ironman" });
// Resolve the final URL
console.log(url.resolve()); // "https://example.com/robespierre/ironman"setQueryParams(
query,options?):DynamicURL
Takes a query object and appends it to the URL as a query string.
Record<string, any>
An object representing the query parameters.
IStringifyQueryOptions
DynamicURL
const url = new DynamicURL("https://example.com");
url.setQueryParams({ citizen: "robespierre", hero: "ironman" });
console.log(url.resolve()); // "https://example.com?citizen=robespierre&hero=ironman"setRouteParams(
replaceValue):DynamicURL
Replaces route parameters in the URL with the provided values.
An object or string to replace the route parameters.
string | TParamsObject
DynamicURL
TParamsObject
const url = new DynamicURL("https://example.com/{citizen}/{hero}");
url.setRouteParams({ citizen: "robespierre", hero: "ironman" });
console.log(url.resolve()); // "https://example.com/robespierre/ironman"