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

ipfs-log

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-log - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

29

lib/log.js

@@ -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",

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