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 3.0.1 to 3.0.2

9

index.js

@@ -21,8 +21,7 @@ import json from 'fast-json-stable-stringify'

const encode = obj => {
if (typeof obj === 'object' && isCircular(obj)) {
throw new Error('Object contains circular references.')
if (typeof obj === 'object' && !bytes.isBinary(obj) && !CID.isCID(obj) && obj) {
if (isCircular(obj)) throw new Error('Object contains circular references.')
obj = _encode(obj)
}
const data = _encode(obj)
return bytes.fromString(json(data))
return bytes.fromString(json(obj))
}

@@ -29,0 +28,0 @@

{
"name": "@ipld/dag-json",
"version": "3.0.1",
"version": "3.0.2",
"description": "JSON Directed Acrylic Graph for IPLD",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -47,2 +47,16 @@ 'use strict'

})
test('native types', done => {
const flip = obj => dag.decode(dag.encode(obj))
same(flip('test'), 'test')
same(flip(null), null)
same(flip(12), 12)
same(flip(-1), -1)
same(flip(1.2), 1.2)
same(flip(true), true)
same(flip(false), false)
same(flip([]), [])
same(flip(['asdf']), ['asdf'])
done()
})
})
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