Created
October 20, 2023 14:57
-
-
Save yinkakun/db8ad710047aa9ae970e35e8573ccc33 to your computer and use it in GitHub Desktop.
createQueryStrings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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