Add helper functions to make some code clearer

This commit is contained in:
Asher
2020-07-30 12:14:31 -05:00
parent c581bca29d
commit e86c066438
3 changed files with 26 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ import {
WorkbenchOptions,
} from "../../../lib/vscode/src/vs/server/ipc"
import { HttpCode, HttpError } from "../../common/http"
import { generateUuid } from "../../common/util"
import { arrayify, generateUuid } from "../../common/util"
import { Args } from "../cli"
import { HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http"
import { settings } from "../settings"
@@ -224,8 +224,7 @@ export class VscodeHttpProvider extends HttpProvider {
}
for (let i = 0; i < startPaths.length; ++i) {
const startPath = startPaths[i]
const url =
startPath && (typeof startPath.url === "string" ? [startPath.url] : startPath.url || []).find((p) => !!p)
const url = arrayify(startPath && startPath.url).find((p) => !!p)
if (startPath && url) {
return {
url,