core.createpatch
Home > @medplum/core > createPatch
createPatch() function
Produce a 'application/json-patch+json'-type patch to get from one object to another.
This does not alter input or output unless they have a property getter with side-effects (which is not a good idea anyway).
diff is called on each pair of comparable non-primitive nodes in the input/output object trees, producing nested patches. Return undefined to fall back to default behaviour.
Returns list of operations to perform on input to produce output.
Signature:
export declare function createPatch(input: any, output: any, diff?: VoidableDiff): Operation[];
Parameters
Parameter | Type | Description |
|---|---|---|
input | any | The input value. |
output | any | The target value. |
diff | (Optional) Optional diff function. |
Returns:
The list of patch operations.