Files
rea/src/reference/ReferenceSourceReaderPaths.ts
T

10 lines
317 B
TypeScript
Raw Normal View History

import { relative, sep } from "node:path";
2026-07-12 21:12:18 +00:00
import { isPathWithinRoot } from "../domain/localPath.js";
2026-07-12 21:12:18 +00:00
export const pathFromRoot = (root: string, path: string): string => {
const value = relative(root, path);
return isPathWithinRoot(root, path)
2026-07-12 21:12:18 +00:00
? value.split(sep).join("/") || "."
: "<outside-root>";
};