aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-28 02:42:01 +0800
committerobscuren <geffobscura@gmail.com>2014-03-28 02:42:01 +0800
commit7660e1ed907e213a53408fe60a63619a68fd817b (patch)
treea1b276318c2f4943991716804df2f104778d8354 /ethutil
parent43cad6901620ca077e43f195cc5ae4d1c8edb2d0 (diff)
downloaddexon-7660e1ed907e213a53408fe60a63619a68fd817b.tar.gz
dexon-7660e1ed907e213a53408fe60a63619a68fd817b.tar.zst
dexon-7660e1ed907e213a53408fe60a63619a68fd817b.zip
Added a IsList method for type checking []interface{}
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/value.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/ethutil/value.go b/ethutil/value.go
index 46681ec2a..04131aba9 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)
}