Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2012 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3930352 to your computer and use it in GitHub Desktop.
Save anonymous/3930352 to your computer and use it in GitHub Desktop.
queryToObject = (queryString) ->
ret = {}
for i in queryString.split '&'
i.replace /([^=]+)=(\w+)/, (match, p1, p2) ->
ret[p1] = p2
ret
console.log queryToObject 'foo=bar&nav=cap'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment