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

Method isDirMatch

deps/npm/lib/commands/install.js:71–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 const partialPath = partialWord.slice(0, lastSlashIdx) || '/'
70
71 const isDirMatch = async sibling => {
72 if (sibling.slice(0, partialName.length) !== partialName) {
73 return false
74 }
75
76 try {
77 const contents = await readdir(join(partialPath, sibling))
78 const result = (contents.indexOf('package.json') !== -1)
79 return result
80 } catch {
81 return false
82 }
83 }
84
85 try {
86 const siblings = await readdir(partialPath)

Callers

nothing calls this directly

Calls 4

sliceMethod · 0.65
readdirFunction · 0.50
joinFunction · 0.50
indexOfMethod · 0.45

Tested by

no test coverage detected