benzap / litter

Number Literals Utility Library in clojure(script)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Litter - Number Literal Utility Library in Clojure(script)

1 What is it for?

To express big numbers in an easier to read way. Especially numbers with repeating zeros. It can be difficult to read 100000000, when it could be expressed as (lit/num :100M)

2 examples

General Number Literals

(require '[litter.core :as lit])

(lit/num "100") ;; 100
(lit/num "100,000") ;; 100000
(lit/num "100,000.2345") ;; 100000.2345
(lit/num "100,000,000") ;; 100000000
(lit/num :100M) ;; 100000000
(lit/num :100M2k20m) ;; 100002000.020
(lit/num :100M20M2k) ;; ERROR
(lit/num "100,000,000,00") ;; ERROR

About

Number Literals Utility Library in clojure(script)

License:Eclipse Public License 1.0


Languages

Language:Clojure 100.0%