Rewrite-cljs Api Documentation

Version: 0.3.0

rewrite-clj.zip.editz

edit

(edit zloc f & args)

Apply the given function to the s-expression at the given location, using its result to replace the node there. (The result will be coerced to a node if possible.)

edit-multi-line

(edit-multi-line zloc line-fn)

edit-node

(edit-node node f)

Create s-expression from node, apply the function and create node from the result.

edit-token

(edit-token zloc str-fn)

prefix

(prefix zloc s)

replace

(replace zloc value)

Replace the node at the given location with one representing the given value. (The value will be coerced to a node if possible.)

splice

(splice zloc)

Splice the given node, i.e. merge its children into the current one (akin to Clojure’s unquote-splicing macro: ~@...). - if the node is not one that can have children, no modification will be performed. - if the node has no or only whitespace children, it will be removed. - otherwise, splicing will be performed, moving the zipper to the first non-whitespace child afterwards.

suffix

(suffix zloc s)