From 7660e1ed907e213a53408fe60a63619a68fd817b Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 27 Mar 2014 19:42:01 +0100 Subject: [PATCH] Added a IsList method for type checking []interface{} --- ethutil/value.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ethutil/value.go b/ethutil/value.go index 46681ec2a5..04131aba90 100644 --- a/ethutil/value.go +++ b/ethutil/value.go @@ -149,6 +149,15 @@ func (val *Value) IsStr() bool { return val.Type() == reflect.String } +// Special list checking function. Something is considered +// a list if it's of type []interface{}. The list is usually +// used in conjunction with rlp decoded streams. +func (val *Value) IsList() bool { + _, ok := val.Val.([]interface{}) + + return ok +} + func (val *Value) IsEmpty() bool { return val.Val == nil || ((val.IsSlice() || val.IsStr()) && val.Len() == 0) }