Skip to content

Commit

Permalink
Add MustParse
Browse files Browse the repository at this point in the history
  • Loading branch information
mg98 committed Jun 24, 2022
1 parent f4b3e66 commit 386c6cc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ func Parse(v interface{}) (Cid, error) {
}
}

// MustParse calls Parse but will panic on error.
func MustParse(v interface{}) Cid {
c, err := Parse(v)
if err != nil {
panic(err)
}
return c
}

// Decode parses a Cid-encoded string and returns a Cid object.
// For CidV1, a Cid-encoded string is primarily a multibase string:
//
Expand Down

0 comments on commit 386c6cc

Please sign in to comment.