cookie-parser icon indicating copy to clipboard operation
cookie-parser copied to clipboard

Refactor JSONCookie function for clarity and compliance

Open Ayoub-Mabrouk opened this issue 1 year ago • 1 comments

  • Update JSDoc to clarify behavior and return types.
  • Replace str.substr(0, 2) with str.startsWith to check for the prefix 'j:'.
  • Simplify error handling by removing unused catch parameter.
  • Maintain functionality for parsing JSON cookies, returning undefined for invalid inputs.

Ayoub-Mabrouk avatar Nov 01 '24 02:11 Ayoub-Mabrouk

same as https://github.com/expressjs/cookie-parser/pull/119#issuecomment-2451729449

UlisesGascon avatar Nov 01 '24 11:11 UlisesGascon