UNPKG

290 BJavaScriptView Raw
1// @flow strict-local
2import type {FilePath} from '@parcel/types';
3import path from 'path';
4
5export default function isDirectoryInside(child: FilePath, parent: FilePath) {
6 const relative = path.relative(parent, child);
7 return !relative.startsWith('..') && !path.isAbsolute(relative);
8}