Skip to content

Commit

Permalink
refactor: use better names
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-tekuri committed May 4, 2024
1 parent 8caf7ab commit e99697b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/santhosh-tekuri/jsonschema/v6/kind"
)

// TODO: what json-pointer itself has hash symbol

// --

type url (string)
Expand Down Expand Up @@ -269,12 +267,13 @@ func strVal(obj map[string]any, prop string) (string, bool) {
return s, ok
}

func isInteger(v any) bool {
num, ok := new(big.Rat).SetString(fmt.Sprint(v))
return ok && num.IsInt()
func isInteger(num any) bool {
rat, ok := new(big.Rat).SetString(fmt.Sprint(num))
return ok && rat.IsInt()
}

// quote returns single-quoted string.
// used for embedding quoted strings in json
func quote(s string) string {
s = fmt.Sprintf("%q", s)
s = strings.ReplaceAll(s, `\"`, `"`)
Expand Down

0 comments on commit e99697b

Please sign in to comment.