Skip to content

Commit

Permalink
Gracefully fail to sort unsortable maps in pods
Browse files Browse the repository at this point in the history
Fixes #406
  • Loading branch information
kimo-k committed Oct 31, 2023
1 parent 151b2f5 commit 22645ac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/day8/re_frame_10x/tools/datafy.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns day8.re-frame-10x.tools.datafy
(:require [clojure.string :as str]
[clojure.walk :as walk]))
[clojure.walk :as walk]
[day8.re-frame-10x.inlined-deps.re-frame.v1v3v0.re-frame.loggers :refer [console]]))

(defn keyboard-event [e]
{:key (.-key e)
Expand Down Expand Up @@ -29,7 +30,13 @@
(str/join "-" (conj mods key-str))))

(defn deep-sorted-map [m]
(walk/postwalk #(cond->> % (map? %) (into (sorted-map))) m))
(walk/postwalk
#(if (map? %)
(try (into (sorted-map) %)
(catch :default _
(do (console :warn "Warning: map has unsortable keys: " %) %)))
%)
m))

(defn alias [k ns->alias]
(if-let [a (get ns->alias (namespace k))]
Expand Down

0 comments on commit 22645ac

Please sign in to comment.