Last active
August 29, 2015 14:11
-
-
Save igroff/d60171e1b68ccfcae4b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* The idea here is that we take something that's formatted like a query string, and | |
| return a dictionary (object) it represents | |
| */ | |
| function qsLikeToObj(qsLike){ | |
| var obj = {}; | |
| qsLike.replace( | |
| new RegExp("([^?=&]+)(=([^&]*))?", "g"), | |
| function($0, $1, $2, $3) { obj[$1] = $3; } | |
| ); | |
| return obj; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment