Readplace

GitHub - js-cookie/js-cookie: A simple, lightweight JavaScript API for handling cookies, client-side.

GitHub 6 min read
View original
Summary (TL;DR)
js-cookie is a lightweight JavaScript API for handling cookies client-side, supporting ES and AMD/CommonJS modules. It is RFC 6265 compliant and less than 800 bytes gzipped. Basic usage: import Cookies, use Cookies.set('name', 'value', {expires: 7}) to create cookies, Cookies.get('name') to read, and Cookies.remove('name') to delete. Attributes like expires, path, domain, secure, sameSite, and partitioned can be set per-call or globally via withAttributes(). Converters allow custom encoding/decoding. The noConflict method avoids namespace conflicts.