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

diffsync

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diffsync - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

7

package.json
{
"name": "diffsync",
"version": "1.0.0",
"version": "1.0.1",
"description": "Real time collaborative editing for JSON objects",

@@ -10,4 +10,5 @@ "main": "index.js",

"dependencies": {
"jsondiffpatch": "^0.1.31",
"underscore": "^1.8.3"
"amp-bind": "^1.0.1",
"amp-is-empty": "^1.0.2",
"jsondiffpatch": "^0.1.31"
},

@@ -14,0 +15,0 @@ "devDependencies": {

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

var _ = require('underscore'),
var isEmpty = require('amp-is-empty'),
bind = require('amp-bind'),
EventEmitter = require('events').EventEmitter,

@@ -30,3 +31,10 @@ jsondiffpatch = require('jsondiffpatch').create({

_.bindAll(this, '_onConnected', 'syncWithServer', 'applyServerEdit', 'applyServerEdits', 'schedule');
// bind functions
var methodsToBind = ['_onConnected', 'syncWithServer', 'applyServerEdit', 'applyServerEdits', 'schedule'],
method;
for(var index in methodsToBind){
method = methodsToBind[index];
this[method] = bind(this[method], this);
}
};

@@ -108,3 +116,3 @@

// 2) add the difference to the local edits stack if the diff is not empty
if(!_.isEmpty(diff)){
if(!isEmpty(diff)){
this.doc.edits.push(this.createDiffMessage(diff, basedOnLocalVersion));

@@ -220,3 +228,3 @@ this.doc.localVersion++;

if(!_.isEmpty(editMessage.diff)){
if(!isEmpty(editMessage.diff)){
// versions match

@@ -223,0 +231,0 @@ // 3) patch the shadow

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

var _ = require('underscore'),
var isEmpty = require('amp-is-empty'),
bind = require('amp-bind'),
jsondiffpatch = require('jsondiffpatch').create({

@@ -17,3 +18,4 @@ objectHash: function(obj) { return obj.id || obj._id || JSON.stringify(obj); }

_.bindAll(this, 'trackConnection');
// bind functions
this.trackConnection = bind(this.trackConnection, this);

@@ -135,3 +137,3 @@ this.transport.on('connection', this.trackConnection);

// 3.a) increase the version number for the shadow if diff not empty
if(!_.isEmpty(edit.diff)){
if(!isEmpty(edit.diff)){
clientDoc.shadow.localVersion++;

@@ -173,3 +175,3 @@ }

// add the difference to the server's edit stack
if(!_.isEmpty(diff)){
if(!isEmpty(diff)){
clientDoc.edits.push({

@@ -176,0 +178,0 @@ serverVersion: basedOnServerVersion,

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