@openmrs/esm-utils 5.6.1-pre.1889 → 5.6.1-pre.1891

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-utils",
3
- "version": "5.6.1-pre.1889",
3
+ "version": "5.6.1-pre.1891",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Helper utilities for OpenMRS",
6
6
  "browser": "dist/openmrs-esm-utils.js",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "devDependencies": {
42
- "@openmrs/esm-globals": "5.6.1-pre.1889",
42
+ "@openmrs/esm-globals": "5.6.1-pre.1891",
43
43
  "@types/semver": "^7.3.4",
44
44
  "dayjs": "^1.10.4",
45
45
  "rxjs": "^6.5.3"
@@ -1,4 +1,4 @@
1
- import { displayName, formattedName, selectPreferredName } from './patient-helpers';
1
+ import { formatPatientName, getPatientName, selectPreferredName } from './patient-helpers';
2
2
  import {
3
3
  mockPatientWithNoName,
4
4
  mockPatientWithOfficialName,
@@ -19,7 +19,7 @@ describe('Formatted display name', () => {
19
19
  [givenNameOnly, 'given'],
20
20
  [mockPatientWithNoName, ''],
21
21
  ])('Is formatted name text if present else default name format', (name, expected) => {
22
- const result = formattedName(name);
22
+ const result = formatPatientName(name);
23
23
  expect(result).toBe(expected);
24
24
  });
25
25
  });
@@ -30,7 +30,7 @@ describe('Patient display name', () => {
30
30
  [mockPatientWithOfficialName, 'my actual name'],
31
31
  [mockPatientWithNickAndOfficialName, 'my official name'],
32
32
  ])('Is selected from usual name or official name', (patient, expected) => {
33
- const result = displayName(patient);
33
+ const result = getPatientName(patient);
34
34
  expect(result).toBe(expected);
35
35
  });
36
36
  });
@@ -11,9 +11,14 @@ import { type NameUse } from '@openmrs/esm-globals';
11
11
  * @param patient The patient details in FHIR format.
12
12
  * @returns The patient's display name or an empty string if name is not present.
13
13
  */
14
- export function displayName(patient: fhir.Patient): string {
14
+ export function getPatientName(patient: fhir.Patient): string {
15
15
  const name = selectPreferredName(patient, 'usual', 'official');
16
- return formattedName(name);
16
+ return formatPatientName(name);
17
+ }
18
+
19
+ /** @deprecated Use `getPatientName` */
20
+ export function displayName(patient: fhir.Patient): string {
21
+ return getPatientName(patient);
17
22
  }
18
23
 
19
24
  /**
@@ -21,11 +26,16 @@ export function displayName(patient: fhir.Patient): string {
21
26
  * @param name The name to be formatted.
22
27
  * @returns The formatted display name or an empty string if name is undefined.
23
28
  */
24
- export function formattedName(name: fhir.HumanName | undefined): string {
29
+ export function formatPatientName(name: fhir.HumanName | undefined): string {
25
30
  if (name) return name.text ?? defaultFormat(name);
26
31
  return '';
27
32
  }
28
33
 
34
+ /** @deprecated Use `formatPatientName` */
35
+ export function formattedName(name: fhir.HumanName | undefined): string {
36
+ return formatPatientName(name);
37
+ }
38
+
29
39
  /**
30
40
  * Select the preferred name from the collection of names associated with a patient.
31
41
  *