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

parse-cookies.js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-cookies.js

Parses document.cookie string into an object (dictionary) by * splitting at ';' and '='.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

parse-cookies.js (written in ES6)

license npm build code climate devDependencies

Install:

npm install parse-cookies.js

Run tests

npm test

parseCookies()

Parses document.cookie string into an object (dictionary) by splitting at ';' and '='.

import parseCookies from 'parse-cookies';

parseCookies('a=1;b=2;c=3'); // result: {a: '1', b: '2', c: '3'}
parseCookies('a=1;b=2;a=3'); // result: {a: '3', b: '2'}
import parseCookies from 'parse-cookies';

let cookies = parseCookies('a=x;b=y', function (x) {
    return '<' + x + '>';
});

// result: {a: '<x>', b: '<y>'}

let cookies = parseCookies('a=1;b=2', function (x) {
    return parseInt(x, 10);
});

// result: {a: 1, b: 2}

Copyright © 2015 Maximilian Heinz, contributors. Released under the MIT License

Keywords

FAQs

Package last updated on 04 Sep 2015

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