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
  • Loading branch information
hugomrdias committed May 6, 2020
1 parent 7d28454 commit 3429fd8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
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 3429fd8

Please sign in to comment.