Skip to content

Commit

Permalink
Merge pull request #139 from mg98/feat/must-parse
Browse files Browse the repository at this point in the history
Add MustParse
  • Loading branch information
Stebalien authored Jun 27, 2022
2 parents b106e08 + 386c6cc commit 8f7d7ac
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 8f7d7ac

Please sign in to comment.