manen / cookie-tray

Tiny cookie parser and serializer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Tiny cookie parser and serializer

License:MIT License


Languages

Language:TypeScript 52.5%Language:JavaScript 47.5%