code: function set(name, value) {
  
          // if no value then remove
          if (!value) {
              remove(name);
              return;
          }
  
          if (localStorage) {
              try {
                  localStorage.setItem(name, value);
              }
              catch (ex) {}
          }
  
          _.isFunction($cookies.put) ?
              $cookies.put(name, value, { domain: cookieDomain }) :
              $cookies[name] = value;
  
      }
docs: Set a value in both localStorage and cookies
  @param name
  @param value