@ipld/dag-json
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -11,2 +11,4 @@ 'use strict' | ||
result[key] = { '/': value.toBaseEncodedString() } | ||
} else if (Buffer.isBuffer(value)) { | ||
result[key] = { '/': { base64: value.toString('base64') } } | ||
} else if (typeof value === 'object' && value !== null) { | ||
@@ -31,3 +33,6 @@ result[key] = _encode(value) | ||
if (value['/'] && Object.keys(value).length === 1) { | ||
result[key] = new CID(value['/']) | ||
if (typeof value['/'] === 'string') result[key] = new CID(value['/']) | ||
else { | ||
result[key] = Buffer.from(value['/'].base64, 'base64') | ||
} | ||
} else { | ||
@@ -34,0 +39,0 @@ result[key] = _decode(value) |
{ | ||
"name": "@ipld/dag-json", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "JSON Directed Acrylic Graph for IPLD", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,5 +18,6 @@ 'use strict' | ||
same(JSON.parse(recode(buffer).toString()), { hello: 'world' }) | ||
let o = { link, buffer: Buffer.from('asdf') } | ||
let o = { link, buffer: Buffer.from('asdf'), n: null, o: {} } | ||
buffer = dag.encode(o) | ||
same(dag.decode(buffer), o) | ||
same(Buffer.isBuffer(dag.decode(buffer).buffer), true) | ||
}) | ||
@@ -23,0 +24,0 @@ |
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
5042
72