code: function shouldSetCookie(req) {
        // cannot set cookie without a session ID
        if (typeof req.sessionID !== 'string') {
          return false;
        }
  
        return cookieId !== req.sessionID
          ? saveUninitializedSession || isModified(req.session)
          : rollingSessions || req.session.cookie.expires != null && isModified(req.session);
      }
docs: determine if cookie should be set on response