2021-06-18 14:18:46 +00:00
|
|
|
(ns dda.c4k-common.yaml
|
2021-06-18 13:49:43 +00:00
|
|
|
(:require
|
|
|
|
["js-yaml" :as yaml]
|
2021-07-09 14:39:36 +00:00
|
|
|
[clojure.string :as st]))
|
2021-06-18 13:49:43 +00:00
|
|
|
|
|
|
|
(defn from-string [input]
|
|
|
|
(js->clj (yaml/load input)
|
|
|
|
:keywordize-keys true))
|
|
|
|
|
|
|
|
(defn to-string [edn]
|
2021-07-09 14:39:36 +00:00
|
|
|
(yaml/dump (clj->js edn)))
|
|
|
|
|
|
|
|
(defn dispatch-by-resource-name
|
|
|
|
[resource]
|
|
|
|
(keyword (first (st/split resource #"/"))))
|
|
|
|
|
|
|
|
(defmulti load-resource dispatch-by-resource-name)
|