baked-cookies
v1.0.0
Published
Pure JS library to parse and serialize cookie strings for further manipulation
Downloads
5
Maintainers
Readme
Baked Cookies
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.