Skip to content

Commit

Permalink
BREAKING: getVarintFromCode returns Uint8Array instead of Array
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Dec 12, 2020
1 parent 8e26a3b commit 60d65df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ function getVarintFromName (name) {
* Get the varint of a code.
*
* @param {CodecCode} code
* @returns {Array.<number>}
* @returns {Uint8Array}
*/
function getVarintFromCode (code) {
return varint.encode(code)
return util.varintEncode(code)
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion test/multicodec.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('multicodec', () => {

it('returns varint from code', () => {
const code = multicodec.getVarintFromCode(multicodec.KECCAK_256)
expect(code).to.eql([0x1b])
expect(code).to.eql(Uint8Array.from([0x1b]))
})

it('returns the codec name from code', () => {
Expand Down

0 comments on commit 60d65df

Please sign in to comment.