6 lines
226 B
TypeScript
6 lines
226 B
TypeScript
import * as path from 'path'
|
|
|
|
export const isParentDir = function (parent: string, dir: string) {
|
|
const relative = path.relative(parent, dir)
|
|
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative)
|
|
}
|