New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yurkimus/cookies

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yurkimus/cookies

A collection of utilities for handling cookies in JavaScript.

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-90.48%
Maintainers
0
Weekly downloads
 
Created
Source

Cookies

A collection of utilities for handling cookies in JavaScript.

parseCookie

Parses a cookie string into a list of key-value pairs.

ParameterTypeDescription
cookiestringCookie string

Returns: [string, string][]

Example:

parseCookie('name=John; age=30; role=admin') // => [['name', 'John'], ['age', '30'], ['role', 'admin']]

readCookie

Reads cookies from a cookie string using a provided list of keys.

ParameterTypeDescription
keysstring or string[]List of keys or a single key
cookiestringCookie string

Example:

let cookie = 'name=John; age=30; role=admin'

readCookie('age', cookie) // => '30'

readCookie(['age', 'name'], cookie) // => ['30', 'John']

serializeCookie

Serializes a cookie from its components into a string.

ParameterTypeDescription
namestringThe name of the cookie
valuestringThe value of the cookie
attributes[string, string][]An array containing additional attributes for the cookie

Example:

let attributes = [
  ['path', '/'],
  ['expires', 'Wed, 21 Oct 2026 07:28:00 GMT'],
]

serializeCookie('name', 'John', attributes) // => 'name=John; path=/; expires=Wed, 21 Oct 2026 07:28:00 GMT'

FAQs

Package last updated on 15 Aug 2024

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