MCPcopy
hub / github.com/vitejs/vite / traverseBetweenDirs

Function traverseBetweenDirs

packages/vite/src/node/packages.ts:382–391  ·  view source on GitHub ↗

* Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir. * @param longerDir Longer dir path, e.g. `/User/foo/bar/baz` * @param shorterDir Shorter dir path, e.g. `/User/foo`

(
  longerDir: string,
  shorterDir: string,
  cb: (dir: string) => void,
)

Source from the content-addressed store, hash-verified

380 * @param shorterDir Shorter dir path, e.g. `/User/foo`
381 */
382function traverseBetweenDirs(
383 longerDir: string,
384 shorterDir: string,
385 cb: (dir: string) => void,
386) {
387 while (longerDir !== shorterDir) {
388 cb(longerDir)
389 longerDir = path.dirname(longerDir)
390 }
391}

Callers 4

getRpdCacheFunction · 0.85
setRpdCacheFunction · 0.85
getFnpdCacheFunction · 0.85
setFnpdCacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected