Socket
Socket
Sign inDemoInstall

cids

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cids - npm Package Compare versions

Comparing version 0.5.7 to 0.5.8

.travis.yml

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.5.8"></a>
## [0.5.8](https://github.com/multiformats/js-cid/compare/v0.5.7...v0.5.8) (2019-03-14)
### Performance Improvements
* cache buffer form of CID when created ([c7fc646](https://github.com/multiformats/js-cid/commit/c7fc646))
<a name="0.5.7"></a>

@@ -2,0 +12,0 @@ ## [0.5.7](https://github.com/multiformats/js-cid/compare/v0.5.6...v0.5.7) (2018-12-06)

12

package.json
{
"name": "cids",
"version": "0.5.7",
"version": "0.5.8",
"description": "CID Implementation in JavaScript",

@@ -39,11 +39,11 @@ "leadMaintainer": "Volker Mische <volker.mische@gmail.com>",

"multibase": "~0.6.0",
"multicodec": "~0.2.7",
"multicodec": "~0.5.0",
"multihashes": "~0.4.14"
},
"devDependencies": {
"aegir": "^17.0.0",
"chai": "^4.1.2",
"aegir": "^18.2.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"multihashing": "~0.3.2",
"multihashing-async": "~0.5.1"
"multihashing": "~0.3.3",
"multihashing-async": "~0.5.2"
},

@@ -50,0 +50,0 @@ "engines": {

@@ -5,2 +5,3 @@ # js-cid

[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Travis CI](https://flat.badgen.net/travis/multiformats/js-cid)](https://travis-ci.com/multiformats/js-cid)
[![Coverage Status](https://coveralls.io/repos/github/multiformats/js-cid/badge.svg?branch=master)](https://coveralls.io/github/multiformats/js-cid?branch=master)

@@ -7,0 +8,0 @@ [![Dependency Status](https://david-dm.org/multiformats/js-cid.svg?style=flat-square)](https://david-dm.org/multiformats/js-cid)

@@ -125,7 +125,9 @@ 'use strict'

get buffer () {
switch (this.version) {
case 0:
return this.multihash
case 1:
return Buffer.concat([
let buffer = this._buffer
if (!buffer) {
if (this.version === 0) {
buffer = this.multihash
} else if (this.version === 1) {
buffer = Buffer.concat([
Buffer.from('01', 'hex'),

@@ -135,5 +137,11 @@ multicodec.getCodeVarint(this.codec),

])
default:
} else {
throw new Error('unsupported version')
}
// Cache this buffer so it doesn't have to be recreated
Object.defineProperty(this, '_buffer', { value: buffer })
}
return buffer
}

@@ -140,0 +148,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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