Skip to main content

core.move

Home > @medplum/core > move

move() function

The "move" operation removes the value at a specified location and adds it 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 move the value from. This operation is functionally identical to a "remove" operation on the "from" location, followed immediately by an "add" operation at the target location with the value that was just removed.

The "from" location MUST NOT be a proper prefix of the "path" location; i.e., a location cannot be moved into one of its children.

TODO: throw if the check described in the previous paragraph fails.

Signature:

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

Parameters

Parameter

Type

Description

object

any

The object being patched.

operation

MoveOperation

The operation to perform on the object.

_options

PatchOptions

(Optional) Optional params.

Returns:

MissingError | null

null on success, or error if one occurred.