MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / __dirname

Function __dirname

lib/helper.js:26–34  ·  view source on GitHub ↗
(pathURL)

Source from the content-addressed store, hash-verified

24
25/** @param {ImportMeta | string} pathURL */
26const __dirname = function dirname(pathURL) {
27 const dir = __filename(pathURL, true)
28 const regex = /\/$/
29 return regex.test(dir)
30 ? dir
31 : fs.existsSync(dir) && fs.statSync(dir).isDirectory()
32 ? dir.replace(regex, '')
33 : path.dirname(dir)
34}
35
36/** @param {ImportMeta | string} dir */
37const __require = function require(dir = import.meta) {

Callers

nothing calls this directly

Calls 1

__filenameFunction · 0.85

Tested by

no test coverage detected