From e99697bfa4883f798870db9797eb4a8fe7eacd75 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Tekuri Date: Sat, 4 May 2024 11:35:01 +0530 Subject: [PATCH] refactor: use better names --- util.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/util.go b/util.go index 9f232a8..eff1ea5 100644 --- a/util.go +++ b/util.go @@ -15,8 +15,6 @@ import ( "github.com/santhosh-tekuri/jsonschema/v6/kind" ) -// TODO: what json-pointer itself has hash symbol - // -- type url (string) @@ -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, `\"`, `"`)