Skip to content

Commit

Permalink
fix: add return to toOptions (#223)
Browse files Browse the repository at this point in the history
Adds return type that constrains family to 4 or 6
  • Loading branch information
achingbrain authored Feb 6, 2022
1 parent 8eb452a commit e5e5f57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ export class Multiaddr {
* // { family: 4, host: '127.0.0.1', transport: 'tcp', port: 4001 }
* ```
*/
toOptions () {
toOptions (): MultiaddrObject {
const parsed = this.toString().split('/')

const opts = {
const opts: MultiaddrObject = {
family: parsed[1] === 'ip4' ? 4 : 6,
host: parsed[2],
transport: parsed[3],
Expand Down

0 comments on commit e5e5f57

Please sign in to comment.