Skip to content

Commit

Permalink
feat(logic): add convenient function to check nil pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Apr 13, 2023
1 parent dad6f70 commit 3d29c12
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/logic/util/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ func NonZeroOrDefault[T any](v, defaultValue T) T {
}
return defaultValue
}

// IsNil returns true if the given value is nil, false otherwise.
func IsNil(t any) bool {
return t == nil
}

0 comments on commit 3d29c12

Please sign in to comment.