Last active
February 4, 2016 13:22
-
-
Save kevbradwick/fc820c6aa8813636c74c to your computer and use it in GitHub Desktop.
cookie split to object
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
var cookies = {}; | |
document.cookie.split('; ').forEach(function(pair) { | |
var parts = pair.split('='); | |
cookies[parts[0]] = parts.splice(1).join('='); | |
}); | |
console.log(cookies); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment