More details
The decodeURIComponent() function decrypts a component of a Uniform Resource Identifier (URI) that was previously encoded by encodeURIComponent() or a similar process.
/**
* 🪄 Qit.tools
* https://qit.tools
*
* Decodes a URL component by unescaping previously escaped characters.
* @param {string} input - The encoded URL component to decode.
* @returns {string} - The decoded URL component.
*/
export function decodeURL(input: string): string {
if (typeof input !== "string") {
throw new Error("Input must be a string.");
}
try {
return decodeURIComponent(input);
} catch (error) {
throw new Error("Failed to decode the URL component.");
}
}