Skip to content

Instantly share code, notes, and snippets.

@cedricdelpoux
Last active August 29, 2015 14:27
Show Gist options
  • Save cedricdelpoux/d7b4cd1fc2da975c1414 to your computer and use it in GitHub Desktop.
Save cedricdelpoux/d7b4cd1fc2da975c1414 to your computer and use it in GitHub Desktop.
Object to query string
Object.keys(object).reduce((result, key) => (
object[key] !== null && object[key] !== undefined
? (result += key + '=' + object[key] + '&')
: result
), '?').slice(0, -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment