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

cookiesync

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookiesync - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

19

lib/index.js

@@ -8,2 +8,6 @@ 'use strict';

var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _reactCookie = require('react-cookie');

@@ -15,3 +19,2 @@

var should = require('chai').should();
var mechanism = 'cookiesync';

@@ -53,5 +56,5 @@

should.exist(key);
should.exist(action);
should.exist(handler);
(0, _invariant2.default)(key, 'key is required');
(0, _invariant2.default)(action, 'action is required');
(0, _invariant2.default)(handler, 'handler is required');
var log = function log() {

@@ -72,5 +75,5 @@ return tracing ? logger[logLevel].apply(logger, arguments) : function () {};

should.exist(_instanceID, 'cookiesync cookies must have an instanceID associated => ' + JSON.stringify(value));
_instanceID.should.be.a('string').and.have.lengthOf(idLength);
should.exist(payload, 'cookiesync cookies must have a payload associated => ' + JSON.stringify(value));
(0, _invariant2.default)(_instanceID, 'cookiesync cookies must have an instanceID associated => ' + JSON.stringify(value));
(0, _invariant2.default)(typeof _instanceID === 'string' && _instanceID.length === idLength, 'instanceID must be a string');
(0, _invariant2.default)(payload, 'cookiesync cookies must have a payload associated => ' + JSON.stringify(value));
}

@@ -89,3 +92,3 @@ log('cookiesync#loadCookie', value);

args.should.be.lengthOf(1);
(0, _invariant2.default)(args.length === 1, 'should only have one argument');
var payload = args[0];

@@ -92,0 +95,0 @@

{
"name": "cookiesync",
"version": "1.2.0",
"version": "1.3.0",
"description": "a lightweight module to sync JS objects in realtime across tabs / windows of a browser.",

@@ -50,3 +50,3 @@ "main": "lib/index.js",

"dependencies": {
"chai": "^3.0.0",
"invariant": "^2.2.2",
"react-cookie": "github:noderaider/react-cookie#select"

@@ -59,2 +59,3 @@ },

"babel-register": "latest",
"chai": "^3.0.0",
"codecov": "^1.0.1",

@@ -61,0 +62,0 @@ "esdoc": "^0.4.6",

@@ -0,3 +1,3 @@

import invariant from 'invariant'
import cookie from 'react-cookie'
const should = require('chai').should()
const mechanism = 'cookiesync'

@@ -21,5 +21,5 @@

export default function cookiesync(key, action, handler, { tracing = false, logger = console, logLevel = 'info', idLength = 8, pollFrequency = 3000, path = '/', secure = false, httpOnly = false } = {}) {
should.exist(key)
should.exist(action)
should.exist(handler)
invariant(key, 'key is required')
invariant(action, 'action is required')
invariant(handler, 'handler is required')
const log = (...args) => tracing ? logger[logLevel](...args) : () => {}

@@ -34,5 +34,5 @@ const cookieOpts = { path, secure, httpOnly }

const { instanceID, payload } = value
should.exist(instanceID, `cookiesync cookies must have an instanceID associated => ${JSON.stringify(value)}`)
instanceID.should.be.a('string').and.have.lengthOf(idLength)
should.exist(payload, `cookiesync cookies must have a payload associated => ${JSON.stringify(value)}`)
invariant(instanceID, `cookiesync cookies must have an instanceID associated => ${JSON.stringify(value)}`)
invariant(typeof instanceID === 'string' && instanceID.length === idLength, 'instanceID must be a string')
invariant(payload, `cookiesync cookies must have a payload associated => ${JSON.stringify(value)}`)
}

@@ -47,3 +47,3 @@ log('cookiesync#loadCookie', value)

const saveCookie = (...args) => {
args.should.be.lengthOf(1)
invariant(args.length === 1, 'should only have one argument')
const [ payload ] = args

@@ -50,0 +50,0 @@ const value = { instanceID, payload }

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