logo

Cookie

This is a collection of functions for working with HTTP cookies.

Serialize

The serializeCookie function serializes a cookie name-value pair into a string suitable for use in a Set-Cookie header or document.cookie property.

import { serializeCookie } from '@aracna/core';

// will log "a=0"
console.log(serializeCookie('a', '0'));

Deserialize

The deserializeCookie function deserializes a cookie string to an object.

import { deserializeCookie } from '@aracna/core';

// will log { a: "0" }
console.log(deserializeCookie('a=0'));