🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

js-simple-cookie

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-simple-cookie

A simple, lightweight JavaScript API for handling cookies

latest
Source
npmnpm
Version
1.5.1
Version published
Weekly downloads
45
136.84%
Maintainers
1
Weekly downloads
 
Created
Source

A simple, lightweight JavaScript API for handling browser cookies

Features

  • No dependency
  • TypeScript support

Installation

NPM

npm install js-simple-cookie

CDN

Alternatively, include js-simple-cookie via jsDelivr CDN or unpkg.

Usage

Import:

import Cookies from "js-simple-cookie";

Create a cookie

Cookies.set('name', 'value')
Cookies.set({ name: 'name', value: 'value' })
Cookies.set('name', 'value', { expires: 7000 })
Cookies.set({ name: 'name', value: 'value', expires: 7000 })

Read cookie:

Cookies.get('name') // => 'value'
Cookies.get('nothing') // => undefined

Read all visible cookies:

Cookies.get() // => { name: 'value' }

Delete cookie:

Cookies.remove('name')
Cookies.remove('name', '/')
Cookies.remove('name', '/', '.yourdomain.com')

Keywords

cookie

FAQs

Package last updated on 12 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts