Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

universal-cookie

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-cookie

Universal cookies for JavaScript

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
decreased by-2.55%
Maintainers
1
Weekly downloads
 
Created

What is universal-cookie?

The universal-cookie npm package is a JavaScript library for managing cookies in both browser and Node.js environments. It provides a simple and universal API to handle cookies, making it easier to work with cookies across server-side and client-side without changing the codebase.

What are universal-cookie's main functionalities?

Get a cookie

This feature allows you to retrieve the value of a cookie by its name. It's useful for accessing user preferences or session data stored in cookies.

const cookies = new UniversalCookie();
const myCookie = cookies.get('myCookieName');

Set a cookie

This feature enables you to create a new cookie or update an existing one with a value, path, and maximum age. It's commonly used for storing user preferences or session tokens.

const cookies = new UniversalCookie();
cookies.set('myCookieName', 'myCookieValue', { path: '/', maxAge: 3600 });

Remove a cookie

This feature allows you to delete a cookie from the browser. It's useful for logging out users or clearing session data.

const cookies = new UniversalCookie();
cookies.remove('myCookieName', { path: '/' });

Other packages similar to universal-cookie

Keywords

FAQs

Package last updated on 21 Mar 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc