@ipld/dag-cbor
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -83,8 +83,6 @@ 'use strict'; | ||
decodeOptions.tags[CID_CBOR_TAG] = cidDecoder; | ||
const {name, code, decode, encode} = { | ||
name: 'dag-cbor', | ||
code: 113, | ||
encode: node => cborg__namespace.encode(node, encodeOptions), | ||
decode: data => cborg__namespace.decode(data, decodeOptions) | ||
}; | ||
const name = 'dag-cbor'; | ||
const code = 113; | ||
const encode = node => cborg__namespace.encode(node, encodeOptions); | ||
const decode = data => cborg__namespace.decode(data, decodeOptions); | ||
@@ -91,0 +89,0 @@ exports.code = code; |
@@ -56,7 +56,5 @@ import * as cborg from 'cborg'; | ||
decodeOptions.tags[CID_CBOR_TAG] = cidDecoder; | ||
export const {name, code, decode, encode} = { | ||
name: 'dag-cbor', | ||
code: 113, | ||
encode: node => cborg.encode(node, encodeOptions), | ||
decode: data => cborg.decode(data, decodeOptions) | ||
}; | ||
export const name = 'dag-cbor'; | ||
export const code = 113; | ||
export const encode = node => cborg.encode(node, encodeOptions); | ||
export const decode = data => cborg.decode(data, decodeOptions); |
36
index.js
import * as cborg from 'cborg' | ||
import { CID } from 'multiformats/cid' | ||
/** | ||
* @template {number} Code | ||
* @template T | ||
* @typedef {import('multiformats/codecs/interface').BlockCodec<Code, T>} BlockCodec | ||
*/ | ||
// https://github.com/ipfs/go-ipfs/issues/3570#issuecomment-273931692 | ||
@@ -101,21 +95,17 @@ const CID_CBOR_TAG = 42 | ||
export const name = 'dag-cbor' | ||
export const code = 0x71 | ||
/** | ||
* @template T | ||
* @type {BlockCodec<0x71, T>} | ||
* @param {T} node | ||
* @returns {Uint8Array} | ||
*/ | ||
export const { name, code, decode, encode } = { | ||
name: 'dag-cbor', | ||
code: 0x71, | ||
/** | ||
* @template T | ||
* @param {T} node | ||
* @returns {Uint8Array} | ||
*/ | ||
encode: (node) => cborg.encode(node, encodeOptions), | ||
/** | ||
* @template T | ||
* @param {Uint8Array} data | ||
* @returns {T} | ||
*/ | ||
decode: (data) => cborg.decode(data, decodeOptions) | ||
} | ||
export const encode = (node) => cborg.encode(node, encodeOptions) | ||
/** | ||
* @template T | ||
* @param {Uint8Array} data | ||
* @returns {T} | ||
*/ | ||
export const decode = (data) => cborg.decode(data, decodeOptions) |
{ | ||
"name": "@ipld/dag-cbor", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "JS implementation of DAG-CBOR", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
@@ -1,6 +0,5 @@ | ||
export const name: string; | ||
export const name: "dag-cbor"; | ||
export const code: 113; | ||
export const decode: (bytes: import("multiformats/codecs/interface").ByteView<T>) => T; | ||
export const encode: (data: T) => import("multiformats/codecs/interface").ByteView<T>; | ||
export type BlockCodec<Code extends number, T_1> = import('multiformats/codecs/interface').BlockCodec<Code, T_1>; | ||
export function encode<T>(node: T): Uint8Array; | ||
export function decode<T>(data: Uint8Array): T; | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44881
1247