Skip to main content

core.copy

Home > @medplum/core > copy

copy() function

The "copy" operation copies the value at a specified location to the target location. The operation object MUST contain a "from" member, which is a string containing a JSON Pointer value that references the location in the target document to copy the value from. The "from" location MUST exist for the operation to be successful.

This operation is functionally identical to an "add" operation at the target location using the value specified in the "from" member.

Alternatively, it's like 'move' without the 'remove'.

Signature:

export declare function copy(object: any, operation: CopyOperation, _options?: PatchOptions): MissingError | null;

Parameters

Parameter

Type

Description

object

any

The object being patched.

operation

CopyOperation

The operation to perform on the object.

_options

PatchOptions

(Optional) Optional params.

Returns:

MissingError | null

null on success, or error if one occurred.