Skip to content

Commit

Permalink
fix: identity codec code can't be encoded in hex
Browse files Browse the repository at this point in the history
also updates deps
  • Loading branch information
hugomrdias authored May 7, 2020
2 parents 5635539 + 3429fd8 commit 92e05c0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
"author": "Alan Shaw",
"license": "MIT",
"dependencies": {
"cids": "~0.7.0",
"cids": "~0.8.0",
"explain-error": "^1.0.4",
"multibase": "~0.6.0",
"multibase": "~0.7.0",
"multihashes": "~0.4.14",
"split2": "^3.1.1",
"yargs": "^15.0.2"
},
"devDependencies": {
"aegir": "^20.4.1",
"aegir": "^21.10.2",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"execa": "^3.4.0"
"execa": "^4.0.0"
},
"contributors": [
"Alan Shaw <[email protected]>",
Expand Down
3 changes: 1 addition & 2 deletions src/core/codecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const CID = require('cids')

module.exports = function codecs () {
return Object.keys(CID.codecs).map(name => {
const code = parseInt(CID.codecs[name].toString('hex'), 16)
return { name, code }
return { name, code: CID.codecs[name] }
})
}
2 changes: 1 addition & 1 deletion test/cli/codecs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('cli codecs', () => {
const cli = CIDToolCli()
const expectedOutput = Object.keys(CID.codecs)
.map(name => {
const code = parseInt(CID.codecs[name].toString('hex'), 16)
const code = CID.codecs[name]
return `${code} ${name}`
})
.join('\n') + '\n'
Expand Down
2 changes: 1 addition & 1 deletion test/core/codecs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('core codecs', () => {
expect(Object.keys(CID.codecs).every(name => {
return codecs.find(c => {
return c.name === name &&
c.code === parseInt(CID.codecs[name].toString('hex'), 16)
c.code === CID.codecs[name]
})
})).to.be.true()
})
Expand Down

0 comments on commit 92e05c0

Please sign in to comment.