-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Description
I suggest adding a default value to all 'To___' methods.
Before:
// ToBool casts an interface to a bool type.
func ToBool(i interface{}) bool {
v, _ := ToBoolE(i)
return v
}
After:
// ToBool casts an interface to a bool type.
func ToBool(i interface{}, default ...bool) bool {
v, err := ToBoolE(i)
if err != nil && len(default) > 0 {
return default[0]
}
return v
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels