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

@ipld/dag-json

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ipld/dag-json - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

7

index.js

@@ -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)

2

package.json
{
"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 @@

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