Created
January 13, 2012 14:36
-
-
Save dharFr/1606525 to your computer and use it in GitHub Desktop.
Simple CoffeeScript function to extracts parameters from URL
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
utils = utils || {} | |
utils.extractURLParams =-> | |
params = window.location.search.substring(1).split "&" | |
result = {} | |
for param in params | |
strParam = param.toString() | |
sepPos = strParam.indexOf "=" | |
key = strParam.substring 0, sepPos | |
value = decodeURIComponent strParam.substring (sepPos + 1) | |
result[key] = value | |
result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment