Skip to content

Instantly share code, notes, and snippets.

@oguzhancvdr
Created October 22, 2022 19:32
Show Gist options
  • Save oguzhancvdr/21a7b45fd70fe17979ceabb6ce2ba8cc to your computer and use it in GitHub Desktop.
Save oguzhancvdr/21a7b45fd70fe17979ceabb6ce2ba8cc to your computer and use it in GitHub Desktop.
/**
* Returns the provided URLs search parameters
* as a set of key-value pairs.
*/
const getURLParameters = (url) => {
const { searchParams } = new URL(url);
return Object.fromEntries(searchParams);
};
@oguzhancvdr
Copy link
Author

Get Parameters from a URL and Convert Them to Object

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