@sswahn/cookie
v1.0.2
Published
A lightweight, easy-to-use utility for efficiently managing cookies in a web browser.
Downloads
2
Readme
Cookie ·
A lightweight, easy-to-use utility for efficiently managing cookies in a web browser.
Features
- Get Cookie: Retrieve the value of a cookie.
- Set Cookie: Set a cookie with optional attributes.
- Remove Cookie: Easily delete a cookie.
Installation
Using npm.
npm install @sswahn/cookie
Usage
Import library.
import cookie from '@sswahn/cookie'
Get Cookie
Retrieve a cookie by name.
const token = cookie.get('name')
Set Cookie
Set a cookie, with optional expiration argument (a numeric value representing the lifetime of the cookie in seconds).
cookie.set('name', value, expiration)
Remove Cookie
Remove a cookie.
cookie.remove('name')
Related
- @sswahn/storage: A robust and easy-to-use utility for interacting with Web Storage API.
- @sswahn/database: Easily interact with the IndexedDB API with a simplified, promise-based approach.
- @sswahn/cache: A robust caching utility that provides easy-to-use methods for interacting with the browser's Cache API.
License
Cookie is MIT Licensed