core.ismedicationarray | Medplum

isMedicationArray() function

Type guard: validates an array of Medication resources (drug search bot output).

Walks every entry rather than spot-checking the first so a tuple-shaped payload like [Medication, MedicationRequest] is rejected (see PR #8999).

Signature:

export declare function isMedicationArray(value: unknown): value is Medication[];

Parameters

Parameter Type Description
value unknown Unknown bot JSON payload.

Returns:

value is Medication[]

True when the value is an array (possibly empty) where every entry passes isResource<Medication>.