MCPcopy Create free account
hub / github.com/observablehq/framework / within

Function within

src/path.ts:89–93  ·  view source on GitHub ↗
(root: string, path: string)

Source from the content-addressed store, hash-verified

87}
88
89export function within(root: string, path: string): boolean {
90 const {relative, normalize, resolve, isAbsolute} = op;
91 path = relative(normalize(resolve(root)), normalize(resolve(path)));
92 return !path.startsWith("..") && !isAbsolute(path);
93}

Callers 2

path-test.tsFile · 0.85
prepareMethod · 0.85

Calls 1

resolveFunction · 0.70

Tested by

no test coverage detected