mobilizon.chapril.org-mobil.../js/src/components/Resource/utils.ts

16 lines
387 B
TypeScript
Raw Normal View History

import { IResource } from "@/types/resource";
export const resourcePath = (resource: IResource | undefined): string => {
const path = resource?.path ?? undefined;
if (path && path[0] === "/") {
return path.slice(1);
}
return path ?? "";
};
export const resourcePathArray = (
resource: IResource | undefined
): string[] => {
return resourcePath(resource).split("/");
};