diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-03-29 04:03:49 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 13:03:49 -0400 |
commit | bced52505f32d6cca4f944bb610a8a26767908a8 (patch) | |
tree | da49a5df4b7bd6f8306248069228cd6bd0db1303 /std/path/win32.ts | |
parent | 1397b8e0e7c85762e19d88fde103342bfa563360 (diff) |
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/path/win32.ts')
-rw-r--r-- | std/path/win32.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/std/path/win32.ts b/std/path/win32.ts index 2f28d22c1..d4febf706 100644 --- a/std/path/win32.ts +++ b/std/path/win32.ts @@ -7,7 +7,7 @@ import { CHAR_DOT, CHAR_BACKWARD_SLASH, CHAR_COLON, - CHAR_QUESTION_MARK + CHAR_QUESTION_MARK, } from "./constants.ts"; import { @@ -15,7 +15,7 @@ import { isPathSeparator, isWindowsDeviceRoot, normalizeString, - _format + _format, } from "./utils.ts"; import { assert } from "../testing/asserts.ts"; @@ -259,8 +259,9 @@ export function normalize(path: string): string { tail = ""; } if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) + if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { tail += "\\"; + } if (device === undefined) { if (isAbsolute) { if (tail.length > 0) return `\\${tail}`; @@ -459,8 +460,9 @@ export function relative(from: string, to: string): string { // Lastly, append the rest of the destination (`to`) path that comes after // the common path parts - if (out.length > 0) return out + toOrig.slice(toStart + lastCommonSep, toEnd); - else { + if (out.length > 0) { + return out + toOrig.slice(toStart + lastCommonSep, toEnd); + } else { toStart += lastCommonSep; if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; return toOrig.slice(toStart, toEnd); @@ -590,8 +592,9 @@ export function dirname(path: string): string { } export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") + if (ext !== undefined && typeof ext !== "string") { throw new TypeError('"ext" argument must be a string'); + } assertPath(path); |