MCPcopy Create free account
hub / github.com/vercel/vercel / isSubpath

Function isSubpath

packages/cli-exec/src/fsutils.ts:76–85  ·  view source on GitHub ↗
(parent: string, child: string)

Source from the content-addressed store, hash-verified

74 * Returns whether `child` is equal to or nested below `parent`.
75 */
76export 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.

Callers 3

getLocalVercelPackageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected