mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 09:55:46 +00:00
11 lines
317 B
TypeScript
11 lines
317 B
TypeScript
import { relative, sep } from "node:path";
|
|
|
|
import { isPathWithinRoot } from "../domain/localPath.js";
|
|
|
|
export const pathFromRoot = (root: string, path: string): string => {
|
|
const value = relative(root, path);
|
|
return isPathWithinRoot(root, path)
|
|
? value.split(sep).join("/") || "."
|
|
: "<outside-root>";
|
|
};
|