Skip to main content

renderPatch

@webda/versioning


Function: renderPatch()

renderPatch(base, delta, options?): string

Defined in: packages/versioning/src/render.ts:47

Render a patch as a git-style unified diff of the YAML serialisation of base vs. the object produced by applying delta. YAML is used because its block-scalar syntax renders multiline string fields across multiple lines — which is what makes the diff look like a real source-file diff rather than a wall of JSON-escaped \n.

Parameters​

base​

unknown

the "before" object

delta​

Delta

the delta to apply (from diff(base, after))

options?​

RenderOptions = {}

formatting options

Returns​

string

unified-diff string; empty string when delta is a no-op