Socket
Socket
Sign inDemoInstall

cookie-store

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cookie-store

A polyfill for the Cookie Store API


Version published
Weekly downloads
1.3K
decreased by-14.55%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Build Status npm version

A polyfill to allow use of the Cookie Store API in modern browsers that don't support it natively, including IE11. Also compatible with TypeScript.

Installation

npm install cookie-store

Basic Example

// import polyfill and declare types
import 'cookie-store';

// set a cookie
await cookieStore.set('forgive', 'me');
// get a cookie
const foo = await cookieStore.get('forgive');
console.log(foo); // 'me'

// set another cookie
await cookieStore.set('forget', 'it');

// get multiple cookies
const cookies = await cookieStore.getAll({
  name: 'for',
  matchType: 'starts-with',
});
const obj = {};
for (const cookie of cookies) {
  obj[cookie.name] = cookie.value;
}
console.log(obj); // { forgive: 'me', forget: 'it' }

// delete a cookie
await cookieStore.delete('forget');

Keywords

FAQs

Last updated on 04 Apr 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc