Skip to content

Commit

Permalink
Added IsBool
Browse files Browse the repository at this point in the history
See #264
  • Loading branch information
tidwall committed Feb 2, 2022
1 parent e4fc67c commit 82f549e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ func (t Result) IsArray() bool {
return t.Type == JSON && len(t.Raw) > 0 && t.Raw[0] == '['
}

// IsBool returns true if the result value is a JSON boolean.
func (t Result) IsBool() bool {
return t.Type == True || t.Type == False
}

// ForEach iterates through values.
// If the result represents a non-existent value, then no values will be
// iterated. If the result is an Object, the iterator will pass the key and
Expand Down

0 comments on commit 82f549e

Please sign in to comment.