epidemic-broadcast-trees
Advanced tools
Comparing version 8.0.4 to 8.0.5
19
index.js
@@ -9,18 +9,2 @@ var events = require('./events')(require('./v3')) | ||
// Returns a function that removes keys from `clock` where `!isFeed(key)`. | ||
function createValidate (isFeed) { | ||
return function (clock) { | ||
for(var outerKey in clock) { | ||
if(!isFeed(outerKey)) { | ||
var _clock = {} | ||
for(var innerKey in clock) { | ||
if(isFeed(innerKey)) _clock[innerKey] = clock[innerKey] | ||
} | ||
return _clock | ||
} | ||
} | ||
return clock | ||
} | ||
} | ||
module.exports = function (opts) { | ||
@@ -67,5 +51,2 @@ var state = events.initialize(opts.id, opts.getMsgAuthor, opts.getMsgSequence) | ||
if(opts.isFeed) | ||
stream._validate = createValidate(opts.isFeed) | ||
opts.getClock(remote_id, function (err, clock) { | ||
@@ -72,0 +53,0 @@ //check if peer exists in state, because we may |
{ | ||
"name": "epidemic-broadcast-trees", | ||
"description": "bandwidth efficient broadcast gossip", | ||
"version": "8.0.4", | ||
"version": "8.0.5", | ||
"homepage": "https://github.com/dominictarr/epidemic-broadcast-trees", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -97,19 +97,3 @@ var createPeer = require('../') | ||
var bs2 = bob.createStream('alice', 2, true) | ||
var as2 = alice.createStream('bob', 2, false) | ||
as2.pipe(bs2).pipe(as2) | ||
bob.append({author: 'bob', sequence: 2, content: 'hello2'}, function () {}) | ||
t.throws(function () { | ||
as.write({alice: -1, bob: -2}) | ||
}) | ||
t.equal(as.ended, true) | ||
t.equal(bs.ended, true) | ||
t.deepEqual(alice.store, bob.store) | ||
t.end() | ||
}) | ||
@@ -133,4 +117,4 @@ | ||
var bs3 = bob.createStream('alice', 3, false) | ||
var bs2 = bob.createStream('charles', 2, false) | ||
var cs2 = charles.createStream('bob', 2, true) | ||
var bs2 = bob.createStream('charles', 3, false) | ||
var cs2 = charles.createStream('bob', 3, true) | ||
@@ -137,0 +121,0 @@ console.log('initial.alice:',alice.progress()) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104823
2394