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

@ipld/dag-cbor

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ipld/dag-cbor - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

.github/workflows/main.yml

35

index.js

@@ -1,3 +0,3 @@

const cbor = require('borc')
const isCircular = require('is-circular')
import cbor from 'borc'
import isCircular from 'is-circular'

@@ -7,12 +7,9 @@ // https://github.com/ipfs/go-ipfs/issues/3570#issuecomment-273931692

module.exports = multiformats => {
const code = 0x71
const name = 'dag-cbor'
const create = multiformats => {
const { CID, bytes, varint } = multiformats
function tagCID (cid) {
if (typeof cid === 'string') {
cid = new CID(cid).buffer
} else if (CID.isCID(cid)) {
cid = cid.buffer
}
const buffer = Uint8Array.from([...bytes.fromHex('00'), ...cid])
const buffer = Uint8Array.from([...bytes.fromHex('00'), ...cid.buffer])
return new cbor.Tagged(CID_CBOR_TAG, buffer)

@@ -22,9 +19,3 @@ }

function replaceCIDbyTAG (dagNode) {
let circular
try {
circular = isCircular(dagNode)
} catch (e) {
circular = false
}
if (circular) {
if (isCircular(dagNode)) {
throw new Error('The object passed has circular references')

@@ -95,3 +86,3 @@ }

const configureDecoder = (options) => {
let tags = defaultTags
const tags = defaultTags

@@ -105,5 +96,2 @@ if (options) {

}
if (options.tags) {
tags = Object.assign({}, defaultTags, options && options.tags)
}
} else {

@@ -125,3 +113,3 @@ // no options, reset to defaults

configureDecoder()
module.exports.configureDecoder = configureDecoder // for testing
create.configureDecoder = configureDecoder // for testing

@@ -147,5 +135,4 @@ const encode = (node) => {

const code = 0x71
const name = 'dag-cbor'
return { encode, decode, code, name }
}
export default create
{
"name": "@ipld/dag-cbor",
"version": "0.0.0",
"version": "1.0.0",
"description": "JS implementation of dag-cbor",
"main": "src/index.js",
"type": "module",
"scripts": {

@@ -30,5 +31,5 @@ "test": "hundreds mocha test/test-*.js && npm run test:browser",

"garbage": "0.0.0",
"hundreds": "0.0.2",
"mocha": "^7.1.2",
"multiformats": "0.0.1",
"hundreds": "0.0.4",
"mocha": "^8.0.1",
"multiformats": "1.0.7",
"polendina": "^1.0.0",

@@ -35,0 +36,0 @@ "standard": "^14.3.4"

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