parse-cookie-string
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Parse cookie string

Parse a string of cookies into a javascript object.

Install using npm i parse-cookie-string or yarn add parse-cookie-string.

Example

import { parseCookieString } from 'parse-cookie-string'; const cookies = parseCookieString(cookieString);

input: "userid=10; theme=default; jwt=somevalue"
output: {
  userId: 10,
  theme: default,
  jwt: somevalue
}

Typescript

Pass a generic to type the return value like this:

parseCookieString<{ jwt: string }>(cookies)

Dependents (0)

Package Sidebar

Install

npm i parse-cookie-string

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

14.3 kB

Total Files

7

Last publish

Collaborators

  • tea-lover-418