-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename edn.cljc to edn.cljs and reorganize accordingly to fix lint er…
…rors Basically fipp.ednize is cljs only but were using it like it was a cljc file so this addresses that so edn.cljs is properly infected as cljs.
- Loading branch information
Showing
3 changed files
with
93 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns shimmers.common.format) | ||
|
||
;; See https://github.com/brandonbloom/fipp/issues/83 for symbol hack, basically | ||
;; it's forcing EdnPrinter to believe it's a symbol and not a float so it | ||
;; doesn't wrap it in a string. | ||
(defn fixed-width | ||
"Format float `v` to `width` decimal places as long as it's not infinite." | ||
[v width] | ||
#?(:cljs | ||
(if (or (integer? v) (infinite? v)) | ||
v | ||
(symbol (.toFixed v width))) | ||
:clj | ||
(if (or (integer? v) | ||
(= v Double/POSITIVE_INFINITY) | ||
(= v Double/NEGATIVE_INFINITY)) | ||
v | ||
(symbol (format (str "%." width "f") v))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters