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.7 to 2.0.8

8

index.js

@@ -8,3 +8,3 @@ 'use strict'

let _encode = obj => transform(obj, (result, value, key) => {
const _encode = obj => transform(obj, (result, value, key) => {
if (CID.isCID(value)) {

@@ -26,7 +26,7 @@ result[key] = { '/': value.toBaseEncodedString() }

let data = _encode(obj)
const data = _encode(obj)
return Buffer.from(json(data))
}
let _decode = obj => transform(obj, (result, value, key) => {
const _decode = obj => transform(obj, (result, value, key) => {
if (typeof value === 'object' && value !== null) {

@@ -46,3 +46,3 @@ if (value['/']) {

const decode = buffer => {
let obj = JSON.parse(buffer.toString())
const obj = JSON.parse(buffer.toString())
return _decode({ value: obj }).value

@@ -49,0 +49,0 @@ }

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

@@ -25,10 +25,10 @@ "main": "index.js",

"devDependencies": {
"aegir": "^18.2.2",
"hundreds": "0.0.1",
"aegir": "^20.5.1",
"hundreds": "0.0.2",
"tsame": "^2.0.1"
},
"dependencies": {
"@ipld/codec-interface": "^1.0.3",
"cids": "~0.6.0",
"fast-json-stable-stringify": "^2.0.0",
"@ipld/codec-interface": "^1.0.7",
"cids": "~0.7.2",
"fast-json-stable-stringify": "^2.1.0",
"is-circular": "^1.0.2",

@@ -35,0 +35,0 @@ "lodash.transform": "^4.6.0"

## JSON Directed Acrylic Graph for IPLD
![101633](https://img.shields.io/badge/compiled%20bundle-102k-yellow) ![29503](https://img.shields.io/badge/gzipped%20bundle-30k-yellowgreen)
You probably don't want to use this library directly and instead

@@ -4,0 +6,0 @@ access it through the Block interface.

@@ -15,14 +15,15 @@ 'use strict'

test('encode decode', async () => {
test('encode decode', done => {
let buffer = dag.encode({ hello: 'world' })
same(JSON.parse(recode(buffer).toString()), { hello: 'world' })
let o = { link, buffer: Buffer.from('asdf'), n: null, o: {} }
const 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)
done()
})
test('circular failure', async () => {
let o1 = { hello: 'world' }
let o2 = { o1 }
test('circular failure', done => {
const o1 = { hello: 'world' }
const o2 = { o1 }
o1.o2 = o2

@@ -35,7 +36,9 @@ try {

}
done()
})
test('use reserved space', async () => {
let decoded = dag.decode(dag.encode({ '/': { type: 'stringName' } }))
test('use reserved space', done => {
const decoded = dag.decode(dag.encode({ '/': { type: 'stringName' } }))
same(decoded['/'].type, 'stringName')
done()
})

Sorry, the diff of this file is not supported yet

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