diff options
Diffstat (limited to 'ext/node/polyfills/path/_util.ts')
-rw-r--r-- | ext/node/polyfills/path/_util.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/node/polyfills/path/_util.ts b/ext/node/polyfills/path/_util.ts index 7be482965..9248c68ae 100644 --- a/ext/node/polyfills/path/_util.ts +++ b/ext/node/polyfills/path/_util.ts @@ -106,13 +106,17 @@ export function normalizeString( return res; } +function formatExt(ext) { + return ext ? `${ext[0] === "." ? "" : "."}${ext}` : ""; +} + export function _format( sep: string, pathObject: FormatInputPathObject, ): string { const dir: string | undefined = pathObject.dir || pathObject.root; const base: string = pathObject.base || - (pathObject.name || "") + (pathObject.ext || ""); + (pathObject.name || "") + formatExt(pathObject.ext); if (!dir) return base; if (dir === pathObject.root) return dir + base; return dir + sep + base; |