mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
12 lines
306 B
JavaScript
12 lines
306 B
JavaScript
// @flow strict-local
|
|
import type {FilePath} from '@parcel/types';
|
|
import path from 'path';
|
|
|
|
export default function isDirectoryInside(
|
|
child: FilePath,
|
|
parent: FilePath,
|
|
): boolean {
|
|
const relative = path.relative(parent, child);
|
|
return !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
}
|