diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-28 02:42:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-28 02:42:01 +0800 |
commit | 7660e1ed907e213a53408fe60a63619a68fd817b (patch) | |
tree | a1b276318c2f4943991716804df2f104778d8354 | |
parent | 43cad6901620ca077e43f195cc5ae4d1c8edb2d0 (diff) | |
download | go-tangerine-7660e1ed907e213a53408fe60a63619a68fd817b.tar.gz go-tangerine-7660e1ed907e213a53408fe60a63619a68fd817b.tar.zst go-tangerine-7660e1ed907e213a53408fe60a63619a68fd817b.zip |
Added a IsList method for type checking []interface{}
-rw-r--r-- | ethutil/value.go | 9 |
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) } |