def fold
import bend-toon-codec@0.1.0.0/src/fold.bend as Foldimport Base
import bend-toon-codec@0.1.0.0/src/json.bend as J
239# Fold keys of a value with at most `depth` segments per dotted key; a depth
240# below 2 folds nothing.
241def fold(+j: J.Json, +depth: U32) -> J.Json:
242 fold.if(U32.is_lt(depth, 2), j, depth)