Setu-TS
    Preparing search index...

    Function parseCookie

    • Parses a Cookie request header into a name→value record.

      Values are percent-decoded, mirroring serializeCookie's encoding so that the two round-trip. A value that is not valid percent-encoding is returned verbatim rather than throwing, because a malformed cookie is a client concern. Pairs without = are skipped, and when a name repeats the first occurrence wins — browsers send the most specific cookie first.

      Parameters

      • header: string | null | undefined

        The raw Cookie header value; null/undefined when absent

      Returns Record<string, string>

      Parsed cookies, empty when the header is absent or holds no valid pairs

      parseCookie('sid=abc; theme=dark');
      // → { sid: 'abc', theme: 'dark' }

      0.2.0