mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-09 19:41:21 +00:00
Add IsEmpty; Publish 0.8.1
This commit is contained in:
parent
fb7bde9c24
commit
2e24b64fc1
@ -5,6 +5,7 @@
|
|||||||
FEATURES:
|
FEATURES:
|
||||||
|
|
||||||
- [common] Error.Error() includes cause
|
- [common] Error.Error() includes cause
|
||||||
|
- [common] IsEmpty() for 0 length
|
||||||
|
|
||||||
## 0.8.0 (develop branch)
|
## 0.8.0 (develop branch)
|
||||||
|
|
||||||
|
@ -16,3 +16,14 @@ func IsTypedNil(o interface{}) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if it has zero length.
|
||||||
|
func IsEmpty(o interface{}) bool {
|
||||||
|
rv := reflect.ValueOf(o)
|
||||||
|
switch rv.Kind() {
|
||||||
|
case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String:
|
||||||
|
return rv.Len() == 0
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user