2021-03-19 22:39:32 +01:00
|
|
|
import { relative as pathRelative } from "path";
|
|
|
|
|
2021-10-11 21:35:40 +02:00
|
|
|
export function isInside(params: { dirPath: string; filePath: string }) {
|
2021-03-19 22:39:32 +01:00
|
|
|
const { dirPath, filePath } = params;
|
|
|
|
|
|
|
|
return !pathRelative(dirPath, filePath).startsWith("..");
|
2021-10-11 21:35:40 +02:00
|
|
|
}
|