Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
The code needs some slight changes as the linting rules got stricter.
  • Loading branch information
vmx committed Jan 14, 2020
1 parent 4cf17bb commit fba7dd4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"dependencies": {
"class-is": "^1.1.0",
"multibase": "~0.6.0",
"multicodec": "~0.5.1",
"multihashes": "~0.4.14"
"multicodec": "^1.0.0",
"multihashes": "~0.4.15"
},
"devDependencies": {
"aegir": "^18.2.0",
"aegir": "^20.5.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"multihashing": "~0.3.3",
"multihashing-async": "~0.7.0"
"multihashing-async": "~0.8.0"
},
"engines": {
"node": ">=4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/cid-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ var CIDUtil = {

if (other.version === 0) {
if (other.codec !== 'dag-pb') {
return `codec must be 'dag-pb' for CIDv0`
return "codec must be 'dag-pb' for CIDv0"
}
if (other.multibaseName !== 'base58btc') {
return `multibaseName must be 'base58btc' for CIDv0`
return "multibaseName must be 'base58btc' for CIDv0"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class CID {
* @returns {void}
*/
static validateCID (other) {
let errorMsg = CIDUtil.checkCIDComponents(other)
const errorMsg = CIDUtil.checkCIDComponents(other)
if (errorMsg) {
throw new Error(errorMsg)
}
Expand Down
1 change: 1 addition & 0 deletions test/helpers/gen-cid.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
'use strict'

// CID String: <mbase><version><mcodec><mhash>
Expand Down
12 changes: 8 additions & 4 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ describe('CID', () => {
it('throws on trying to create a CIDv0 with a codec other than dag-pb', () => {
expect(
() => new CID(0, 'dag-cbor', hash)
).to.throw(`codec must be 'dag-pb' for CIDv0`)
).to.throw("codec must be 'dag-pb' for CIDv0")
})

it('throws on trying to create a CIDv0 with a base other than base58btc', () => {
expect(
() => new CID(0, 'dag-pb', hash, 'base32')
).to.throw(`multibaseName must be 'base58btc' for CIDv0`)
).to.throw("multibaseName must be 'base58btc' for CIDv0")
})

it('throws on trying to base encode CIDv0 in other base than base58btc', () => {
Expand Down Expand Up @@ -345,7 +345,9 @@ describe('CID', () => {
const hash = await multihashing(Buffer.from(`TEST${Date.now()}`), 'sha2-256')
const cid = new CID(1, 'dag-pb', hash)
expect(cid.buffer).to.equal(cid.buffer)
expect(Object.hasOwnProperty('buffer')).to.be.false()
// Make sure custom implementation detail properties don't leak into
// the prototype
expect(Object.prototype.hasOwnProperty.call(cid, 'buffer')).to.be.false()
})
it('should cache string representation when it matches the multibaseName it was constructed with', () => {
// not string to cache yet
Expand All @@ -361,7 +363,9 @@ describe('CID', () => {

// it cached!
expect(cid.string).to.equal(base32String)
expect(Object.hasOwnProperty('_string')).to.be.false()
// Make sure custom implementation detail properties don't leak into
// the prototype
expect(Object.prototype.hasOwnProperty.call(cid, '_string')).to.be.false()
expect(cid.toBaseEncodedString()).to.equal(base32String)
expect(cid.toBaseEncodedString('base64')).to.equal('mAXASILp4Fr+PAc/qQUFA3l2uIiOwA2Gjlhd6nLQQ/2HyABWt')

Expand Down
3 changes: 2 additions & 1 deletion test/profiling/cidperf-x.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
'use strict'

const multihashing = require('multihashing')
Expand Down Expand Up @@ -44,7 +45,7 @@ console.log(`Test: Will run "new CID()" ${reps} times.`)
// We just give ~1 second for the JS engine to start and 'rest', etc.
// before starting new tests.
sleep(1000).then(() => {
console.log(`Starting a test...`)
console.log('Starting a test...')
console.time('run'); [...Array(reps).keys()].map(i => {
cidPerf.run(i)
})
Expand Down

0 comments on commit fba7dd4

Please sign in to comment.