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

cookie-getter

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-getter

Super light, high performance clientside cookie reader module.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Minimalist (<10 LOC), performant, clientside cookie reader module and nothing else. It is tolerant of being required server-side. It will simply returns null if called within node.

Dead simple function that has the best performance according to: http://jsperf.com/cookie-parsing

Handy to have as a separate module for easy installation with npm.

Usage

installing:

npm install cookie-getter

using:

var cookies = require('cookie-getter');

// returns the value of the cookie if it's just a simple string
var username = cookies('username');

// if the cookie is a JSON string it will parse it as well
user = cookies('user');

console.log(user.firstName); // logs out name of firstName value if encoded as JSON in cookie.

License

MIT

Keywords

FAQs

Package last updated on 16 Feb 2017

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