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

cookie-monster

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-monster - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.npmignore

63

index.js
var exports = module.exports = function (doc) {
if (!doc) doc = {};
if (typeof doc === 'string') doc = { cookie: doc };
if (doc.cookie === undefined) doc.cookie = '';
if (!doc) doc = {};
if (typeof doc === 'string') doc = { cookie: doc };
if (doc.cookie === undefined) doc.cookie = '';
var self = {};
self.get = function (key) {
var splat = doc.cookie.split(/;\s*/);
for (var i = 0; i < splat.length; i++) {
var ps = splat[i].split('=');
var k = unescape(ps[0]);
if (k === key) return unescape(ps[1]);
}
return undefined;
};
var self = {};
self.get = function (key) {
var cookiesSplat = doc.cookie.split(/;\s*/);
for (var i = 0; i < cookiesSplat.length; i++) {
var ps = cookiesSplat[i].split('=');
var k = unescape(ps[0]);
if (k === key) return unescape(ps[1]);
}
return undefined;
};
self.set = function (key, value, opts) {
if (!opts) opts = {};
var s = escape(key) + '=' + escape(value);
if (opts.expires) s += '; expires=' + opts.expires;
if (opts.path) s += '; path=' + escape(opts.path);
if (opts.domain) s += '; domain=' + opts.domain;
doc.cookie = s;
return s;
};
return self;
self.set = function (key, value, opts) {
if (!opts) opts = {};
var newCookie = escape(key) + '=' + escape(value);
if (opts.expires){
newCookie += '; expires=' + opts.expires;
}
if (opts.path) {
newCookie += '; path=' + escape(opts.path);
}
if (opts.domain) {
newCookie += '; domain=' + opts.domain;
}
doc.cookie = newCookie;
return newCookie;
};
return self;
};
if (typeof document !== 'undefined') {
var cookie = exports(document);
exports.get = cookie.get;
exports.set = cookie.set;
var cookie = exports(document);
exports.get = cookie.get;
exports.set = cookie.set;
}
{
"name" : "cookie-monster",
"description" : "Browserify-compatible module to get and set cookies in the browser",
"version" : "0.0.1",
"repository" : {
"type" : "git",
"url" : "git://github.com/kahnjw/cookie-monster.git"
},
"main" : "index.js",
"keywords" : [
"cookie",
"browser",
"browserify"
],
"license" : "MIT",
"author" : {
"name" : "Jarrod Kahn",
"email" : "jarrod.kahn@gmail.com"
}
"name": "cookie-monster",
"description": "Browserify-compatible module to get and set cookies in the browser",
"version": "0.0.2",
"repository": {
"type": "git",
"url": "git://github.com/kahnjw/cookie-monster.git"
},
"scripts": {
"test": "mocha"
},
"main": "index.js",
"keywords": [
"cookie",
"browser",
"browserify"
],
"license": "MIT",
"author": {
"name": "Jarrod Kahn",
"email": "jarrod.kahn@gmail.com"
},
"devDependencies": {
"chai": "^1.9.2",
"mocha": "^1.21.5"
}
}

Sorry, the diff of this file is not supported yet

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