Skip to content

Instantly share code, notes, and snippets.

@yinkakun
Created October 20, 2023 14:57
Show Gist options
  • Save yinkakun/db8ad710047aa9ae970e35e8573ccc33 to your computer and use it in GitHub Desktop.
Save yinkakun/db8ad710047aa9ae970e35e8573ccc33 to your computer and use it in GitHub Desktop.
createQueryStrings
type CreateQueryStringsOpts = {
[key: string]: string;
};
export const createQueryStrings = (opts: CreateQueryStringsOpts) => {
const params = new URLSearchParams();
Object.keys(opts).forEach((key) => params.set(key, opts[key]));
return params.toString();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment