Skip to content

Commit

Permalink
fix: specify updated formatter for multiaddrs (libp2p#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Jun 2, 2023
1 parent d2920de commit 64d3e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ debug.formatters.k = (v: Key): string => {
}

// Add a formatter for stringifying Multiaddrs
debug.formatters.ma = (v?: Multiaddr): string => {
debug.formatters.a = (v?: Multiaddr): string => {
return v == null ? 'undefined' : v.toString()
}

Expand Down
4 changes: 2 additions & 2 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ describe('logger', () => {
expect(debug.formatters).to.have.property('p').that.is.a('function')
expect(debug.formatters).to.have.property('c').that.is.a('function')
expect(debug.formatters).to.have.property('k').that.is.a('function')
expect(debug.formatters).to.have.property('ma').that.is.a('function')
expect(debug.formatters).to.have.property('a').that.is.a('function')
})

it('test ma formatter', () => {
const ma = multiaddr('/ip4/127.0.0.1/tcp/4001')

expect(debug.formatters.ma(ma)).to.equal(ma.toString())
expect(debug.formatters.a(ma)).to.equal(ma.toString())
})

it('test peerId formatter', () => {
Expand Down

0 comments on commit 64d3e58

Please sign in to comment.