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

react-cookie

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cookie - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

21

build/cookie.js

@@ -7,2 +7,4 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -25,5 +27,8 @@

var _isNode = require('is-node');
var _isNode2 = _interopRequireDefault(_isNode);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var IS_NODE = typeof document === 'undefined' || process && process.env && process.env.NODE_ENV === 'test';
var _rawCookie = {};

@@ -36,4 +41,4 @@ var _res = undefined;

function load(name, doNotParse) {
var cookies = IS_NODE ? _rawCookie : _cookie2.default.parse(document.cookie);
function load(name, doNotParse, opt) {
var cookies = _isNode2.default ? _rawCookie : _cookie2.default.parse(document.cookie, opt);
var cookieVal = cookies && cookies[name];

@@ -57,3 +62,3 @@

function select(regex) {
var cookies = IS_NODE ? _rawCookie : _cookie2.default.parse(document.cookie);
var cookies = _isNode2.default ? _rawCookie : _cookie2.default.parse(document.cookie);

@@ -88,3 +93,3 @@ if (!cookies) {

// Cookies only work in the browser
if (!IS_NODE) {
if (!_isNode2.default) {
document.cookie = _cookie2.default.serialize(name, _rawCookie[name], opt);

@@ -94,2 +99,8 @@ }

if (_isResWritable() && _res.cookie) {
var expressOpt = _extends({}, opt);
if (expressOpt.maxAge) {
// the standard for maxAge is seconds but express uses milliseconds
expressOpt.maxAge = opt.maxAge * 1000;
}
_res.cookie(name, val, opt);

@@ -96,0 +107,0 @@ }

{
"name": "react-cookie",
"version": "1.0.4",
"version": "1.0.5",
"description": "Load and save cookies within your React application",

@@ -34,2 +34,3 @@ "main": "build/cookie.js",

"cookie": "^0.3.1",
"is-node": "^1.0.2",
"object-assign": "^4.1.0"

@@ -47,2 +48,3 @@ },

"eslint-config-cyprex": "^1.1.1",
"eslint-plugin-flowtype": "^2.30.3",
"ghooks": "^1.3.2",

@@ -49,0 +51,0 @@ "jest": "^17.0.3"

@@ -46,3 +46,3 @@ # react-cookie

### Options
## Options
Support all the cookie options from the [RFC 6265](https://tools.ietf.org/html/rfc6265#section-4.1.2.1).

@@ -62,3 +62,4 @@

> domain for the cookie<br />
> Use `https://*.yourdomain.com` if you want to access the cookie in all your subdomains.
> Use `sub.domain.com` if you want to access the cookie on a specific sub-domain only.<br />
> Use `.yourdomain.com` if you want to access the cookie in all your subdomains.

@@ -65,0 +66,0 @@ ### secure

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