Skip to main content

$isEmpty

$isEmpty(value?) -> boolean
Compact type signature<x-:b>

If value is omitted, the current context value is used.

Browse categories

Source: FUME

Documentation

Returns true when a value is empty by FUME's recursive rules.

The function treats undefined values, null, empty or whitespace-only strings, empty arrays, empty objects, and arrays or objects whose nested members are all empty as empty. Numbers, booleans, functions, and any structure containing a non-empty nested value return false.

Examples

Treat a missing field as empty

Input

This example uses the patient-summary example input. The expression checks a field that is not present in the canonical example data.

Example input

JSON
{
"patientId": "pat-0001",
"name": {
"given": "Avery",
"family": "Reed",
"display": "Avery Reed"
},
"birthDate": "1990-06-12",
"sex": "female",
"primaryCareTeam": {
"organization": "ExampleCare",
"facility": "ExampleCare Clinic",
"practitioner": {
"practitionerId": "prac-4001",
"display": "Jordan Kim"
}
},
"identifiers": {
"memberId": "mbr-3001",
"recordNumber": "rec-5001"
},
"tags": [
"demo",
"fictional"
],
"_xmlTagName": "patientSummary"
}

Expression

$isEmpty(name.middle)

Result

true