Skip to content

Instantly share code, notes, and snippets.

@IrhaAli
Created October 14, 2022 12:13
Show Gist options
  • Save IrhaAli/7644323c9483ea9928c14b5eb457470b to your computer and use it in GitHub Desktop.
Save IrhaAli/7644323c9483ea9928c14b5eb457470b to your computer and use it in GitHub Desktop.
Decodes a given url
const urlDecode = function(text) {
let elements = text.split('&');
let obj = {};
for (let i = 0; i < elements.length; i++){
let elementInfo = elements[i].split('=');
obj[elementInfo[0]] = elementInfo[1].replaceAll('%20', ' ');
}
return obj;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment