Skip to content

Commit

Permalink
Add docstrings (#9)
Browse files Browse the repository at this point in the history
* Add docstrings

* Concise

* Update arg name
  • Loading branch information
rads authored Oct 19, 2024
1 parent f8fde5c commit 9905502
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/babashka/json.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,31 @@
(def ^:private read-fn read-fn))

(defn read
"Returns a Clojure value from the JSON reader.
Options:
:key-fn - Convert JSON keys using this function. Defaults to keyword."
([reader] (read reader nil))
([reader opts]
(read-fn reader opts)))

(defn read-str
"Returns a Clojure value from the JSON string.
Options:
:key-fn - Convert JSON keys using this function. Defaults to keyword."
([s] (read-str s nil))
([s opts]
(read-str-fn s opts)))

(defn write-str
([s] (write-str s nil))
([s opts]
(write-str-fn s opts)))
"Returns a JSON string from the Clojure value."
([x] (write-str x nil))
([x opts]
(write-str-fn x opts)))

(defn ->json-reader
"Returns a JSON reader."
([x] (->json-reader x nil))
([x opts]
(internal->json-reader x opts)))
Expand Down

0 comments on commit 9905502

Please sign in to comment.