Skip to main content

core.applydefaultvaluestoelement

Home > @medplum/core > applyDefaultValuesToElement

applyDefaultValuesToElement() function

Adds default values to existingValue for the given key and its children. If key is undefined, default values are added to all elements in elements. Default values consist of all fixed and pattern values defined in the relevant elements.

Signature:

export declare function applyDefaultValuesToElement(existingValue: object, elements: Record<string, InternalSchemaElement>, key?: string): object;

Parameters

ParameterTypeDescription
existingValueobjectThe
elementsRecord<string, InternalSchemaElement>The elements to which default values should be added.
keystring(Optional) (optional) The key of the element(s) for which default values should be added. Elements with nested keys are also included. If undefined, default values for all elements are added.

Returns:

object

existingValue with default values added