MCPcopy Create free account
hub / github.com/nodejs/node / isUnderMountPoint

Function isUnderMountPoint

lib/internal/vfs/router.js:15–25  ·  view source on GitHub ↗
(normalizedPath, mountPoint)

Source from the content-addressed store, hash-verified

13// '/' check would never match. The trailing-separator guard handles root
14// mount points like 'C:\' so we don't end up with 'C:\\'.
15function isUnderMountPoint(normalizedPath, mountPoint) {
16 if (normalizedPath === mountPoint) {
17 return true;
18 }
19 if (mountPoint === '/') {
20 return StringPrototypeStartsWith(normalizedPath, '/');
21 }
22 const prefix = mountPoint[mountPoint.length - 1] === sep ?
23 mountPoint : mountPoint + sep;
24 return StringPrototypeStartsWith(normalizedPath, prefix);
25}
26
27// Returns a POSIX-style relative path the provider can consume. Uses
28// `path.relative()` so Windows backslash paths are handled correctly, then

Callers 3

shouldHandleMethod · 0.85
#toProviderPathMethod · 0.85
test-vfs-router.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected