Skip to content

Instantly share code, notes, and snippets.

@fentas
Created April 9, 2014 16:36
Show Gist options
  • Save fentas/10289901 to your computer and use it in GitHub Desktop.
Save fentas/10289901 to your computer and use it in GitHub Desktop.
Simple js for converting cookie string into object
cookies = {};
// read out cookies
document.cookie.replace(/([^=;]+)=([^;]*)/gi, function(m,key,value) {cookies[key.replace(/(^\s+|\s+$)/g,'')] = value.replace(/(^\s+|\s+$)/g,'');});
@abdulazeez761
Copy link

abdulazeez761 commented Oct 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment