New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 4.0.0 to 5.0.0

index.js

5

cjs/browser-test/test-basics.js
'use strict';
var garbage = require('ipld-garbage');
var ipldGarbage = require('ipld-garbage');
var chai = require('chai');

@@ -10,3 +10,2 @@ var index = require('../index.js');

var garbage__default = /*#__PURE__*/_interopDefaultLegacy(garbage);
var chai__default = /*#__PURE__*/_interopDefaultLegacy(chai);

@@ -171,3 +170,3 @@

for (let ii = 0; ii < 1000; ii++) {
const original = garbage__default['default'](100);
const original = ipldGarbage.garbage(100);
const encoded = encode(original);

@@ -174,0 +173,0 @@ const decoded = decode(encoded);

43

cjs/index.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var cborg = require('cborg');
var CID = require('multiformats/cid');
var codec = require('multiformats/codecs/codec');
var cid = require('multiformats/cid');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {

@@ -30,7 +29,4 @@ if (e && e.__esModule) return e;

var cborg__namespace = /*#__PURE__*/_interopNamespace(cborg);
var CID__default = /*#__PURE__*/_interopDefaultLegacy(CID);
const CID_CBOR_TAG = 42;
const code = 113;
const name = 'dag-cbor';
function cidEncoder(obj) {

@@ -40,8 +36,8 @@ if (obj.asCID !== obj) {

}
const cid = CID__default['default'].asCID(obj);
if (!cid) {
const cid$1 = cid.CID.asCID(obj);
if (!cid$1) {
return null;
}
const bytes = new Uint8Array(cid.bytes.byteLength + 1);
bytes.set(cid.bytes, 1);
const bytes = new Uint8Array(cid$1.bytes.byteLength + 1);
bytes.set(cid$1.bytes, 1);
return [

@@ -72,5 +68,2 @@ new cborg__namespace.Token(cborg__namespace.Type.tag, CID_CBOR_TAG),

};
function encode(node) {
return cborg__namespace.encode(node, encodeOptions);
}
function cidDecoder(bytes) {

@@ -80,3 +73,3 @@ if (bytes[0] !== 0) {

}
return CID__default['default'].decode(bytes.subarray(1));
return cid.CID.decode(bytes.subarray(1));
}

@@ -94,12 +87,12 @@ const decodeOptions = {

decodeOptions.tags[CID_CBOR_TAG] = cidDecoder;
function decode(data) {
return cborg__namespace.decode(data, decodeOptions);
}
var dagcbor = codec.codec({
name,
code,
encode,
decode
});
const {name, code, decode, encode} = {
name: 'dag-cbor',
code: 113,
encode: node => cborg__namespace.encode(node, encodeOptions),
decode: data => cborg__namespace.decode(data, decodeOptions)
};
module.exports = dagcbor;
exports.code = code;
exports.decode = decode;
exports.encode = encode;
exports.name = name;
'use strict';
var garbage = require('ipld-garbage');
var ipldGarbage = require('ipld-garbage');
var chai = require('chai');

@@ -10,3 +10,2 @@ var index = require('../index.js');

var garbage__default = /*#__PURE__*/_interopDefaultLegacy(garbage);
var chai__default = /*#__PURE__*/_interopDefaultLegacy(chai);

@@ -171,3 +170,3 @@

for (let ii = 0; ii < 1000; ii++) {
const original = garbage__default['default'](100);
const original = ipldGarbage.garbage(100);
const encoded = encode(original);

@@ -174,0 +173,0 @@ const decoded = decode(encoded);

'use strict';
import garbage from 'ipld-garbage';
import { garbage } from 'ipld-garbage';
import chai from 'chai';
import dagcbor from '../index.js';
import * as dagcbor from '../index.js';
import {

@@ -6,0 +6,0 @@ bytes,

import * as cborg from 'cborg';
import CID from 'multiformats/cid';
import { codec } from 'multiformats/codecs/codec';
import { CID } from 'multiformats/cid';
const CID_CBOR_TAG = 42;
const code = 113;
const name = 'dag-cbor';
function cidEncoder(obj) {

@@ -42,5 +39,2 @@ if (obj.asCID !== obj) {

};
function encode(node) {
return cborg.encode(node, encodeOptions);
}
function cidDecoder(bytes) {

@@ -63,10 +57,7 @@ if (bytes[0] !== 0) {

decodeOptions.tags[CID_CBOR_TAG] = cidDecoder;
function decode(data) {
return cborg.decode(data, decodeOptions);
}
export default codec({
name,
code,
encode,
decode
});
export const {name, code, decode, encode} = {
name: 'dag-cbor',
code: 113,
encode: node => cborg.encode(node, encodeOptions),
decode: data => cborg.decode(data, decodeOptions)
};
'use strict';
import garbage from 'ipld-garbage';
import { garbage } from 'ipld-garbage';
import chai from 'chai';
import dagcbor from '../index.js';
import * as dagcbor from '../index.js';
import {

@@ -6,0 +6,0 @@ bytes,

{
"name": "@ipld/dag-cbor",
"version": "4.0.0",
"description": "JS implementation of dag-cbor",
"types": "index.d.ts",
"version": "5.0.0",
"description": "JS implementation of DAG-CBOR",
"main": "./cjs/index.js",
"types": "./types/index.d.ts",
"scripts": {
"lint": "standard",
"lint": "standard *.js test/*.js",
"build": "npm run build:js && npm run build:types",
"build:js": "npm_config_yes=true npx ipjs@latest build --tests",
"build:types": "tsc --build",
"check": "tsc --build --noEmit --noErrorTruncation",
"publish": "npm_config_yes=true npx ipjs@latest publish",
"test:cjs": "npm run build && mocha dist/cjs/node-test/test-*.js",
"build:js": "ipjs build --tests --main && npm run build:copy",
"build:copy": "cp -a tsconfig.json index.js dist/ && mkdir -p dist/test && cp test/*.js dist/test/",
"build:types": "npm run build:copy && cd dist && tsc --build",
"publish": "ipjs publish",
"test:cjs": "npm run build:js && mocha dist/cjs/node-test/test-*.js && npm run test:cjs:browser",
"test:node": "hundreds mocha test/test-*.js",
"test:browser": "polendina --cleanup dist/cjs/node-test/test-*.js",
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:browser",
"coverage": "c8 --reporter=html mocha test/test-*.js && npx st -d coverage -p 8080"
"test:cjs:browser": "polendina --page --worker --serviceworker --cleanup dist/cjs/node-test/test-*.js",
"test:ts": "npm run build:types && npm run test --prefix test/ts-use",
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:ts",
"coverage": "c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080"
},

@@ -24,2 +26,3 @@ "exports": {

},
"license": "(Apache-2.0 AND MIT)",
"repository": {

@@ -30,5 +33,5 @@ "type": "git",

"keywords": [
"IPFS"
"IPFS",
"IPLD"
],
"license": "MIT",
"bugs": {

@@ -39,13 +42,14 @@ "url": "https://github.com/ipld/js-dag-cbor/issues"

"dependencies": {
"cborg": "^1.1.2",
"multiformats": "^4.6.1"
"cborg": "^1.2.1",
"multiformats": "^7.0.0"
},
"devDependencies": {
"chai": "^4.3.3",
"chai": "^4.3.4",
"hundreds": "^0.0.9",
"ipld-garbage": "^2.0.0",
"mocha": "^8.3.1",
"ipjs": "^5.0.0",
"ipld-garbage": "^3.0.0",
"mocha": "^8.3.2",
"polendina": "^1.1.0",
"standard": "^16.0.3",
"typescript": "^4.2.3"
"typescript": "^4.2.4"
},

@@ -55,4 +59,14 @@ "directories": {

},
"typesVersions": {
"*": {
"*": [
"types/*"
],
"types/*": [
"types/*"
]
}
},
"author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)",
"browser": "./cjs/index.js"
}
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