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

multiformats

Package Overview
Dependencies
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiformats - npm Package Compare versions

Comparing version 10.0.0-pre.2 to 10.0.0-pre.3

dist/types/src/bases/base.d.ts

9

CHANGELOG.md

@@ -1,2 +0,2 @@

## [9.8.0](https://github.com/multiformats/js-multiformats/compare/v9.7.1...v9.8.0) (2022-09-06)
## [9.9.0](https://github.com/multiformats/js-multiformats/compare/v9.8.1...v9.9.0) (2022-09-20)

@@ -6,9 +6,4 @@

* use aegir for build/testing/release ([10d4604](https://github.com/multiformats/js-multiformats/commit/10d4604d5e2ed8d643836f79cb0936a3f52c3488))
* add optional offset param to varint.decode ([#201](https://github.com/multiformats/js-multiformats/issues/201)) ([1e1b583](https://github.com/multiformats/js-multiformats/commit/1e1b583893bc0c984dcbeaf321c17f6637629b4e))
### Bug Fixes
* address JS & TS linting complaints ([e494e3c](https://github.com/multiformats/js-multiformats/commit/e494e3c6347547f79ba638952b2ced2c844a3c91))
## [9.7.1](https://github.com/multiformats/js-multiformats/compare/v9.7.0...v9.7.1) (2022-07-26)

@@ -15,0 +10,0 @@

{
"name": "multiformats",
"version": "10.0.0-pre.2",
"version": "10.0.0-pre.3",
"description": "Interface for multihash, multicodec, multibase and CID",

@@ -25,3 +25,3 @@ "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)",

"type": "module",
"types": "./types/src/index.d.ts",
"types": "./dist/types/src/index.d.ts",
"typesVersions": {

@@ -31,11 +31,11 @@ "*": {

"*",
"types/*",
"types/src/*",
"types/src/*/index"
"dist/types/*",
"dist/types/src/*",
"dist/types/src/*/index"
],
"src/*": [
"*",
"types/*",
"types/src/*",
"types/src/*/index"
"dist/types/*",
"dist/types/src/*",
"dist/types/src/*/index"
]

@@ -51,3 +51,3 @@ }

"tsconfig.json",
"types",
"dist/types",
"vendor",

@@ -59,83 +59,83 @@ "!**/*.tsbuildinfo",

".": {
"types": "./types/src/index.d.ts",
"types": "./dist/types/src/index.d.ts",
"import": "./src/index.js"
},
"./bases/base10": {
"types": "./types/src/bases/base10.d.ts",
"types": "./dist/types/src/bases/base10.d.ts",
"import": "./src/bases/base10.js"
},
"./bases/base16": {
"types": "./types/src/bases/base16.d.ts",
"types": "./dist/types/src/bases/base16.d.ts",
"import": "./src/bases/base16.js"
},
"./bases/base2": {
"types": "./types/src/bases/base2.d.ts",
"types": "./dist/types/src/bases/base2.d.ts",
"import": "./src/bases/base2.js"
},
"./bases/base256emoji": {
"types": "./types/src/bases/base256emoji.d.ts",
"types": "./dist/types/src/bases/base256emoji.d.ts",
"import": "./src/bases/base256emoji.js"
},
"./bases/base32": {
"types": "./types/src/bases/base32.d.ts",
"types": "./dist/types/src/bases/base32.d.ts",
"import": "./src/bases/base32.js"
},
"./bases/base36": {
"types": "./types/src/bases/base36.d.ts",
"types": "./dist/types/src/bases/base36.d.ts",
"import": "./src/bases/base36.js"
},
"./bases/base58": {
"types": "./types/src/bases/base58.d.ts",
"types": "./dist/types/src/bases/base58.d.ts",
"import": "./src/bases/base58.js"
},
"./bases/base64": {
"types": "./types/src/bases/base64.d.ts",
"types": "./dist/types/src/bases/base64.d.ts",
"import": "./src/bases/base64.js"
},
"./bases/base8": {
"types": "./types/src/bases/base8.d.ts",
"types": "./dist/types/src/bases/base8.d.ts",
"import": "./src/bases/base8.js"
},
"./bases/identity": {
"types": "./types/src/bases/identity.d.ts",
"types": "./dist/types/src/bases/identity.d.ts",
"import": "./src/bases/identity.js"
},
"./basics": {
"types": "./types/src/basics.d.ts",
"types": "./dist/types/src/basics.d.ts",
"import": "./src/basics.js"
},
"./block": {
"types": "./types/src/block.d.ts",
"types": "./dist/types/src/block.d.ts",
"import": "./src/block.js"
},
"./bytes": {
"types": "./types/src/bytes.d.ts",
"types": "./dist/types/src/bytes.d.ts",
"import": "./src/bytes.js"
},
"./cid": {
"types": "./types/src/cid.d.ts",
"types": "./dist/types/src/cid.d.ts",
"import": "./src/cid.js"
},
"./codecs/json": {
"types": "./types/src/codecs/json.d.ts",
"types": "./dist/types/src/codecs/json.d.ts",
"import": "./src/codecs/json.js"
},
"./codecs/raw": {
"types": "./types/src/codecs/raw.d.ts",
"types": "./dist/types/src/codecs/raw.d.ts",
"import": "./src/codecs/raw.js"
},
"./hashes/digest": {
"types": "./types/src/hashes/digest.d.ts",
"types": "./dist/types/src/hashes/digest.d.ts",
"import": "./src/hashes/digest.js"
},
"./hashes/hasher": {
"types": "./types/src/hashes/hasher.d.ts",
"types": "./dist/types/src/hashes/hasher.d.ts",
"import": "./src/hashes/hasher.js"
},
"./hashes/identity": {
"types": "./types/src/hashes/identity.d.ts",
"types": "./dist/types/src/hashes/identity.d.ts",
"import": "./src/hashes/identity.js"
},
"./hashes/sha2": {
"types": "./types/src/hashes/sha2.d.ts",
"types": "./dist/types/src/hashes/sha2.d.ts",
"browser": "./src/hashes/sha2-browser.js",

@@ -145,11 +145,11 @@ "import": "./src/hashes/sha2.js"

"./interface": {
"types": "./types/src/interface.d.ts",
"types": "./dist/types/src/interface.d.ts",
"import": "./src/interface.js"
},
"./link": {
"types": "./types/src/link.d.ts",
"types": "./dist/types/src/link.d.ts",
"import": "./src/link.js"
},
"./traversal": {
"types": "./types/src/traversal.d.ts",
"types": "./dist/types/src/traversal.d.ts",
"import": "./src/traversal.js"

@@ -262,5 +262,5 @@ }

"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker --no-cov",
"test:firefox": "aegir test -t browser -- --browser firefox --no-cov",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox --no-cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:electron-main": "aegir test -t electron-main"

@@ -286,3 +286,2 @@ },

"test": {
"cov": true,
"target": [

@@ -289,0 +288,0 @@ "node",

@@ -222,38 +222,3 @@ import * as varint from './varint.js'

// Deprecated
/**
* @param {any} value
* @returns {value is CID}
*/
static isCID (value) {
deprecate(/^0\.0/, IS_CID_DEPRECATION)
return Boolean(value && (value[cidSymbol] || value.asCID === value))
}
get toBaseEncodedString () {
throw new Error('Deprecated, use .toString()')
}
get codec () {
throw new Error(
'"codec" property is deprecated, use integer "code" property instead'
)
}
get buffer () {
throw new Error(
'Deprecated .buffer property, use .bytes to get Uint8Array instead'
)
}
get multibaseName () {
throw new Error('"multibaseName" property is deprecated')
}
get prefix () {
throw new Error('"prefix" property is deprecated')
}
/**
* Takes any input `value` and returns a `CID` instance if it was

@@ -609,36 +574,1 @@ * a `CID` otherwise returns `null`. If `value` is instanceof `CID`

const hidden = { writable: false, enumerable: false, configurable: false }
// ESM does not support importing package.json where this version info
// should come from. To workaround it version is copied here.
const version = '0.0.0-dev'
// Start throwing exceptions on major version bump
/**
*
* @param {RegExp} range
* @param {string} message
*/
const deprecate = (range, message) => {
/* eslint-disable no-console */
if (range.test(version)) {
console.warn(message)
/* c8 ignore next 3 */
} else {
throw new Error(message)
}
}
const IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:
if (CID.isCID(value)) {
doSomethingWithCID(value)
}
Is replaced with:
const cid = CID.asCID(value)
if (cid) {
// Make sure to use cid instead of value
doSomethingWithCID(cid)
}
`

@@ -5,6 +5,7 @@ import varint from '../vendor/varint.js'

* @param {Uint8Array} data
* @param {number} [offset=0]
* @returns {[number, number]}
*/
export const decode = (data) => {
const code = varint.decode(data)
export const decode = (data, offset = 0) => {
const code = varint.decode(data, offset)
return [code, varint.decode.bytes]

@@ -11,0 +12,0 @@ }

@@ -85,10 +85,2 @@ /* globals describe, it */

// This was failing for quite some time, test just missed await so it went
// unnoticed. Not sure we still care about checking fourth argument.
// it('throws on trying to pass specific base encoding [deprecated]', async () => {
// const hash = await sha256.digest(textEncoder.encode('abc'))
// const msg = 'No longer supported, cannot specify base encoding in instantiation'
// assert.throws(() => CID.create(0, 112, hash, 'base32'), msg)
// })
it('throws on trying to base encode CIDv0 in other base than base58btc', async () => {

@@ -290,14 +282,2 @@ const mhStr = 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n'

it('.isCid', () => {
assert.ok(CID.isCID(CID.parse(h1)))
assert.ok(!CID.isCID(false))
assert.ok(!CID.isCID(textEncoder.encode('hello world')))
assert.ok(CID.isCID(CID.parse(h1).toV0()))
assert.ok(CID.isCID(CID.parse(h1).toV1()))
})
it('works with deepEquals', () => {

@@ -520,8 +500,2 @@ const ch1 = CID.parse(h1)

it('isCID', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.strictEqual(OLDCID.isCID(cid), false)
})
it('asCID', async () => {

@@ -551,3 +525,2 @@ const hash = await sha256.digest(textEncoder.encode('abc'))

const incompatibleCID = new IncompatibleCID(version, code, hash)
assert.ok(CID.isCID(incompatibleCID))
assert.strictEqual(incompatibleCID.toString(), '[object Object]')

@@ -726,44 +699,2 @@ // @ts-expect-error - no such method

describe('deprecations', async () => {
it('codec', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.throws(
() => cid.codec,
'"codec" property is deprecated, use integer "code" property instead'
)
assert.throws(
// @ts-expect-error - 'string' is not assignable to parameter of type 'number'
() => CID.create(1, 'dag-pb', hash),
'String codecs are no longer supported'
)
})
it('multibaseName', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.throws(
() => cid.multibaseName,
'"multibaseName" property is deprecated'
)
})
it('prefix', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.throws(() => cid.prefix, '"prefix" property is deprecated')
})
it('toBaseEncodedString()', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.throws(
// @ts-expect-error - deprecated
() => cid.toBaseEncodedString(),
'Deprecated, use .toString()'
)
})
})
it('invalid CID version', async () => {

@@ -773,11 +704,2 @@ const encoded = varint.encodeTo(2, new Uint8Array(32))

})
it('buffer', async () => {
const hash = await sha256.digest(textEncoder.encode('abc'))
const cid = CID.create(1, 112, hash)
assert.throws(
() => cid.buffer,
'Deprecated .buffer property, use .bytes to get Uint8Array instead'
)
})
})
/* globals describe, it */
import * as Link from '../src/link.js'
import { CID } from '../src/cid.js'
import chai from 'chai'

@@ -27,6 +26,2 @@ import chaiAsPromised from 'chai-as-promised'

assert.equal(Link.isLink(false), false)
assert.equal(CID.isCID(CID.parse(h1)), true)
assert.equal(CID.isCID(CID.parse(h1).toV0()), true)
assert.equal(CID.isCID(CID.parse(h1).toV1()), true)
})

@@ -33,0 +28,0 @@

@@ -8,3 +8,3 @@ {

"scripts": {
"test": "npm install && npm_config_yes=true npx -p typescript tsc --noEmit"
"test": "npm install && ../../node_modules/.bin/tsc --noEmit"
},

@@ -11,0 +11,0 @@ "eslintConfig": {

{
"extends": "aegir/src/config/tsconfig.aegir.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": false,
"noImplicitAny": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictFunctionTypes": false,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"strict": true,
"alwaysStrict": true,
"esModuleInterop": true,
"target": "ES2020",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"outDir": "types",
"skipLibCheck": true,
"stripInternal": true,
"resolveJsonModule": true,
"outDir": "dist/types",
"emitDeclarationOnly": true,
"baseUrl": ".",
"composite": true,
"importsNotUsedAsValues": "preserve",
"paths": {

@@ -48,9 +25,3 @@ "multiformats": [

"test"
],
"exclude": [
"vendor",
"test/ts-use",
"node_modules"
],
"compileOnSave": false
}
]
}
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