Last active
December 13, 2015 18:28
-
-
Save bloodyowl/4955668 to your computer and use it in GitHub Desktop.
getCookie
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
function getCookie(){ | |
var cookie = document.cookie | |
, regExp = /\s*([\w\-]+?)\s*=\s*([^;]*?)\s*(?:;|$)\s*/g | |
, obj = {} | |
cookie.replace(regExp, function(match, name, value){obj[name] = value}) | |
return obj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Returns an object representing the
document.cookie
.