Created
November 27, 2017 03:01
-
-
Save arronhunt/35f51a4d6f9f93b714935c80aca43682 to your computer and use it in GitHub Desktop.
Javascript keys to query string
This file contains hidden or 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
export const keysToQueryString = (keys) => ( | |
encodeURI(Object.keys(keys).reduce((string, key, index) => ( | |
`${string}${!index?'?':'&'}${key}=${keys[key]}` | |
), '')) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example