Comparing version 2.1.0 to 3.0.0
@@ -15,2 +15,3 @@ const sodium = require('sodium-universal') | ||
this.keySplit = split(this.key) | ||
this.metadata = false | ||
this.hash = hash(this.keySplit) | ||
@@ -20,3 +21,3 @@ this.trie = data.trieBuffer ? trie.decode(data.trieBuffer) : (data.trie || []) | ||
this.valueBuffer = null | ||
this.length = this.hash.length * 4 + 1 | ||
this.length = this.hash.length * 4 + 1 + 1 | ||
this.valueEncoding = enc | ||
@@ -30,2 +31,4 @@ } | ||
Node.prototype.path = function (i) { | ||
if (!i) return this.metadata ? 1 : 0 | ||
i-- | ||
const hash = this.hash | ||
@@ -44,4 +47,5 @@ const j = i >> 2 | ||
Node.prototype.collides = function (node, i) { | ||
if (!i) return false | ||
if (i === this.length - 1) return this.key !== node.key | ||
const j = Math.floor(i / 32) | ||
const j = Math.floor((i - 1) / 32) | ||
return this.keySplit[j] !== node.keySplit[j] | ||
@@ -55,3 +59,3 @@ } | ||
Node.terminator = function (i) { | ||
return ((i + 1) & 31) === 0 | ||
return (i & 31) === 0 | ||
} | ||
@@ -58,0 +62,0 @@ |
{ | ||
"name": "hypertrie", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Distributed single writer key/value store", | ||
@@ -5,0 +5,0 @@ "main": "index.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
75903
2417