Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ can specify multiple hostnames in a set.
:default 8082}}}
```

### long, double, keyword, boolean
### int, long, double, keyword, boolean

Use to parse a `String` value into a `Long`, `Double`, keyword or boolean.
Use to parse a `String` value into a `Integer`, `Long`, `Double`, keyword or boolean.

``` clojure
{:debug #boolean #or [#env DEBUG "true"]
Expand Down
5 changes: 5 additions & 0 deletions src/aero/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
#?(:clj (System/getProperty (str value))
:cljs nil))

(defmethod reader 'int
[opts tag value]
#?(:clj (Integer/parseInt (str value)))
#?(:cljs (js/parseInt (str value))))

(defmethod reader 'long
[opts tag value]
#?(:clj (Long/parseLong (str value)))
Expand Down
4 changes: 4 additions & 0 deletions test/aero/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
:false-boolean #boolean "false"
:trivial-false-boolean #boolean "OTHER"
:nil-false-boolean #boolean ""
:int-native #int 1234
:int #int "1234"
:long-native #long 1234
:long #long "1234"
:number 1234
:double #double "4567.8"
:keyword #keyword "foo/bar"
:already-a-keyword #keyword :foo/bar
Expand Down