(parent: string, child: string)
| 74 | * Returns whether `child` is equal to or nested below `parent`. |
| 75 | */ |
| 76 | export function isSubpath(parent: string, child: string): boolean { |
| 77 | const relativePath = path.relative(parent, child); |
| 78 | |
| 79 | return ( |
| 80 | relativePath === '' || |
| 81 | (relativePath !== '' && |
| 82 | !relativePath.startsWith('..') && |
| 83 | !path.isAbsolute(relativePath)) |
| 84 | ); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Strips Windows executable extensions before matching package bin names. |
no outgoing calls
no test coverage detected