cookie-getter
Super light, high performance clientside cookie reader module.
Last updated 4 years ago by henrikjoreteg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cookie-getter 
SYNC missed versions from official npm registry.

cookie-getter

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.

Why publish another cookie tool?

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

Current Tags

  • 2.0.0                                ...           latest (4 years ago)

5 Versions

  • 2.0.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           8 years ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |