Created
November 7, 2017 18:01
-
-
Save Dammic/60bff65488210f559fe2d382c6955ca4 to your computer and use it in GitHub Desktop.
Query
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
function buildQueryString(args){ | |
const argsArray = Object | |
.entries(args) | |
.filter(([key, value]) => value !== undefined); | |
if (!argsArray.length) return ''; | |
return `?${argsArray | |
.map(([key, value]) => `${key}=${value}`) | |
.join('&') | |
}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment