Comparing version 3.3.1 to 3.4.0
@@ -5,3 +5,3 @@ { | ||
"description": "Commutative Replicated Data Types for easy distributed/collaborative apps", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"homepage": "http://github.com/dominictarr/crdt", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -178,2 +178,7 @@ #CRDT - Commutative Replicated Data Types | ||
### Set#onEach(iter) | ||
Iterate over the `Rows` in the set and any new row that may be | ||
added to the set in the future. | ||
### Set#remove(row) | ||
@@ -180,0 +185,0 @@ |
@@ -113,3 +113,2 @@ 'use strict'; | ||
} | ||
} | ||
@@ -121,2 +120,7 @@ | ||
Set.prototype.onEach = function (callback) { | ||
this.forEach(callback) | ||
this.on("add", callback) | ||
} | ||
Set.prototype.asArray = function () { | ||
@@ -123,0 +127,0 @@ return this._array |
@@ -77,5 +77,4 @@ var crdt = require('..') | ||
exports['test - filters'] = function (t) { | ||
console.log("HELLO") | ||
var doc = new crdt.Doc() | ||
console.log("# Filters") | ||
@@ -97,2 +96,3 @@ var set = doc.createSet(function (state) { | ||
doc.add({id: 'b', type: 'thing', what: 5}) | ||
//overwrite the first 'a' | ||
doc.add({id: 'a', type: 'other', what: 7}) | ||
@@ -126,2 +126,28 @@ doc.add({id: 'c', type: 'thing', what: 9}) | ||
exports['test - create set later'] = function (t) { | ||
var doc = new crdt.Doc() | ||
console.log("LATER") | ||
doc.add({id: 'a', type: 'thing', what: 3}) | ||
doc.add({id: 'b', type: 'thing', what: 5}) | ||
doc.add({id: 'a', type: 'other', what: 7}) | ||
doc.add({id: 'c', type: 'thing', what: 9}) | ||
var set = doc.createSet("type", "thing") | ||
var states = [] | ||
set.onEach(function (row, state) { | ||
console.log(state) | ||
states.push(row.state) | ||
}) | ||
a.deepEqual(states, [ | ||
{ id: 'b', type: 'thing', what: 5 }, | ||
{ id: 'c', type: 'thing', what: 9 } | ||
]) | ||
t.end() | ||
} | ||
function log(set) { | ||
@@ -137,1 +163,2 @@ | ||
} | ||
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
1054187
12016
266