2
0

Replace interface{} with any

This commit is contained in:
Jack Christensen
2022-04-09 09:12:55 -05:00
parent 95265a7421
commit f14fb3d692
106 changed files with 1045 additions and 1045 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ package anynil
import "reflect"
// Is returns true if value is any type of nil. e.g. nil or []byte(nil).
func Is(value interface{}) bool {
func Is(value any) bool {
if value == nil {
return true
}
@@ -18,7 +18,7 @@ func Is(value interface{}) bool {
}
// Normalize converts typed nils (e.g. []byte(nil)) into untyped nil. Other values are returned unmodified.
func Normalize(v interface{}) interface{} {
func Normalize(v any) any {
if Is(v) {
return nil
}
@@ -27,7 +27,7 @@ func Normalize(v interface{}) interface{} {
// NormalizeSlice converts all typed nils (e.g. []byte(nil)) in s into untyped nils. Other values are unmodified. s is
// mutated in place.
func NormalizeSlice(s []interface{}) {
func NormalizeSlice(s []any) {
for i := range s {
if Is(s[i]) {
s[i] = nil