dict: implemented length of dict
This commit is contained in:
@@ -29,6 +29,9 @@ func evalLength(ctx ExprContext, self *term) (v any, err error) {
|
||||
} else if IsString(childValue) {
|
||||
s, _ := childValue.(string)
|
||||
v = int64(len(s))
|
||||
} else if IsDict(childValue) {
|
||||
m, _ := childValue.(map[any]any)
|
||||
v = int64(len(m))
|
||||
} else if it, ok := childValue.(Iterator); ok {
|
||||
if extIt, ok := childValue.(ExtIterator); ok && extIt.HasOperation(countName) {
|
||||
count, _ := extIt.CallOperation(countName, nil)
|
||||
|
||||
Reference in New Issue
Block a user