dfinity-radix-tree
Advanced tools
Comparing version 0.1.4 to 0.1.5
const Buffer = require('safe-buffer').Buffer | ||
const crypto = require('crypto') | ||
const DAG = require('ipld-graph-builder/datastore.js') | ||
const HASH_LEN = 20 | ||
const cbor = require('borc') | ||
const HASH_LEN = 20 | ||
const LINK_TAG = 42 | ||
module.exports = class TreeDAG extends DAG { | ||
async put (val) { | ||
if (val[1]) { | ||
val[1] = new cbor.Tagged(LINK_TAG, val[1]['/']) | ||
} | ||
if (val[2]) { | ||
val[2] = new cbor.Tagged(LINK_TAG, val[2]['/']) | ||
} | ||
const encoded = cbor.encode(val) | ||
@@ -27,2 +36,8 @@ const key = await TreeDAG.getMerkleLink(encoded) | ||
const decoded = cbor.decode(val) | ||
if (decoded[1]) { | ||
decoded[1]['/'] = decoded[1].value | ||
} | ||
if (decoded[2]) { | ||
decoded[2]['/'] = decoded[2].value | ||
} | ||
resolve(decoded) | ||
@@ -29,0 +44,0 @@ } |
{ | ||
"name": "dfinity-radix-tree", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "This implements a binary merkle radix tree", | ||
@@ -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
269140
1491