-
-
Save hightemp/655e8d2b9ac407855285da2a65d79c73 to your computer and use it in GitHub Desktop.
Parses location.hash into an Object
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
window.parseHash = function() { | |
var parsed = {}; | |
var pairs = window.location.hash.replace('#', '').split('&'); | |
pairs.forEach(function(pair) { | |
parsed[pair.split('=')[0]] = (parseInt(pair.split('=')[1], 10) || pair.split('=')[1]); | |
}); | |
return parsed; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment