File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -68,3 +68,11 @@ func EqualsFold(b, s []byte) (equals bool) {
68
68
}
69
69
return
70
70
}
71
+
72
+ // DefaultBytes returns the provided fallback value if []byte is empty
73
+ func DefaultBytes (value []byte , defaultValue []byte ) []byte {
74
+ if len (value ) <= 0 {
75
+ return defaultValue
76
+ }
77
+ return value
78
+ }
Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ func TrimRight(s string, cutset byte) string {
61
61
return s [:lenStr ]
62
62
}
63
63
64
- // Default returns the provided fallback value if string is empty
65
- func Default (value string , defaultValue string ) string {
64
+ // DefaultString returns the provided fallback value if string is empty
65
+ func DefaultString (value string , defaultValue string ) string {
66
66
if len (value ) <= 0 {
67
67
return defaultValue
68
68
}
You can’t perform that action at this time.
0 commit comments