multiformats
Advanced tools
Comparing version 9.0.3 to 9.0.4
@@ -56,3 +56,4 @@ 'use strict'; | ||
arr: [link], | ||
obj: { arr: [{ obj: {} }] } | ||
obj: { arr: [{ obj: {} }] }, | ||
bytes: Uint8Array.from('1234') | ||
}; | ||
@@ -85,3 +86,4 @@ const block$1 = block.createUnsafe({ | ||
'obj/arr/0', | ||
'obj/arr/0/obj' | ||
'obj/arr/0/obj', | ||
'bytes' | ||
]; | ||
@@ -88,0 +90,0 @@ for (const path of block$1.tree()) { |
@@ -56,3 +56,4 @@ 'use strict'; | ||
arr: [link], | ||
obj: { arr: [{ obj: {} }] } | ||
obj: { arr: [{ obj: {} }] }, | ||
bytes: Uint8Array.from('1234') | ||
}; | ||
@@ -85,3 +86,4 @@ const block$1 = block.createUnsafe({ | ||
'obj/arr/0', | ||
'obj/arr/0/obj' | ||
'obj/arr/0/obj', | ||
'bytes' | ||
]; | ||
@@ -88,0 +90,0 @@ for (const path of block$1.tree()) { |
@@ -17,2 +17,4 @@ 'use strict'; | ||
return; | ||
if (source instanceof Uint8Array) | ||
return; | ||
for (const [key, value] of Object.entries(source)) { | ||
@@ -63,3 +65,3 @@ const path = [ | ||
yield path.join('/'); | ||
if (value != null && typeof value === 'object' && !cid.CID.asCID(value)) { | ||
if (value != null && !(value instanceof Uint8Array) && typeof value === 'object' && !cid.CID.asCID(value)) { | ||
if (Array.isArray(value)) { | ||
@@ -66,0 +68,0 @@ for (const [index, element] of value.entries()) { |
@@ -54,3 +54,4 @@ import * as codec from '../src/codecs/json.js'; | ||
arr: [link], | ||
obj: { arr: [{ obj: {} }] } | ||
obj: { arr: [{ obj: {} }] }, | ||
bytes: Uint8Array.from('1234') | ||
}; | ||
@@ -83,3 +84,4 @@ const block = main.createUnsafe({ | ||
'obj/arr/0', | ||
'obj/arr/0/obj' | ||
'obj/arr/0/obj', | ||
'bytes' | ||
]; | ||
@@ -86,0 +88,0 @@ for (const path of block.tree()) { |
@@ -54,3 +54,4 @@ import * as codec from '../src/codecs/json.js'; | ||
arr: [link], | ||
obj: { arr: [{ obj: {} }] } | ||
obj: { arr: [{ obj: {} }] }, | ||
bytes: Uint8Array.from('1234') | ||
}; | ||
@@ -83,3 +84,4 @@ const block = main.createUnsafe({ | ||
'obj/arr/0', | ||
'obj/arr/0/obj' | ||
'obj/arr/0/obj', | ||
'bytes' | ||
]; | ||
@@ -86,0 +88,0 @@ for (const path of block.tree()) { |
@@ -13,2 +13,4 @@ import { | ||
return; | ||
if (source instanceof Uint8Array) | ||
return; | ||
for (const [key, value] of Object.entries(source)) { | ||
@@ -59,3 +61,3 @@ const path = [ | ||
yield path.join('/'); | ||
if (value != null && typeof value === 'object' && !CID.asCID(value)) { | ||
if (value != null && !(value instanceof Uint8Array) && typeof value === 'object' && !CID.asCID(value)) { | ||
if (Array.isArray(value)) { | ||
@@ -62,0 +64,0 @@ for (const [index, element] of value.entries()) { |
{ | ||
"name": "multiformats", | ||
"version": "9.0.3", | ||
"version": "9.0.4", | ||
"description": "Interface for multihash, multicodec, multibase and CID", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/src/index.js", |
@@ -17,2 +17,3 @@ import { bytes as binary, CID } from './index.js' | ||
if (source == null) return | ||
if (source instanceof Uint8Array) return | ||
for (const [key, value] of Object.entries(source)) { | ||
@@ -54,3 +55,3 @@ const path = [...base, key] | ||
yield path.join('/') | ||
if (value != null && typeof value === 'object' && !CID.asCID(value)) { | ||
if (value != null && !(value instanceof Uint8Array) && typeof value === 'object' && !CID.asCID(value)) { | ||
if (Array.isArray(value)) { | ||
@@ -57,0 +58,0 @@ for (const [index, element] of value.entries()) { |
@@ -29,3 +29,3 @@ /* globals describe, it */ | ||
describe('reader', () => { | ||
const value = { link, nope: 'skip', arr: [link], obj: { arr: [{ obj: {} }] } } | ||
const value = { link, nope: 'skip', arr: [link], obj: { arr: [{ obj: {} }] }, bytes: Uint8Array.from('1234') } | ||
const block = main.createUnsafe({ value, codec, hasher, cid: true, bytes: true }) | ||
@@ -40,3 +40,3 @@ test('links', () => { | ||
test('tree', () => { | ||
const expected = ['link', 'nope', 'arr', 'arr/0', 'obj', 'obj/arr', 'obj/arr/0', 'obj/arr/0/obj'] | ||
const expected = ['link', 'nope', 'arr', 'arr/0', 'obj', 'obj/arr', 'obj/arr/0', 'obj/arr/0/obj', 'bytes'] | ||
for (const path of block.tree()) { | ||
@@ -43,0 +43,0 @@ same(path, expected.shift()) |
Sorry, the diff of this file is not supported yet
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
374670
10914