Improve parse-int function.

This commit is contained in:
Andrey Antukh 2016-07-09 15:04:24 +03:00
parent 6e36718702
commit 48819a1738
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -94,7 +94,7 @@
(defn parse-int
([v]
(js/parseInt v 10))
(parse-int v nil))
([v default]
(let [v (js/parseInt v 10)]
(if (or (not v) (nan? v))
@ -103,7 +103,7 @@
(defn parse-float
([v]
(js/parseFloat v))
(parse-float v nil))
([v default]
(let [v (js/parseFloat v)]
(if (or (not v) (nan? v))