lib/cookies.js
function convertCookie (value, converter) {
  if (value.indexOf('"') === 0) {
    // this is a quoted cookied according to RFC2068
    // remove enclosing quotes and internal quotes and backslashes
    value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  }

  let parsedValue;
  try {
    parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
  } catch (e) {
    // no need to fail if we can't decode
    log.warn(e);
  }

  return converter ? converter(parsedValue) : parsedValue;
}
function convertCookie (value, converter) {
  if (value.indexOf('"') === 0) {
    // this is a quoted cookied according to RFC2068
    // remove enclosing quotes and internal quotes and backslashes
    value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  }

  let parsedValue;
  try {
    parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
  } catch (e) {
    // no need to fail if we can't decode
    log.warn(e);
  }

  return converter ? converter(parsedValue) : parsedValue;
}
function convertCookie ( value , converter ) { if ( value . indexOf ( '"' ) === 0 ) { // this is a quoted cookied according to RFC2068 // remove enclosing quotes and internal quotes and backslashes value = value . slice ( 1 , - 1 ) . replace ( / \\" / g , '"' ) . replace ( / \\\\ / g , '\\' ) ; } let parsedValue ; try { parsedValue = decodeURIComponent ( value . replace ( / \+ / g , ' ' ) ) ; } catch ( e ) { // no need to fail if we can't decode log . warn ( e ) ; } return converter ? converter ( parsedValue ) : parsedValue ; }
parses the value if needed and converts the value if a converter is provided internal function, not exported
parses the value if needed and converts the value if a converter is provided internal function not exported