( metaurl: string = import.meta.url, scriptpath: string = process.argv[1] )
| 260 | } |
| 261 | |
| 262 | export function isMain( |
| 263 | metaurl: string = import.meta.url, |
| 264 | scriptpath: string = process.argv[1] |
| 265 | ): boolean { |
| 266 | if (metaurl.startsWith('file:')) { |
| 267 | const modulePath = url.fileURLToPath(metaurl).replace(/\.\w+$/, '') |
| 268 | const mainPath = fs.realpathSync(scriptpath).replace(/\.\w+$/, '') |
| 269 | return mainPath === modulePath |
| 270 | } |
| 271 | |
| 272 | return false |
| 273 | } |
| 274 | |
| 275 | export function normalizeExt(ext?: string): string | undefined { |
| 276 | return ext ? path.parse(`foo.${ext}`).ext : ext |
no outgoing calls
no test coverage detected
searching dependent graphs…