diff --git a/check/check.go b/check/check.go index 64048c6..73af42e 100644 --- a/check/check.go +++ b/check/check.go @@ -2,26 +2,6 @@ package check import "reflect" -// Blank checks that the passed string, []byte (or slice of either) -// contains something besides an empty string. -func Blank(i interface{}) bool { - switch v := i.(type) { - case nil: - return false - case string: - return v != "" - case []byte: - return string(v) != "" - case []string: - return v != nil && len(v) != 0 && v[0] != "" - case [][]byte: - return v != nil && len(v) != 0 && string(v[0]) != "" - default: - panic("cannot check if type is blank") - } - return false -} - // IsNil is a shortcut for reflect.ValueOf(foo).IsNil() and should only // be used when foo == nil is in question, such as whenever the value of // foo is an interface of any kind. In fact, every interface should use diff --git a/check/check_test.go b/check/check_test.go index 23611dd..89aa840 100644 --- a/check/check_test.go +++ b/check/check_test.go @@ -7,26 +7,6 @@ import ( "github.com/rwxrob/bonzai/check" ) -func ExampleBlank() { - fmt.Println(check.Blank("")) - fmt.Println(check.Blank(nil)) - fmt.Println(check.Blank([]string{""})) - fmt.Println(check.Blank([][]byte{})) - // and now for true - fmt.Println(check.Blank("some")) - fmt.Println(check.Blank([]string{"some"})) - fmt.Println(check.Blank([][]byte{{'a'}})) - - // Output: - // false - // false - // false - // false - // true - // true - // true -} - func ExampleIsNil() { var names []string var namesi interface{}