Skip to content

Commit b33cb82

Browse files
authored
fix(config): gracefully handle empty schema object (#21)
1 parent b26d86e commit b33cb82

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/homebase/js.cljs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@
8585
(defn js->schema [schema]
8686
(let [schema (js->clj schema)]
8787
(reduce (fn js->schema-reducer [acc [nms nm k :as p]]
88-
(let [v (get str->schema-key (get-in schema p))
89-
k (get str->schema-key k)]
90-
(assoc-in acc [(js->key nms nm) k] v)))
88+
(if-not (and nms nm k)
89+
acc
90+
(let [v (get str->schema-key (get-in schema p))
91+
k (get str->schema-key k)]
92+
(assoc-in acc [(js->key nms nm) k] v))))
9193
{} (u/paths schema))))
9294

9395
(comment

0 commit comments

Comments
 (0)