@sswahn/cookie

1.0.2 • Public • Published

Cookie · License npm version Weekly Downloads

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

Readme

Keywords

Package Sidebar

Install

npm i @sswahn/cookie

Weekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

4.47 kB

Total Files

5

Last publish

Collaborators

  • sswahn