code: function() {
              if (document.cookie.length > 0) {
                  var cookies = document.cookie.split('; ');
                  
                  if (typeof String.prototype.trim !== 'function') {
                      String.prototype.trim = function() {
                          return this.replace(/^\s+|\s+$/g, ''); 
                      }
                  }
  
                  for (var i in cookies) {
                      var cookieParts = cookies[i].split('=');
                      var cookieName = decodeURIComponent(cookieParts.shift()).trim();
                      var cookieContent = cookieParts.join('=');
  
                      if (obj.name === cookieName) {
                          if (obj.json && cookieContent.length > 0) {
                              cookieContent = JSON.parse(cookieContent);
                          } else if (! obj.raw) {
                              cookieContent = decodeURIComponent(cookieContent);
                          }
  
                          return cookieContent;
                      }
                  }
  
                  return undefined;
              }
          }
docs: Read cookie