ee20e03cc2
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
16 lines
387 B
TypeScript
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("/");
|
|
};
|