mobilizon.chapril.org-mobil.../js/src/components/Resource/utils.ts
Thomas Citharel ee20e03cc2
Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-08-11 16:46:31 +02:00

16 lines
387 B
TypeScript

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("/");
};