def emit.wrap
import cswap-bend-cli@0.1.0.0/json.bend as Jsonimport Base
import cswap-bend-cli@0.1.0.0/json/quote.bend as Quote
242# A bracketed body: `[]` or `{}` when empty, else the body on its own lines.
243def emit.wrap(open: String, close: String, items: Json, inner: String, +style: U32, +d: Nat) -> String:
244 match items:
245 case JNil{}:
246 open ++ close
247 case _:
248 open ++ Quote.nl(style, Nat.add(d, 1n)) ++ inner ++ Quote.nl(style, d) ++ close