mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Rename the Length methods Len to follow GO standart
This commit is contained in:
@@ -269,14 +269,20 @@ func IsASlice(value interface{}) bool {
|
||||
}
|
||||
|
||||
func HasLength(value interface{}) bool {
|
||||
return IsAMap(value) || IsAnArray(value) || IsASlice(value)
|
||||
_, ok := value.(interface{ Len() int })
|
||||
return IsAMap(value) || IsAnArray(value) || IsASlice(value) || ok
|
||||
}
|
||||
func Length(value interface{}) int {
|
||||
func Len(value interface{}) int {
|
||||
l := 1
|
||||
if HasLength(value) {
|
||||
|
||||
if IsAMap(value) || IsAnArray(value) || IsASlice(value) {
|
||||
vc := reflect.ValueOf(value)
|
||||
l = vc.Len()
|
||||
}
|
||||
|
||||
if vc, ok := value.(interface{ Len() int }); ok {
|
||||
l = vc.Len()
|
||||
}
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user