Skip to main content

meta-node

function

rewrite-clj.node/meta-node

(meta-node [children] [metadata data])
Create a node representing a form with metadata. When creating manually, you can specify `metadata` and `data` and spacing between the 2 elems will be included: ```Clojure (require '[rewrite-clj.node :as n]) (-> (n/meta-node (n/keyword-node :foo) (n/vector-node [(n/token-node 1)])) n/string) ;; => "^:foo [1]" (-> (n/meta-node (n/map-node [:foo (n/spaces 1) 42]) (n/vector-node [(n/token-node 1)])) n/string) ;; => "^{:foo 42} [1]" ``` When specifying a sequence of `children`, spacing is explicit: ```Clojure (-> (n/meta-node [(n/keyword-node :foo) (n/spaces 1) (n/vector-node [(n/token-node 1)])]) n/string) ;; => "^:foo [1]" ``` See also: [[raw-meta-node]]

No examples yet. Be the first to add one!