浏览代码

Formatting

Jason Grout 4 年之前
父节点
当前提交
305a03af0d
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      packages/coreutils/src/url.ts

+ 6 - 3
packages/coreutils/src/url.ts

@@ -44,10 +44,13 @@ export namespace URLExt {
    * @returns the joined url.
    */
   export function join(...parts: string[]): string {
-    const first = urlparse(parts[0], {});
-    const prefix = `${first.protocol}${first.slashes ? '//' : ''}${first.auth}${first.host}`;
+    const u = urlparse(parts[0], {});
+    const prefix = `${u.protocol}${u.slashes ? '//' : ''}${u.auth}${u.host}`;
     // If there was a prefix, then the first path must start at the root.
-    const path = posix.join(`${!!prefix && first.pathname[0] !== '/' ? '/' : ''}${first.pathname}`, ...parts.slice(1));
+    const path = posix.join(
+      `${!!prefix && u.pathname[0] !== '/' ? '/' : ''}${u.pathname}`,
+      ...parts.slice(1)
+    );
     return `${prefix}${path === '.' ? '' : path}`;
   }