mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
20 lines
483 B
TypeScript
20 lines
483 B
TypeScript
import { Activity } from "src/interfaces/activity";
|
|
import get from "lodash/get";
|
|
|
|
export const getResourceValue = (activity: Activity): string => {
|
|
const { resourcePath } = activity;
|
|
let resource: string | null = null;
|
|
|
|
if (resourcePath) {
|
|
resource = get(activity, resourcePath) ?? "-";
|
|
} else {
|
|
resource = "-";
|
|
}
|
|
|
|
if (resource) {
|
|
resource = resource.charAt(0).toUpperCase() + resource.slice(1);
|
|
}
|
|
|
|
return resource ?? "-";
|
|
};
|