MCPcopy Index your code
hub / github.com/github/docs / getBasename

Function getBasename

script/move-content.js:289–300  ·  view source on GitHub ↗
(fileOrDirectory)

Source from the content-addressed store, hash-verified

287}
288
289function getBasename(fileOrDirectory) {
290 // Note, can't use fs.lstatSync().isDirectory() because it's just a string
291 // at this point. It might not exist.
292
293 if (fileOrDirectory.endsWith('index.md')) {
294 return path.basename(path.directory(fileOrDirectory))
295 }
296 if (fileOrDirectory.endsWith('.md')) {
297 return path.basename(fileOrDirectory).replace(/\.md$/, '')
298 }
299 return path.basename(fileOrDirectory)
300}
301
302function removeFromChildren(oldPath, opts) {
303 const { verbose } = opts

Callers 2

removeFromChildrenFunction · 0.85
addToChildrenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected