@openmrs/esm-patient-common-lib 8.2.1-pre.6053 → 8.2.1-pre.6057
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 +1 -1
- package/src/compare.ts +19 -0
- package/src/index.ts +2 -1
package/package.json
CHANGED
package/src/compare.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enables a comparison of arbitrary values with support for undefined/null.
|
|
3
|
+
* Requires the `<` and `>` operators to return something reasonable for the provided values.
|
|
4
|
+
*/
|
|
5
|
+
export function compare<T>(x?: T, y?: T) {
|
|
6
|
+
if (x == undefined && y == undefined) {
|
|
7
|
+
return 0;
|
|
8
|
+
} else if (x == undefined) {
|
|
9
|
+
return -1;
|
|
10
|
+
} else if (y == undefined) {
|
|
11
|
+
return 1;
|
|
12
|
+
} else if (x < y) {
|
|
13
|
+
return -1;
|
|
14
|
+
} else if (x > y) {
|
|
15
|
+
return 1;
|
|
16
|
+
} else {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './cards';
|
|
2
|
+
export * from './compare';
|
|
2
3
|
export * from './dashboards/createDashboardLink';
|
|
3
4
|
export * from './dashboards/DashboardExtension';
|
|
4
5
|
export * from './empty-state';
|
|
@@ -15,9 +16,9 @@ export * from './orders';
|
|
|
15
16
|
export * from './pagination';
|
|
16
17
|
export * from './patient-summary/patient-summary-extension-order';
|
|
17
18
|
export * from './programs/usePatientProgramEnrollment';
|
|
19
|
+
export * from './store/patient-chart-store';
|
|
18
20
|
export * from './time-helper';
|
|
19
21
|
export * from './types';
|
|
20
22
|
export * from './useAllowedFileExtensions';
|
|
21
23
|
export * from './useSystemVisitSetting';
|
|
22
24
|
export * from './workspaces';
|
|
23
|
-
export * from './store/patient-chart-store';
|