Comparing version 1.0.4 to 1.0.5
@@ -29,15 +29,2 @@ 'use strict'; | ||
_insert(node) { | ||
let indices = Lazy(node.next).map((next) => Lazy(this._items).map((f) => f.hash).indexOf(next)) // Find the item's parent's indices | ||
const index = indices.toArray().length > 0 ? Math.max(indices.max() + 1, 0) : 0; // find the largest index (latest parent) | ||
this._items.splice(index, 0, node); | ||
return node; | ||
} | ||
_commit() { | ||
const current = Lazy(this._currentBatch).difference(this._items).toArray(); | ||
this._items = this._items.concat(current); | ||
this._currentBatch = []; | ||
} | ||
add(data) { | ||
@@ -69,3 +56,3 @@ if(this._currentBatch.length >= MaxBatchSize) | ||
Log.fetchHistory(this._ipfs, other.items, allHashes).then((history) => { | ||
history.forEach((f) => this._insert(f)) // Insert to the log | ||
history.reverse().forEach((f) => this._insert(f)) // Insert to the log | ||
resolve(final); | ||
@@ -81,2 +68,16 @@ }).catch(reject); | ||
_insert(node) { | ||
let indices = Lazy(node.next).map((next) => Lazy(this._items).map((f) => f.hash).indexOf(next)) // Find the item's parent's indices | ||
const index = indices.toArray().length > 0 ? Math.max(indices.max() + 1, 0) : 0; // find the largest index (latest parent) | ||
console.log("Insert '" + node.payload + "' at " + index, indices.toArray()); | ||
this._items.splice(index, 0, node); | ||
return node; | ||
} | ||
_commit() { | ||
const current = Lazy(this._currentBatch).difference(this._items).toArray(); | ||
this._items = this._items.concat(current); | ||
this._currentBatch = []; | ||
} | ||
/* Public */ | ||
@@ -83,0 +84,0 @@ static create(ipfs, id, items) { |
{ | ||
"name": "ipfs-log", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Append-only log for IPFS", | ||
@@ -5,0 +5,0 @@ "main": "lib/log.js", |
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
48847
1192