index for iterator vals

This commit is contained in:
Josh Baker 2016-12-08 15:00:05 -07:00
parent 456225d161
commit b0e589ad0b
1 changed files with 8 additions and 0 deletions

View File

@ -204,10 +204,18 @@ func (t Result) ForEach(iterator func(key, value Result) bool) {
key.Raw = str key.Raw = str
key.Index = s key.Index = s
} }
for ; i < len(json); i++ {
if json[i] <= ' ' || json[i] == ',' || json[i] == ':' {
continue
}
break
}
s := i
i, value, ok = parseAny(json, i, true) i, value, ok = parseAny(json, i, true)
if !ok { if !ok {
return return
} }
value.Index = s
if !iterator(key, value) { if !iterator(key, value) {
return return
} }