Created
May 10, 2015 19:59
-
-
Save ColeMurray/12afd138f75f935055b7 to your computer and use it in GitHub Desktop.
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
if (Object.keys(args).length === 1) { | |
for (let key in args) { | |
if (args.hasOwnProperty(key)) { | |
queryString += `${key}=${args[key]}`; | |
} | |
} | |
} else if (Object.keys(args).length > 1) { | |
// else if keys length is larger than one key concat the querystring | |
// like so | |
for (let key in args) { | |
if (args.hasOwnProperty(key)) { | |
queryString += `${key}=${args[key]}&`; | |
} | |
} | |
// trim the last ampersand | |
queryString = queryString.substring(0, queryString.length - 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment