Skip to content

toData

toData(model: Model, options?: ToDataOptions): unknown

Emit any Model to a plain POJO / array / scalar tree — the supported observation surface. Keys are YAML keys in canonical order (from the spec), extras merged after ordered keys, Raw unwrapped to its inner value.

  • comments: false (default): Commented wrappers are unwrapped to their values; the returned tree contains no framework wrapper types, so it is safe for toEqual.
  • comments: true: a node that carries a comment is returned as a CommentNode.

Any model may be passed (step, job, on, …). Dedent is NOT one of the yaml-backend passes — emitEntries applies it during the shared pre-backend collection stage that both toData and toYaml walk, so this reproduces it exactly. Unlike toYaml, toData does not run the yaml-backend passes (block-literal promotion, comment geometry) or postProcess, which operate on the backend node; assert those via the YAML string.

Parameter Type

model

Model

options?

ToDataOptions

unknown