1.0.0 • Published 1 year ago

baked-cookies v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Baked Cookies

npm version

Pure JS library to parse and serialize cookie strings for further manipulation

Install

Using npm:

npm install --save baked-cookies

Using yarn:

$ yarn add baked-cookies

Usage

In this example we are parsing cookie string. As result we are getting object of key-value pairs with cookies data.

import { parse } from 'baked-cookies';

const parseResult = parse('cookieKey=cookieValue;'); // parseResult = {cookieKey: 'cookieValue'}

Here we are serializing object of key-value pair into cookie string.

import { serialize } from 'baked-cookies';

const serializeResult = serialize({cookieKey: 'cookieValue'}); // serializeResult = 'cookieKey=cookieValue;'

License

Baked Cookies is released under the MIT license.