Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 483 Bytes

README.md

File metadata and controls

17 lines (11 loc) · 483 Bytes

Cookie Tray

A very simple and small (<0.5kb) library for serializing and deserializing cookies.

Usage

import cookie from 'cookie-tray';
// import { parse, stringify } also works

cookie.parse('cookies=fun; something=else'); // { cookies: 'fun', something: 'else' }
cookie.parse(document.cookie);

cookie.stringify({ cookies: 'fun', something: 'else' }); // cookies=fun; something=else

You can feed these values directly into the Cookie and Set-Cookie headers.