Skip to content

Commit 160fb9d

Browse files
committed
Updated comments
1 parent 52919fa commit 160fb9d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ result.Str // holds the string
128128
result.Num // holds the float64 number
129129
result.Raw // holds the raw json
130130
result.Index // index of raw value in original json, zero means index unknown
131-
result.Indexes // Indexes contains the indexes of the elements returned by a query containing the '#' character
131+
result.Indexes // Indexes of all the elements that match on a `#(...)#` query
132+
132133
```
133134

134135
There are a variety of handy functions that work on a result:

gjson.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type Result struct {
6464
Num float64
6565
// Index of raw value in original json, zero means index unknown
6666
Index int
67-
// Indexes contains the Indexes of the elements returned by a query containing the '#' character
67+
// Indexes of all the elements that match on a `#(...)#` query.
6868
Indexes []int
6969
}
7070

@@ -1511,7 +1511,8 @@ func parseArray(c *parseContext, i int, path string) (int, bool) {
15111511
raw = res.String()
15121512
}
15131513
jsons = append(jsons, []byte(raw)...)
1514-
indexes = append(indexes, res.Index+parentIndex)
1514+
indexes = append(indexes,
1515+
res.Index+parentIndex)
15151516
k++
15161517
}
15171518
}
@@ -2472,7 +2473,8 @@ func parseInt(s string) (n int64, ok bool) {
24722473
// safeInt validates a given JSON number
24732474
// ensures it lies within the minimum and maximum representable JSON numbers
24742475
func safeInt(f float64) (n int64, ok bool) {
2475-
// https://tc39.es/ecma262/#sec-number.min_safe_integer || https://tc39.es/ecma262/#sec-number.max_safe_integer
2476+
// https://tc39.es/ecma262/#sec-number.min_safe_integer
2477+
// https://tc39.es/ecma262/#sec-number.max_safe_integer
24762478
if f < -9007199254740991 || f > 9007199254740991 {
24772479
return 0, false
24782480
}

0 commit comments

Comments
 (0)