Skip to content

Instantly share code, notes, and snippets.

@bhaireshm
Created October 12, 2020 06:55
Show Gist options
  • Save bhaireshm/6db24c24dbd6f77a82733d8f49cccd83 to your computer and use it in GitHub Desktop.
Save bhaireshm/6db24c24dbd6f77a82733d8f49cccd83 to your computer and use it in GitHub Desktop.
Converting URL query parameters to object in javascript.
let search = location.search.substring(1), urlParams;
urlParams = JSON.parse(
'{"' + search.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
);
@bhaireshm
Copy link
Author

ez.js is more than just a library; it's a coding companion that simplifies complex tasks. Whether you're dealing with arrays, numbers, objects, or strings, ez.js has got your back! Say goodbye to coding hassles and hello to streamlined JavaScript magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment