(keyword name)
(keyword ns name)
Returns a Keyword with the given namespace and name. Do not use :
in the keyword strings, it will be added automatically.
Source
(defn
keyword
"Returns a Keyword with the given namespace and name. Do not use :\n in the keyword strings, it will be added automatically."
([name]
(cond
(keyword? name)
name
(symbol? name)
(Keyword.
(cljs.core/namespace name)
(cljs.core/name name)
(.-str name)
nil)
(string? name)
(let
[parts (.split name "/")]
(if
(== (alength parts) 2)
(Keyword. (aget parts 0) (aget parts 1) name nil)
(Keyword. nil (aget parts 0) name nil)))))
([ns name]
(let
[ns
(cond
(keyword? ns)
(cljs.core/name ns)
(symbol? ns)
(cljs.core/name ns)
:else
ns)
name
(cond
(keyword? name)
(cljs.core/name name)
(symbol? name)
(cljs.core/name name)
:else
name)]
(Keyword. ns name (str (when ns (str ns "/")) name) nil))))