botbook/node_modules/is-path-inside/index.js
Rodrigo Rodriguez 6ae15fe3e5 Updated.
2024-09-04 13:13:15 -03:00

12 lines
292 B
JavaScript

import path from 'node:path';
export default function isPathInside(childPath, parentPath) {
const relation = path.relative(parentPath, childPath);
return Boolean(
relation &&
relation !== '..' &&
!relation.startsWith(`..${path.sep}`) &&
relation !== path.resolve(childPath)
);
}