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

crdt

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crdt - npm Package Compare versions

Comparing version 3.1.7 to 3.1.8

18

doc.js
var inherits = require('util').inherits
var Row = require('./row')
var u = require('./utils')
var between = require('between')
var Set = require('./set')

@@ -11,2 +11,9 @@ var Seq = require('./seq')

function merge(to, from) {
for(var k in from)
to[k] = from[k]
return to
}
module.exports = Doc

@@ -44,3 +51,3 @@ //doc

function order (a, b) {
return u.strord(a[1], b[1]) || u.strord(a[2], b[2])
return between.strord(a[1], b[1]) || between.strord(a[2], b[2])
}

@@ -83,3 +90,2 @@

function track (changes, source) {
// var update = [r.id, changes, u.timestamp(), doc.id]
doc.localUpdate([r.id, changes])

@@ -135,5 +141,2 @@ }

//now handled my scuttlebutt.
// if(!this.recieved[from] || this.recieved[from] < timestamp)
// this.recieved[from] = timestamp
// if(!row.validate(changes)) return

@@ -144,2 +147,3 @@

if(!hist[key] || order(hist[key], update) < 0) {
if(hist[key]) this.emit('_remove', hist[key])
hist[key] = update

@@ -157,3 +161,3 @@ changed[key] = changes[key]

u.merge(row.state, changed)
merge(row.state, changed)
for(var k in changed)

@@ -160,0 +164,0 @@ this.sets.emit(k, row, changed)

@@ -6,3 +6,2 @@ //index

var EventEmitter = require('events').EventEmitter
var u = require('./utils')

@@ -9,0 +8,0 @@ exports = module.exports = require('./doc')

@@ -5,3 +5,3 @@ {

"description": "Commutative Replicated Data Types for easy distributed/collaborative apps",
"version": "3.1.7",
"version": "3.1.8",
"homepage": "http://github.com/dominictarr/crdt",

@@ -8,0 +8,0 @@ "repository": {

@@ -6,3 +6,3 @@ 'use strict';

var inherits = require('util').inherits
var u = require('./utils')
var between = require('between')

@@ -13,3 +13,3 @@ module.exports = Seq

return array.sort(function (a, b) {
return u.strord(a.get('_sort'), b.get('_sort'))
return between.strord(a.get('_sort'), b.get('_sort'))
})

@@ -59,4 +59,4 @@ }

var _sort =
u.between(before, after )
+ u.randstr(3) //add a random tail so it's hard
between.between(before, after )
+ between.randstr(3) //add a random tail so it's hard
//to concurrently add two items with the

@@ -63,0 +63,0 @@ //same sort.

'use strict';
var inherits = require('util').inherits
var EventEmitter = require('events').EventEmitter
var u = require('./utils')
var Row = require('./row')
var between = require('between')

@@ -102,3 +102,3 @@ inherits(Set, EventEmitter)

}).sort(function (a, b) {
return u.strord(a._sort || a.id, b._sort || b.id)
return between.strord(a._sort || a.id, b._sort || b.id)
})

@@ -105,0 +105,0 @@ }

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