Skip to main content
variable parseCookie
import { parseCookie } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Parse an HTTP Cookie header string and return an object of all cookie name-value pairs.

Use String.prototype.split(';') to separate key-value pairs from each other. Use Array.prototype.map() and String.prototype.split('=') to separate keys from values in each pair. Use Array.prototype.reduce() and decodeURIComponent() to create an object with all key-value pairs.

type

(str: string) => unknown