Skip to content

Instantly share code, notes, and snippets.

@zhuangya
Forked from anonymous/poo.coffee
Created October 22, 2012 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuangya/3930355 to your computer and use it in GitHub Desktop.
Save zhuangya/3930355 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