Skip to main content

core.add

Home > @medplum/core > add

add() function

o If the target location specifies an array index, a new value is inserted into the array at the specified index. o If the target location specifies an object member that does not already exist, a new member is added to the object. o If the target location specifies an object member that does exist, that member's value is replaced.

Signature:

export declare function add(object: any, operation: AddOperation, options?: PatchOptions): MissingError | null;

Parameters

Parameter

Type

Description

object

any

The object being patched.

operation

AddOperation

The operation to perform on the object.

options

PatchOptions

(Optional) Optional params.

Returns:

MissingError | null

null on success, or error if one occurred.